PHP 7.3 FPM slow first load (after some idle time)

Hi, I’ve made the move from the default PHP 7.0 to PHP 7.3 FPM, now I have one problem I can’t pinpoint:

first page load of non cached PHP pages (WordPress in my case) happens 7-10x slower compared to “fully awaken” web site.

I’m not sure whether the problem is with mysql caching (the mysql-slow.log is empty) or FPM putting inactive processes to sleep (there are some backtraces in FPM’s slow.log).

It only affects the first user of the site who comes after some period of site inactivity, but since most of the sites are pretty slow in traffic right now, it just looks bad for most of them.

I would appreciate any ideas of where to investigate further.

I’m guessing, but I would maybe suspect memory contention. Stuff is getting swapped out, and swapping it back in takes time. If you’re running mail service (especially ClamAV), you need a ton of RAM or you’ll have performance problems.

I’m not sure why switching to 7.3 from 7.0 would trigger the problem, though. It seems unlikely to need significantly more memory (unless you’ve got some sites running under 7.0 and some under 7.3, so they can’t make use of shared memory as effectively).

My host has 8GB RAM and I’m monitoring the server, I’ve never seen the RAM usage go over 50%.
I do run ClamAV, but no mail service.

.

OK, that shouldn’t be an issue, then. I’m not sure what else would trigger a really slow first load like that.

Another guess: Maybe it’s not PHP that’s slow to load and actually some name being queried that’s slow or timing out on the page? Open it up in a developer console in your browser and check the network load times for all the elements on the page. (I don’t have a strong feeling this is the case, but DNS is often the culprit when something looks slow.)