Missing information about ASP.NET Core worker process recycling requirements and setup options on GNU/Linux servers #42897
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Docs
This issue tracks updating documentation
net8_docathon
This issue is part of the documentation push in Fall 2023.
Milestone
As many developers and web server administrators know, IIS has a built-in feature for application pool recycling. Here is a refresher for those who might have forgotten about this.
When planning to deploy my ASP.NET Core web apps on Linux servers, I was worried about this mechanism on Linux. I already have one customer complaining that Kestrel process on their server seems to be consuming more and more memory, leading to swapping, while there seem to be no such issues on IIS since the web app gets recycled preemptively.
When setting my ASP.NET Core app on Linux, I followed this article:
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-6.0
It describes the recommended Kestrel recovery mechanism using
Restart=always
andRestartSec=10
, which is great. However, it has no mention of recycling requirements and does not provide "the officially recommended setup", or at least some reasonable starting point to achieve something similar to IIS pool recycling.I also could not find any information on the internet regarding this. I don't think that Kestrel on Linux is "magical" and can keep the same process alive for ages without accumulating any "debris" that would benefit from preemptive recycling, so I assume we need something similar to IIS app pool recycling. Correct me if I'm wrong here and Kestrel can and should be left alone running for months without recycling and fears of memory debris.
It would be great for someone experienced to look into this and improve that article or write a new article to clear people's doubts regarding worker process recycle management, so that we have more confidence recommending ASP.NET Core web apps for customers who want to host on Linux servers.
Is it at all possible to achieve similar zero-downtime background recycle on Linux with Nginx and Kestrel the same way as it works on IIS? Is it necessary at all? I wouldn't want to reinvent a wheel here, so it would be great to have something time-tested and officially recommended, following best practices and playing nicely with general Kestrel lifecycle mechanics, which we, mere mortal developers, might not know enough to be able to build a reliable solution from scratch.
The text was updated successfully, but these errors were encountered: