googleapis/google-api-nodejs-client

Add support for HTTP/2 requests

JustinBeckwith opened this issue ยท 13 comments

With the demise of batch, we need a better way to make requests in tight loops:
https://developers.googleblog.com/2018/03/discontinuing-support-for-json-rpc-and.html

We should try out the experimental HTTP/2 support in node.js core, and provide an API to turn it on.

Hello @JustinBeckwith, sadly batches were removed from library, I marked this day in calendar with a sad emoji. ๐Ÿ˜ข

Would be great if you can give any recommendations on how to make thousands of homogeneous requests to Google Drive API. I have to perform similar actions (files.update) on a lot of files (thousands). I faced API quotas and have to limit requests pressure and backoff strategy from my side.

At the moment I'm using Batchelor to organise requests in batches, this requires a bit of extra auth routines and feels like a bit different. Is there a best practice how to perform mass similar operations to Google Drive?

motin commented

We should try out the experimental HTTP/2 support in node.js core, and provide an API to turn it on.

With Node v10 the http2 module has become a stable addition, and I trust that the Google API:s themselves support HTTP/2. What are the current blockers / steps towards supporting HTTP/2 requests? Does request need to support HTTP/2? Let us know the game plan, and we can help out in relevant ways :)

Has this issue gone anywhere? I'm currently moving away from global batch endpoints and proper HTTP/2 support would be hugely helpful.

bcoe commented

@nickbclifford we've released a variety of the APIs supported by google-api-nodejs-client as gRPC libraries, which use http2 for transport, a list can be found here:

https://github.com/googleapis/google-cloud-node

There's no immediate plan to add http2 support to google-api-nodejs-client.

Is there a better solution available using other APIs that aren't available through Google Cloud (i.e. Gmail)? Since batching was removed, there's really no obvious first-party solution for many API requests.

If there won't be http2 support in this library, can we have a example in how to use the /batch/library/v1 endpoints manually? I need to reduce the overhead in looping and making a ton of RESTful requests.

Thanks

I had success with using "request" to perform a batch request, but sadly this library is deprecated so I don't want to use it. I couldn't even get a curl to work but "request" worked fine, I don't what I'm doing wrong.
Seems like I will have to refrain from using the batch endpoints and send multiple requests at a time

Good news everyone! We have experimental HTTP/2 support brewing here:
#2246

For those interested in the gory details, the real magic is here:
googleapis/nodejs-googleapis-common#293

Since it's been a while since this landed, calling this done :) Please it out and leave feedback!
https://github.com/googleapis/google-api-nodejs-client#http2

What is the state of HTTP/2, when would this be ready to use in production?

Hey @bramkragten really I was just trying to get a few miles on the implementation before we called it good to go. Nobody has really complained or filed any bugs, so I assume it's working ok :) I'll go ahead and lift the "experimental" warning here next week.

Hey Justin, my company is evaluating the usage of this flag in prod but still wary of the "experimental" warning -- is there a planned release coming that removes the warning?

Yeah, it's been a year now - I think it's time.
googleapis/nodejs-googleapis-common#401