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:
- A variation of the above tweak, by enabling lazy_routes_deserialize in factories.yml (doc)
- Disable check_lock in settings.yml (doc)
- Disable the Symfony compressor (doc)
Happy tweaking!