-
Notifications
You must be signed in to change notification settings - Fork 576
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
Separate keep-alive and inactivity timeouts for all built-in web servers #1493
Conversation
Calling for a vote @mojolicious/core. |
Instead of adding a new API, i've just reused |
I don't mind updating my reactor backends to support this, but what's the practical impact if someone updates Mojolicious without updating the reactor backend they're using? |
…rs for more user friendly configuration
Actually, i've amended the PR with the |
@Grinnz Since i've never used an alternative reactor backend i have no idea. Timeout reassignment will probably just not do anything. |
I'm voting 👍 |
To be clear, this is actually an important feature that i strongly believe should be added. It addresses fairly common problems with the current inactivity timeout. To give one example i ran into at work. There we had a micro service running in prefork mode with 12 workers. Because the service could run fairly long SQL queries we had to limit concurrency (one request per worker) and increase the inactivity timeout a bit. So the service could run 12 requests at a time. Now unexpectedly we suddenly had more than 12 clients, and clients were configured to use keep-alive. And boom, everything broke because idle keep-alive connections blocked all the workers. There are many more such scenarios. With this feature i could simply increase the inactivity timeout to say 300 (for very very slow SQL queries) and set the keep-alive timeout to 5. Letting idle connections get closed very quickly if there are not multiple requests in quick succession. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the example.
I'm 👍 on this change. I don't think most users have custom reactors, so I'm not concerned about Grinnz' comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change timeouts for keepalive connections for those who have increased inactivity timeouts, but this shouldn't actually affect anything other than possibly causing more reconnections to be necessary. As best as I can tell with a third party reactor that does not yet support it, it will simply fail to adjust the timeout to the keep-alive timeout when the connection becomes inactive. Since it is a very useful feature to have these separate timeouts I am voting in favor. 👍
I missed the vote with a busy weekend but I'll still hop in here with a 👍 |
This patch is preparation for #1492. It adds a low level way to reset timers, which is much more efficient than completely replacing timers every time you want to change a setting like the
inactivity_timeout
.Baseline, this is pretty much equal with and without patch (EV):
With patch applied (EV):
Without patch applied (EV):
With patch applied (Poll):
Without patch applied (Poll):