-
Notifications
You must be signed in to change notification settings - Fork 462
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
Use Typhoeus instead plain Net::HTTP #185
Comments
We're releasing a version of the library soon that will allow for pluggable HTTP clients. |
👍 |
@mikhailov I'm using typhoeus through this monkey patch until the new version of the gem is released: https://gist.github.com/viktornonov/487e0d56ea6ad8873f54 Hopefully it will help you. |
@viktornonov it definitely helps! is that correct to say, your patch overwrites post method from twilio-ruby/lib/twilio-ruby/rest/base_client.rb Lines 44 to 56 in c4ffe31
According to Ruby API docs:
I assume Typhoeus with its FFI C performance makes a significant differene, is there any chance to measure and provide results here please? |
@mikhailov Yes, it overrides the Post method of the twilio-ruby/lib/twilio-ruby/rest/base_client.rb Lines 44 to 56 in c4ffe31
I had the problem with a segfault when I send multiple sms messages through a sidekiq worker and this override fixes it. The issue is related to Ruby's Net::HTTP module and openssl and to that Net::HTTP is not thread safe. You can see more details about the problem in #93. It will be interesting to check the performance change, I can check this and post the results here. What do you think is the best thing that I can use to measure the performance - the Ruby's Benchmark module? |
@viktornonov for performance testing is only rule - it shouldn't be Apache Bench, a good option is siege. Ruby stdlib benchmark can be good as well, but can you perform true parallel testing with Ruby benchmark class? |
If you upgrade to the @client.http_client.adapter = :typhoeus See the upgrade wiki for more details! |
Guys, would you consider to switch to advanced HTTP client like Typhoeus or similar? Advantages are simple: use keepalive, nice DSL to handle timeouts, retries, concurrent requests.
The text was updated successfully, but these errors were encountered: