PHP's CPU usage dropped nearly 40% after upgrading to Ubuntu 22.04

This post was originally published on the Oh Dear blog on 28 February 2024. I moved it to my own blog in October 2026.

Over these past few weeks, we’ve updated the Oh Dear uptime servers from Ubuntu 20.04 LTS to Ubuntu 22.04 LTS . The reason was mostly just staying up-to-date, but we had a surprising side-effect that was unexpected but very welcome.

Measuring reduced CPU usage#

An easy riddle: can you guess when we were running on Ubuntu 20.04 and when we were on 22.04? The spikes in the middle were during the upgrades (when this server was taken out of rotation).

CPU utilization graph dropping after the upgrade window from Ubuntu 20.04 PHP 8.2 to Ubuntu 22.04 PHP 8.2

For the exact same workload, here’s how the numbers work out:

  • Avg CPU (user) on Ubuntu 20.04 LTS: 22.9%
  • Avg CPU (user) on Ubuntu 22.04 LTS: 13.2%

That’s a whopping 42% drop in CPU usage, measured before and after the OS upgrade. 🥳

And this wasn’t an isolated server, this was measured across multiple servers, across multiple (independent) cloud providers.

This is a before-and-after measurement, not a controlled experiment. An OS upgrade swaps out a lot more than one thing. Underneath the same PHP 8.2, Ubuntu 22.04 ships a newer kernel (5.15 instead of 5.4), glibc 2.35 instead of 2.31, OpenSSL 3.0 instead of 1.1.1 and libcurl 7.81 instead of 7.68. I didn’t isolate any of those, so I can’t tell you which one made the difference.

Purposefully simple workload#

Our satellite servers are spread worldwide and act as mere proxies for HTTP(s) requests. They are, on purpose, simple by design.

Each server has Nginx & PHP-FPM running, nothing more. It just takes in requests from our dispatcher, processes them by calling out to an external service (aka: our client website to monitor) and then returns the response.

After the upgrade, we observed a significant increase in context switches for each server.

Graph of context switches and interrupts per second jumping from about 1,000 to 1,500 per second after the Ubuntu upgrade

The workload stayed the same, yet the context switches and interrupts went up while the CPU usage went down. Is that jump related to the lower CPU usage, or is it just another side effect of the upgrade? Hard to say. Happy to hear thoughts/theories on this!

Measured across dozens of servers#

Just for dramatic effect, here’s the CPU usage of a few other servers, but without the fixed y-axis scale. Sorry data scientists, I couldn’t resist skewing the scale to our advantage here.

Exhibit 1: a drop from ~16% CPU usage to ~10.3%.

Graph of CPU usage by the forge user falling from about 16% to under 11% after the upgrade

Exhibit 2: a noticeable reduction in the CPU load as well:

CPU load average graph dropping after the switch from Ubuntu 20.04 to Ubuntu 22.04

On average, the CPU load went from 0.7 to 0.4.

Your mileage may vary#

Obviously, our setup isn’t yours. We run pure PHP processes here, no databases/caches/file storage/… It may be a rather exceptional setup, as most environments would at least have some kind of persistence in the form of a database in the mix here.

But, the drop we measured is noticeable!

OS-level wins are one lever. On the app side, I also wrote about sizing and scaling your Laravel queues .

We only noticed this because we graph the CPU usage of every one of these servers. Without those graphs, a 40% drop goes by unseen, and so does a 40% increase.

Ubuntu LTS support in October 2026#

Ubuntu 20.04 LTS left standard support in May 2025. It only gets security updates through Ubuntu Pro’s Expanded Security Maintenance now, until May 2030. Ubuntu 22.04 LTS, the release these servers moved to, leaves standard support in May 2027.

The current LTS releases are 24.04 (standard support until May 2029) and 26.04, released in April 2026 (standard support until May 2031). All of those dates come from Canonical’s Ubuntu release cycle page.

So if you’re still on 20.04 without Ubuntu Pro, you’re running a server that no longer gets security fixes. I wrote up how to upgrade Ubuntu LTS releases , covering every hop from 20.04 to 26.04. Upgrade for the security updates, not for a CPU drop like ours. And graph your CPU usage before and after, so you know what the upgrade did to your workload.