-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 proper timers in sleepAsync. #8209
Conversation
df22afb
to
29bf869
Compare
Unfortunately that means async timers consume a file handle. This means for an HTTP connection you use 2 FDs where previously only 1 was required. |
Yes, but this is a worthy trade-off. |
This may be only useful for user-implemented runloops. Otherwise it's extremely harmful, and a showstopper for high load servers. EDIT: Not high load servers, but the code making heavy use of |
I'd suggest making this a default (but configurable) option of the dispatcher. |
For servers where this is a bottleneck I think that the developers would be better off implementing their own timing functionality. This change removes a lot of relatively complex code and I would prefer to simply remove it rather than keep it as an option. |
"implementing their own" mindset doesn't play well with code reuse. E.g. I've implemented my own timers. Now I can't use third-party libs using |
Can you give a real-world example where these pseudo-timers would be necessary and the new timers would be a big problem? |
@dom96 please add timer support to your httpbeast library and measure both the old timers and your patch. |
@Araq The only thing I would use timers for in httpbeast is to refresh the current server time (sadly, the HTTP spec mandates that it is sent with each request...). I'm already using the OS timers for that. I can change it to use sleepAsync pre-this-PR if that's what you mean? |
Huh? Every HTTP connection can time-out. Don't you need timers for that? |
Nope. Although I suppose I should add those, ugh. |
Let's say there's a high load HTTP server that proxies a request to another server (not necessarily HTTP), and has to return a timeout error page in case of timeout. Likely it will use |
I'm surprised this wasn't done before. This should fix all problems associated with
sleepAsync
and high CPU usage.