Skip to content

Improve performance of NetHttpRequest timeouts by reusing threads #1375

Closed
@scwhittle

Description

@scwhittle

If a timeout is specified for NetHttpRequest, a singlethreadedexecutor is created.
https://github.com/googleapis/google-http-java-client/blob/master/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java#L184

This creates a new thread for every request which showed up as a 30% cpu increase issuing requests when writing to BigQuery from a Cloud Dataflow pipeline.

It seems that this cost could be reduced by using a cachedThreadPool, or by allowing the caller to inject an executorService to be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions