ostinelli / net-http2

NetHttp2 is an HTTP/2 client for Ruby.
MIT License
140 stars 31 forks source link

sleep time in stream.rb and client.rb #6

Closed adamvduke closed 8 years ago

adamvduke commented 8 years ago

Hi, first I wanted to say thanks for contributing the gem! We're using apnotic to try out the HTTP2 APNS endpoints and see the time to complete a request has a consistent floor very near 100ms.

screen shot 2016-05-20 at 3 19 23 pm

I was wondering how the times to sleep were decided on here and here. Is there a specific reason 100ms is used and/or can it be made smaller or configurable?

ostinelli commented 8 years ago

Hi @adamvduke, we can totally make it smaller & configurable. Give me a couple of days and I'll issue a change. Would you mind giving me your feedback then?

Also, a side question: how many pushes are you doing / day?

adamvduke commented 8 years ago

The current throughput for this particular service is ~10k/day, but the expected throughput is 10's of millions. Happy to give feedback on any changes or help if needed.

ostinelli commented 8 years ago

This commit gets rid of any delay, and will instantly unlock the blocking call ASA the response is received.

Can you try master NetHttp2 with Apnotic and see if this works for you? I can build a temp branch of Apnotic that uses master NetHttp2 if that's a hassle for you.

acceber95 commented 8 years ago

Hi @ostinelli,

The temp branch of apnotic would be helpful because the version of net-http2 has changed from ~> 0.9.2 in source to ~> 0.10.0 which causes some issues with bundler when trying to resolve correct versions based on apnotic's current gemspec.

cc @adamvduke

ostinelli commented 8 years ago

@acceber95, @adamvduke

I realized that my proposal is undoable, since I cannot specify a dependency to a gem's master branch. Just set in your Gemfile:

gem 'apnotic', '~> 0.9'
gem 'net-http2', git: 'https://github.com/ostinelli/net-http2.git', ref: 'a86074ce406db68190ec50a344d521d71ec91ee6'
ostinelli commented 8 years ago

NetHttp2 0.11.1 and Apnotic 0.9.2 have been released.

I haven't heard back from you @adamvduke, let me know if this solves your issue.

adamvduke commented 8 years ago

I will try to test it out this week.

ostinelli commented 8 years ago

Hello @adamvduke, any news on this?

adamvduke commented 8 years ago

We've seen the timing drop down to around 75ms on average and it is not a hard floor anymore. We haven't seen a noticeable change in response codes or exception rates from Apple, which seems to indicate things are working well.

screen shot 2016-05-31 at 11 27 56 am

ostinelli commented 8 years ago

Thank you for the feedback, @adamvduke. If you end up using Apnotic for the millions pushes that you were referring to, please let me know :)