Symfony, performance, and High CPU usage


Server is slowing down, and noticing that your Symfony project is consuming enormous amount of CPU? Try this tweak:

# factories.yml
all:
  routing:
    class: sfPatternRouting
    param:
      cache: null

What it does: This config disables the Symfony Routing Cache, which uses PHP serialize/unserialize functions, and can cause lots of CPU processing.

In my case, a high server load of ~8 went under 1 with this simple tweak (on a dual core). Easy change, but hard to find in the docs.

This was the one most important tweak that reduced my server load, but there are a few others, including:

Happy tweaking!