-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
In Async environment, why http.get is too slow? #357
Comments
This result looks unusual so I’ll need to investigate it. |
Does the issue still show up on 3.3.6? |
Yes, it does. I tried on 3.3.6 and the result is same as below:
|
Okay, I'm taking a look now. |
Oddly enough, this works quite okay for me:
Can you tell me the performance of the following: require 'benchmark'
require 'resolv'
Benchmark.measure{pp Resolv.getaddresses("www.google.co.jp")} |
ok. this is the result. (
It also takes 10 sec... (´・ω・`) |
Sorry for the slow response, I had a lot of things to sort out. So, what it looks like is something odd with the DNS on your computer being extremely slow, or Ruby's resolver being extremely slow. Are you able to tell me what is in your |
Thank you for your response.
Now I added 8.8.8.8 by System Settings.app and did Current
|
Is |
How long does:
take? |
Oh! i deleted IPv6 one, it become fine!!!
(10 sec.) I deleted IPv6 DNS and sorted:
Thank you very much, ioquatix-san. I deeply apologize for causing you any trouble. |
The reason is probably the resolver implementation is different. Async currently uses Ruby's pure ruby
Total time = 10s + a little. Ruby itself (without async) uses the OS provided resolver, which may do this:
Total time = a little. We should probably fix Async to handle this case better. So the reason why |
Also, it was no trouble and I'm glad the problem is fixed. There is definitely something we can improve in Async by improving the resolver. |
Hi, ioquatix.
Thank you for your great async-related gems. And I would like to ask a question here.
Running the code followings:
We get:
Why test 2 is too slow (x50 slower than test 1)...?
(test 3 is my work around for Async, but i cannot understand why the performance is improved. 🧐)
My environments are:
$ uname -a
Darwin clt-m1.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103 arm64
$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22]
$ gem list|grep async
async (2.17.0, 2.12.1)
$ gem list|grep net-http
net-http (default: 0.4.0)
The text was updated successfully, but these errors were encountered: