-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Is there something like IIS recycling periodically for Kestrel server on Linux? #40147
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
Comments
If you need to periodically restart Kestrel, you'd need to use an orchestrator to do it; there's no built-in support for that type of thing in Kestrel. Similarly, while you could write some code that would shut down the server when it's idle, you'd need something external to start it again when a request comes in. |
Do you know any such orchestrator by any chance? |
Systemd on Linux with socket activation |
Thank you @davidfowl. Do you know by any chance, does ASP.NET supports it? I had mixed results when searched internet. Thank you, |
Yes. https://www.nuget.org/packages/Microsoft.Extensions.Hosting.Systemd/ and UseSystemd to enable socket activation for Kesterl.
I have no idea. That's a systemd questions.
It should, the system is designed with graceful shutdown in mind but I don't know how systemd handles the creation of a new process after draining the existing one. |
This looks like a good article https://kimsereylam.com/dotnetcore/csharp/ubuntu/2018/05/25/manage-kestrel-process-with-systemd.html |
Three's also PM2 https://pm2.keymetrics.io/ (it says node js but it's a generic process monitor) |
Thank up @davidfowl. It looks like systemd with socket activation is all I need. I still need to do some testing but it looks promising from documentation. Once I get results I will post them here. |
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes. See our Issue Management Policies for more information. |
I re-read all documentation of how to host ASP.NET website on Linux and in all cases it is Apache or nginx that just forwards traffic to Kestrel server that is running as service.
But is there any way to recycle ASP.NET periodically on Linux? Or shutdown web suite when it is idle and start on first request?
I can restart service by timer, but it will affect requests it is processing and for some time (few seconds) new requests will not be processed.
Thank you,
Vlad
The text was updated successfully, but these errors were encountered: