Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: batch Requests For API Calls #675

Closed
RC1140 opened this issue Jun 21, 2017 · 9 comments
Closed

all: batch Requests For API Calls #675

RC1140 opened this issue Jun 21, 2017 · 9 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@RC1140
Copy link

RC1140 commented Jun 21, 2017

Hi

I either do not have a full grasp of the library (entirely possible) or I cant find out how to batch requests in the same manner that the python and other google client libraries do. The batching that I am reffering to can be found at the link below

https://developers.google.com/api-client-library/python/guide/batch

Can someone please either direct me to the correct location (and I will update the documentation and samples later) or indicate if this is completely missing and need to be implemented still.

Thanks

@rakyll rakyll changed the title Batch Requests For API Calls all: batch Requests For API Calls Jun 21, 2017
@jba
Copy link
Contributor

jba commented Jun 22, 2017

It's missing, and we're unlikely to add it to a particular client unless the underlying service provides a batch RPC. (Otherwise there's no gain.)

I will point out that the first sentence of the page you link to, "each HTTP connection that your application makes results in a certain amount of overhead", doesn't apply to Go. We don't create separate HTTP (or gRPC) connections for each request. So it may be that Python's batching is needed to achieve the performance that we already have in Go.

@RC1140, the best way to proceed is for you to provide a specific example where lack of batching is slowing you down. Then we can see how we can help.

@jba jba added the type: question Request for information or clarification. Not an issue. label Jun 22, 2017
@RC1140
Copy link
Author

RC1140 commented Jun 23, 2017

Hi
I am using the natural language api and making multiple requests for each sentence/tweet that I need to analyze. The number of requests is quite high and it seems quite heavy to make 1000 individual vs 1 request with 1000 items batched.

@pongad
Copy link
Contributor

pongad commented Jun 23, 2017

@RC1140 I assume you're using language/apiv1? You said you make multiple requests for the same sentence. Do you make multiple calls to Analyze* methods? I believe AnnotateText method can perform multiple analysis types in one call. Will this help?

I could be wrong, but I don't think the language RPC itself provides any batching functionality beyond that.

@RC1140
Copy link
Author

RC1140 commented Jun 23, 2017

@pongad Yup that is the api end point I am using (specifically the analyze sentiment), its not multiple requests for the same sentence but rather multiple different sentences. I saw the anotatetext method but that is simple for different types of calls , I am making calls only to the sentiment endpoint, I just have a lot of data that I want to analyze.

@jba
Copy link
Contributor

jba commented Jun 23, 2017

it seems quite heavy to make 1000 individual vs 1 request with 1000 items batched

What do you mean by "heavy"? Do you mean "takes a long time if done sequentially"? That's true, but you can do them in parallel. Do you mean "causes a lot of network traffic"? The total number of bytes is not that much larger.

The best way to convince us that something is wrong is to provide a sample program that behaves poorly compared to one that batches.

@RC1140
Copy link
Author

RC1140 commented Jun 25, 2017

Hi
I was simply looking for a way to make fewer api calls , doesnt seem like its possible though.

@RC1140 RC1140 closed this as completed Jun 25, 2017
@paulmwatson
Copy link

Yes just wanted to +1 this idea. I want to classifyText of hundreds of documents which requires a separate call for each at the moment. A batch method would make it quicker.

@abdullahonden
Copy link

abdullahonden commented May 31, 2018

Hey there,

I'm having the same issue here. I have nearly 250.000 tweets and I'd like to get their sentiment results only. Other services like sentiment140 or Vivekn gives the oppurtunity to send thousands of tweets in one request and returns the result in the same way.

Here it's documented we can use batching but it doesn't seem to implement easy as the services I mentioned above.

@ingmferrer
Copy link

+1, boto3 (AWS library which includes NLP) have this batch solution. I don't want to make hundred of thousands requests to get sentiment analysis.

yoshi-automation added a commit that referenced this issue Nov 11, 2021
This is an auto-generated regeneration of the gapic clients by
cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is
submitted, genbot will update this PR with a newer dependency to the newer
version of genproto and assign reviewers to this PR.

If you have been assigned to review this PR, please:

- Ensure that the version of genproto in go.mod has been updated.
- Ensure that CI is passing. If it's failing, it requires your manual attention.
- Approve and submit this PR if you believe it's ready to ship.

Corresponding genproto PR: googleapis/go-genproto#716

Changes:

feat(texttospeech): update v1beta1 proto
  PiperOrigin-RevId: 409139454
  Source-Link: googleapis/googleapis@7c10623

chore(compute): Add C# generation for Compute v1

  Source-Link: googleapis/googleapis@05a6a82

feat(dialogflow/cx): allow setting custom CA for generic webhooks
  PiperOrigin-RevId: 408995680
  Source-Link: googleapis/googleapis@76f7f48

fix!(networkconnectivity): Mark a couple networkconnectivity API fields as required, to match implemented behavior
  PiperOrigin-RevId: 408969147
  Source-Link: googleapis/googleapis@cc003a4

chore(aiplatform): Add partial C# generation to AI Platform
  PiperOrigin-RevId: 408964828
  Source-Link: googleapis/googleapis@895ad28

chore(binaryauthorization): Fix SystemPolicy service name for BinaryAuthorization V1beta1
  PiperOrigin-RevId: 408764899
  Source-Link: googleapis/googleapis@66878ca

chore(iam/credentials): Update iam/credentials BUILD.bazel package name to google-cloud-iam chore(python): Update iam/credentials namespace to google.cloud.iam_credentials
  PiperOrigin-RevId: 408717007
  Source-Link: googleapis/googleapis@171d777

chore(container): Update container BUILD.bazel package name to google-cloud-container
  chore(python): Update namespace for container API to google.cloud

  PiperOrigin-RevId: 408673815
  Source-Link: googleapis/googleapis@c08b149

docs(datacatalog): Improved formatting
  PiperOrigin-RevId: 408569512
  Source-Link: googleapis/googleapis@c7b3bd0

docs(securitycenter): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408564402
  Source-Link: googleapis/googleapis@3020af5

feat(compute): Move compute.v1 from googleapis-discovery to googleapis (#675)
  * feat: Move compute.v1 from googleapis-discovery to googleapis

  The WORKSPACE file changes are expected to be overridden by the next sync, and it is ok, as the synce'd copy will contain the same changes.

  * feat: sync latest compute.proto files from googleapis-discovery
  Source-Link: googleapis/googleapis@691a18b

chore(aiplatform): update Java and Python dependencies
  PiperOrigin-RevId: 408420890
  Source-Link: googleapis/googleapis@2921f9f

docs(gaming): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408383287
  Source-Link: googleapis/googleapis@2aec4d0

feat(securitycenter): Added resource type and display_name field to the FindingResult, and supported them in the filter for ListFindings and GroupFindings. Also added display_name to the resource which is surfaced in NotificationMessage
  PiperOrigin-RevId: 408362247
  Source-Link: googleapis/googleapis@4d71c45

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360324
  Source-Link: googleapis/googleapis@78eb8a2

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360267
  Source-Link: googleapis/googleapis@8625cf0

docs(storage/internal): Add comments to GCS gRPC API proto spec to describe how naming works
  PiperOrigin-RevId: 408352508
  Source-Link: googleapis/googleapis@be4be3d

feat(binaryauthorization): add new admission rule types to Policy feat: update SignatureAlgorithm enum to match algorithm names in KMS feat: add SystemPolicyV1Beta1 service
  PiperOrigin-RevId: 408346628
  Source-Link: googleapis/googleapis@3dfbdc3

feat(datacatalog): Added BigQueryDateShardedSpec.latest_shard_resource field feat: Added SearchCatalogResult.display_name field feat: Added SearchCatalogResult.description field
  PiperOrigin-RevId: 408274419
  Source-Link: googleapis/googleapis@cbba92c

docs(resourcemanager): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 407854413
  Source-Link: googleapis/googleapis@f81b7bd

feat(workflows/executions): add a stack_trace field to the Error messages specifying where the error occured feat: add call_log_level field to Execution messages doc: clarify requirement to escape strings within JSON arguments
  Update the Execution proto with stack_trace field which is populated on output if an error occurs, and the call_log_level field can be specified on input to request that function calls and/or errors for the given execution be logged to Cloud Logging.

  PiperOrigin-RevId: 407842136
  Source-Link: googleapis/googleapis@cd48c16

feat(dialogflow): added support to configure security settings, language code and time zone on conversation profile
  PiperOrigin-RevId: 407663596
  Source-Link: googleapis/googleapis@f9acb37

feat(functions): Secret Manager integration fields 'secret_environment_variables' and 'secret_volumes' added feat: CMEK integration fields 'kms_key_name' and 'docker_repository' added
  PiperOrigin-RevId: 407654258
  Source-Link: googleapis/googleapis@09b2576

feat(contactcenterinsights): Add ability to update phrase matchers feat: Add issue model stats to time series feat: Add display name to issue model stats
  PiperOrigin-RevId: 407647313
  Source-Link: googleapis/googleapis@33fd29d
yoshi-automation added a commit that referenced this issue Nov 11, 2021
This is an auto-generated regeneration of the gapic clients by
cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is
submitted, genbot will update this PR with a newer dependency to the newer
version of genproto and assign reviewers to this PR.

If you have been assigned to review this PR, please:

- Ensure that the version of genproto in go.mod has been updated.
- Ensure that CI is passing. If it's failing, it requires your manual attention.
- Approve and submit this PR if you believe it's ready to ship.

Corresponding genproto PR: googleapis/go-genproto#716

Changes:

feat(texttospeech): update v1beta1 proto
  PiperOrigin-RevId: 409139454
  Source-Link: googleapis/googleapis@7c10623

chore(compute): Add C# generation for Compute v1

  Source-Link: googleapis/googleapis@05a6a82

feat(dialogflow/cx): allow setting custom CA for generic webhooks
  PiperOrigin-RevId: 408995680
  Source-Link: googleapis/googleapis@76f7f48

fix!(networkconnectivity): Mark a couple networkconnectivity API fields as required, to match implemented behavior
  PiperOrigin-RevId: 408969147
  Source-Link: googleapis/googleapis@cc003a4

chore(aiplatform): Add partial C# generation to AI Platform
  PiperOrigin-RevId: 408964828
  Source-Link: googleapis/googleapis@895ad28

chore(binaryauthorization): Fix SystemPolicy service name for BinaryAuthorization V1beta1
  PiperOrigin-RevId: 408764899
  Source-Link: googleapis/googleapis@66878ca

chore(iam/credentials): Update iam/credentials BUILD.bazel package name to google-cloud-iam chore(python): Update iam/credentials namespace to google.cloud.iam_credentials
  PiperOrigin-RevId: 408717007
  Source-Link: googleapis/googleapis@171d777

chore(container): Update container BUILD.bazel package name to google-cloud-container
  chore(python): Update namespace for container API to google.cloud

  PiperOrigin-RevId: 408673815
  Source-Link: googleapis/googleapis@c08b149

docs(datacatalog): Improved formatting
  PiperOrigin-RevId: 408569512
  Source-Link: googleapis/googleapis@c7b3bd0

docs(securitycenter): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408564402
  Source-Link: googleapis/googleapis@3020af5

feat(compute): Move compute.v1 from googleapis-discovery to googleapis (#675)
  * feat: Move compute.v1 from googleapis-discovery to googleapis

  The WORKSPACE file changes are expected to be overridden by the next sync, and it is ok, as the synce'd copy will contain the same changes.

  * feat: sync latest compute.proto files from googleapis-discovery
  Source-Link: googleapis/googleapis@691a18b

chore(aiplatform): update Java and Python dependencies
  PiperOrigin-RevId: 408420890
  Source-Link: googleapis/googleapis@2921f9f

docs(gaming): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408383287
  Source-Link: googleapis/googleapis@2aec4d0

feat(securitycenter): Added resource type and display_name field to the FindingResult, and supported them in the filter for ListFindings and GroupFindings. Also added display_name to the resource which is surfaced in NotificationMessage
  PiperOrigin-RevId: 408362247
  Source-Link: googleapis/googleapis@4d71c45

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360324
  Source-Link: googleapis/googleapis@78eb8a2

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360267
  Source-Link: googleapis/googleapis@8625cf0

docs(storage/internal): Add comments to GCS gRPC API proto spec to describe how naming works
  PiperOrigin-RevId: 408352508
  Source-Link: googleapis/googleapis@be4be3d

feat(binaryauthorization): add new admission rule types to Policy feat: update SignatureAlgorithm enum to match algorithm names in KMS feat: add SystemPolicyV1Beta1 service
  PiperOrigin-RevId: 408346628
  Source-Link: googleapis/googleapis@3dfbdc3

feat(datacatalog): Added BigQueryDateShardedSpec.latest_shard_resource field feat: Added SearchCatalogResult.display_name field feat: Added SearchCatalogResult.description field
  PiperOrigin-RevId: 408274419
  Source-Link: googleapis/googleapis@cbba92c

docs(resourcemanager): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 407854413
  Source-Link: googleapis/googleapis@f81b7bd

feat(workflows/executions): add a stack_trace field to the Error messages specifying where the error occured feat: add call_log_level field to Execution messages doc: clarify requirement to escape strings within JSON arguments
  Update the Execution proto with stack_trace field which is populated on output if an error occurs, and the call_log_level field can be specified on input to request that function calls and/or errors for the given execution be logged to Cloud Logging.

  PiperOrigin-RevId: 407842136
  Source-Link: googleapis/googleapis@cd48c16

feat(dialogflow): added support to configure security settings, language code and time zone on conversation profile
  PiperOrigin-RevId: 407663596
  Source-Link: googleapis/googleapis@f9acb37

feat(functions): Secret Manager integration fields 'secret_environment_variables' and 'secret_volumes' added feat: CMEK integration fields 'kms_key_name' and 'docker_repository' added
  PiperOrigin-RevId: 407654258
  Source-Link: googleapis/googleapis@09b2576

feat(contactcenterinsights): Add ability to update phrase matchers feat: Add issue model stats to time series feat: Add display name to issue model stats
  PiperOrigin-RevId: 407647313
  Source-Link: googleapis/googleapis@33fd29d
codyoss pushed a commit that referenced this issue Nov 11, 2021
This is an auto-generated regeneration of the gapic clients by
cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is
submitted, genbot will update this PR with a newer dependency to the newer
version of genproto and assign reviewers to this PR.

If you have been assigned to review this PR, please:

- Ensure that the version of genproto in go.mod has been updated.
- Ensure that CI is passing. If it's failing, it requires your manual attention.
- Approve and submit this PR if you believe it's ready to ship.

Corresponding genproto PR: googleapis/go-genproto#716

Changes:

feat(texttospeech): update v1beta1 proto
  PiperOrigin-RevId: 409139454
  Source-Link: googleapis/googleapis@7c10623

chore(compute): Add C# generation for Compute v1

  Source-Link: googleapis/googleapis@05a6a82

feat(dialogflow/cx): allow setting custom CA for generic webhooks
  PiperOrigin-RevId: 408995680
  Source-Link: googleapis/googleapis@76f7f48

fix!(networkconnectivity): Mark a couple networkconnectivity API fields as required, to match implemented behavior
  PiperOrigin-RevId: 408969147
  Source-Link: googleapis/googleapis@cc003a4

chore(aiplatform): Add partial C# generation to AI Platform
  PiperOrigin-RevId: 408964828
  Source-Link: googleapis/googleapis@895ad28

chore(binaryauthorization): Fix SystemPolicy service name for BinaryAuthorization V1beta1
  PiperOrigin-RevId: 408764899
  Source-Link: googleapis/googleapis@66878ca

chore(iam/credentials): Update iam/credentials BUILD.bazel package name to google-cloud-iam chore(python): Update iam/credentials namespace to google.cloud.iam_credentials
  PiperOrigin-RevId: 408717007
  Source-Link: googleapis/googleapis@171d777

chore(container): Update container BUILD.bazel package name to google-cloud-container
  chore(python): Update namespace for container API to google.cloud

  PiperOrigin-RevId: 408673815
  Source-Link: googleapis/googleapis@c08b149

docs(datacatalog): Improved formatting
  PiperOrigin-RevId: 408569512
  Source-Link: googleapis/googleapis@c7b3bd0

docs(securitycenter): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408564402
  Source-Link: googleapis/googleapis@3020af5

feat(compute): Move compute.v1 from googleapis-discovery to googleapis (#675)
  * feat: Move compute.v1 from googleapis-discovery to googleapis

  The WORKSPACE file changes are expected to be overridden by the next sync, and it is ok, as the synce'd copy will contain the same changes.

  * feat: sync latest compute.proto files from googleapis-discovery
  Source-Link: googleapis/googleapis@691a18b

chore(aiplatform): update Java and Python dependencies
  PiperOrigin-RevId: 408420890
  Source-Link: googleapis/googleapis@2921f9f

docs(gaming): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408383287
  Source-Link: googleapis/googleapis@2aec4d0

feat(securitycenter): Added resource type and display_name field to the FindingResult, and supported them in the filter for ListFindings and GroupFindings. Also added display_name to the resource which is surfaced in NotificationMessage
  PiperOrigin-RevId: 408362247
  Source-Link: googleapis/googleapis@4d71c45

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360324
  Source-Link: googleapis/googleapis@78eb8a2

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360267
  Source-Link: googleapis/googleapis@8625cf0

docs(storage/internal): Add comments to GCS gRPC API proto spec to describe how naming works
  PiperOrigin-RevId: 408352508
  Source-Link: googleapis/googleapis@be4be3d

feat(binaryauthorization): add new admission rule types to Policy feat: update SignatureAlgorithm enum to match algorithm names in KMS feat: add SystemPolicyV1Beta1 service
  PiperOrigin-RevId: 408346628
  Source-Link: googleapis/googleapis@3dfbdc3

feat(datacatalog): Added BigQueryDateShardedSpec.latest_shard_resource field feat: Added SearchCatalogResult.display_name field feat: Added SearchCatalogResult.description field
  PiperOrigin-RevId: 408274419
  Source-Link: googleapis/googleapis@cbba92c

docs(resourcemanager): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 407854413
  Source-Link: googleapis/googleapis@f81b7bd

feat(workflows/executions): add a stack_trace field to the Error messages specifying where the error occured feat: add call_log_level field to Execution messages doc: clarify requirement to escape strings within JSON arguments
  Update the Execution proto with stack_trace field which is populated on output if an error occurs, and the call_log_level field can be specified on input to request that function calls and/or errors for the given execution be logged to Cloud Logging.

  PiperOrigin-RevId: 407842136
  Source-Link: googleapis/googleapis@cd48c16

feat(dialogflow): added support to configure security settings, language code and time zone on conversation profile
  PiperOrigin-RevId: 407663596
  Source-Link: googleapis/googleapis@f9acb37

feat(functions): Secret Manager integration fields 'secret_environment_variables' and 'secret_volumes' added feat: CMEK integration fields 'kms_key_name' and 'docker_repository' added
  PiperOrigin-RevId: 407654258
  Source-Link: googleapis/googleapis@09b2576

feat(contactcenterinsights): Add ability to update phrase matchers feat: Add issue model stats to time series feat: Add display name to issue model stats
  PiperOrigin-RevId: 407647313
  Source-Link: googleapis/googleapis@33fd29d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

6 participants