Website gradually slows down over hours of uptime

SYSTEM INFORMATION
OS type and version Ubuntu 22.04 LTS (64-bit)
Webmin version Webmin 2.021
Virtualmin version Virtualmin GPL 7.10
Webserver version Apache 2.4.52
Related packages PHP 8.2, PHP-FPM, MariaDB 10.6, Postfix, Dovecot, BIND, ProFTPD

Hello Virtualmin Community,

I am currently experiencing one persistent performance problem with my website hosted on a Virtualmin-managed server, and I am hoping someone can help me identify what is causing it. The website works normally immediately after the server and web services are started, with pages loading quickly and requests completing within the expected amount of time. However, after the server has been running for several hours, the website gradually becomes slower until some requests take a very long time to complete or appear to hang completely. The important point is that I am trying to troubleshoot one specific issue: the website progressively loses responsiveness during extended uptime. Restarting the affected virtual server or restarting the relevant services temporarily restores normal performance, but after the system runs for another period of time, the same slowdown eventually returns. There is no major increase in website traffic when the problem occurs, so I am trying to understand what resource or process may be accumulating over time and causing the website to become progressively less responsive.

I have been monitoring the server while the slowdown develops and have noticed that the problem is not an immediate resource exhaustion event. The server remains online, Virtualmin remains accessible, and I can still connect to the machine through SSH, but requests to the affected website become noticeably slower. The website is a PHP-based application using a database, and normal pages that respond quickly after a fresh restart can take several seconds or sometimes much longer once the degradation begins. I have checked the basic CPU and memory usage and have not seen an obvious situation where the machine is simply running out of RAM or CPU. This makes the issue particularly confusing because the system appears healthy from a general resource perspective while the website itself becomes increasingly slow. I have also noticed that restarting the web service temporarily brings response times back to normal, which makes me suspect that something associated with the long-running webserver or PHP environment may be accumulating, but I have not yet been able to identify the exact resource responsible.

I have already checked the website configuration and confirmed that the application itself does not intentionally perform any operation that should progressively slow down after several hours. The database is accessible and continues responding, and the same website code works normally after the affected services are restarted. I have also reviewed the webserver error logs around the time the slowdown occurs, but I have not found a single obvious fatal error that explains the behaviour. Some requests continue to complete successfully while others become extremely slow, so the website does not completely stop responding. I am particularly interested in determining whether Virtualmin users commonly encounter this type of gradual degradation because of PHP-FPM worker processes, Apache workers, connection limits, file descriptors, process limits, or another server-side resource that may remain occupied longer than expected. I would prefer to identify the actual cause through monitoring and logs rather than simply increasing resource limits or repeatedly restarting services.

The problem is also difficult to reproduce in a controlled development environment because it appears to depend on the website remaining active for an extended period. Immediately after restarting the relevant services, I can test the same pages repeatedly and receive normal response times. As uptime increases, however, the response times gradually become less consistent. I have started recording timestamps and response durations so I can compare the healthy state with the degraded state, and I am trying to collect information before performing another restart. I would like to know which Virtualmin, Webmin, Apache, PHP, and operating-system statistics would be most useful for identifying what changes between these two states. In particular, I am wondering whether there is a recommended way within Virtualmin to determine whether a virtual server has too many active processes, whether PHP workers are becoming stuck, or whether some other per-virtual-server limit is being reached even though the overall server still appears to have sufficient resources.

I have avoided making several configuration changes at once because I want to isolate the actual cause of the problem. At the moment, I am mainly looking for a systematic troubleshooting approach that will allow me to capture useful information while the website is slow and compare it with the same information immediately after the service has been restarted. The fact that a restart temporarily resolves the issue makes me think that information available before the restart could be particularly valuable, but I am not sure which commands, Virtualmin pages, logs, or process statistics I should collect. I would also like to know whether there are specific Virtualmin settings related to PHP execution, Apache process management, resource limits, or virtual-server configuration that should be checked when a single website becomes progressively slower during long uptime. I do not want to assume that the problem is caused by Virtualmin itself, but because the website is managed through Virtualmin, I would appreciate advice on the most appropriate way to investigate it within this environment.

I would appreciate guidance from the Virtualmin community on how to diagnose this gradual website performance degradation properly and determine what is causing the slowdown. Specifically, I would like recommendations for checking Apache worker status, PHP-FPM processes if applicable, database connection usage, open file descriptors, memory growth, process counts, server limits, and relevant Virtualmin/Webmin logs while the problem is actively occurring. I would also like to know whether there are particular Virtualmin tools or commands that can help identify a virtual server that is consuming resources progressively over time. My goal is to fix the underlying cause so that the website remains responsive during long periods of continuous operation rather than relying on periodic service restarts as a temporary workaround. Any advice on what information I should collect and which areas of the Virtualmin configuration I should investigate first would be greatly appreciated.

Hello,

Before anyone can point you in the right direction, could you share, how much RAM the server has and how many domains it hosts?

What the site actually is, like WordPress or a custom app? Your PHP version and whether it runs as FPM or (f)CGI, and whether you’ve changed any Apache or PHP defaults?

Also paste the output of free -h and ps aux --sort=-%mem | head taken while the site is slow.

Restart-fixes-it usually points to something filling up, but with default configs on a small-RAM box it could be as simple as too many PHP workers for the memory available.

Don’t look for general advice to a specific problem.

You need to look at what is actually consuming resources. There isn’t a general “everything gets slow” bug in anything in the stack. So, something in your applications is consuming an unusual amount of resources, or you don’t have sufficient resources for what you’re doing. You’ll only know what by looking.

See which user is consuming the most CPU. That narrows down the application. See if it’s Mariadb or PHP-FPM that’s consuming the most CPU. That may narrow it down to a slow database query or a poorly programmed application (or insufficient resources for the load).

Could be a DDoS. Check the logs for a lot of weird connections.

You won’t know without looking for specific issues. Read logs, check top, etc.

Thanks, that makes sense. I was probably focusing too much on finding a general Virtualmin or webserver issue instead of collecting evidence while the slowdown is actually happening. I’ll monitor the server in both the healthy and degraded states and compare which processes are consuming CPU and memory, particularly PHP-FPM, MariaDB, and the webserver processes.

I’ll also check the relevant logs around the exact timestamps when response times increase and look for unusual connection patterns that could indicate excessive requests or a possible attack. I’ll use tools like top or similar process monitoring to identify which user or service is actually consuming resources rather than making configuration changes blindly.

The suggestion to narrow it down by identifying whether PHP-FPM, MariaDB, or a particular user is responsible is especially useful. I’ll collect that information before restarting anything so the evidence isn’t lost, then compare it with the server immediately after the restart. Hopefully that will point to the actual application, query, process, or resource limit causing the gradual slowdown. Thanks for steering me toward a more evidence-based approach.