I’m developing a Laravel website which is to be deployed to Windows Server 2019 (IIS) running SQL Server, hosted on a VPS with Plesk.
I recently deployed the site to a password-protected testing subdomain on the server to make sure everything works and see how speeds are when mimicking a production environment on the actual server. Generally, speeds are perfectly satisfactory: full-page response times are around 200–800ms.
However, if I haven’t visited the site for a while (don’t know exactly how long – an hour will certainly do it), then the first request I make to the test site is very slow, usually 10+ seconds, sometimes 30+ seconds. Any subsequent requests are very fast and responsive, even from a different device on a different network, so it’s not a client issue.
On a different domain, the server also hosts a live production site primarily written in Classic ASP (VBScript), but also with some parts in plain (non-framework) PHP, which is not affected by this issue. All requests to the live site load at similar speeds, with no slowdown on first requests. There is a different password-protected testing subdomain which hosts a copy of the live site, and this is also not affected. When running from my dev machine (a Mac), I use the live database on the server, and there’s also no delay for first requests there, so it’s not a database issue.
I have made sure to set the application pool’s start mode to alwaysRunning
to at least rule out that firing up a new worker process is the culprit. The server is quite low-traffic, so the answer to this question doesn’t apply.
The issue is overall very similar to this question, except that mine isn’t a .NET application so neither of the two answers given there applies. I’ve seen people mention caching as well, but always in relation to the caching of just-in-time compilations of ASP/.NET apps, which wouldn’t be relevant to a PHP app either.
I would really like to try to figure out exactly what is taking such a ridiculously long time on this one subdomain/application (and, obviously, fix it), but I have no idea how.
So basically my question is two-fold:
Is there a way in IIS to ‘clock’ requests and find out where in the request process the bottleneck is?
If not, what are some likely factors I should be looking at for things that might cause this type of first-request delay?
Please let me know if I’ve left out some vital server details. I’m not a professional server admin, and I only just barely know my way around Windows Server to begin with.