LVE protects the host’s CPU and memory from a runaway PHP tenant, but it does nothing for MySQL — which runs as a single daemon outside the LVE cages. One tenant’s missing index can pin the MySQL CPU and slow every other tenant on the box. CloudLinux MySQL Governor is the missing piece: it tracks per-account database usage and throttles queries when one tenant exceeds its allowance. We turn it on by default on every multi-tenant cPanel host.
What’s happening
MySQL Governor identifies each query by the connecting cPanel user (via the MySQL user → cPanel user mapping), aggregates resource use, and applies four limits: CPU%, read IO, write IO, and concurrent connections. When a tenant exceeds the limit, Governor either slows new query acceptance or kills the offending query, depending on policy. Critically, it logs which user and which query — so the support response is not “MySQL is slow”, it is “user xyz ran this query 400 times in 10 minutes”.
It works alongside LVE, not as a replacement. PHP-side throttling stops the application; Governor stops the database side. Both are needed on a real shared host.
How to verify
Check that Governor is installed and active:
dbgovernor-stats
service db_governor status
cat /etc/container/mysql-governor.xml | head -20
To see who is currently using the most database resources:
dbtop -m
dbgovernor-stats --period=1h --user=top10
For a postmortem on a past incident:
dbgovernor-stats --period=24h --by=cpu
dbgovernor-stats --period=24h --user=<username> --queries
The --queries flag dumps the actual slow queries that hit limits. This is what you send to the customer when explaining throttling.
The fix
- Install Governor through CloudLinux’s installer:
/usr/share/cloudlinux/governor/install_db_governor.sh. It modifies MySQL/MariaDB configuration to use the modifiedmysqlbinary that integrates with the LVE accounting. - Set sane default limits in
/etc/container/mysql-governor.xml. Reasonable starting points: 30% CPU, 10 MB/s read+write, 5 concurrent connections per user. Tune up for accounts that need it. - Enable per-account override through the cPanel package settings, so packaging tiers map to DB limits the same way they map to LVE limits.
- When a tenant hits limits repeatedly, the next move is the slow query log — not raising the limit.
mysqldumpslowand the EXPLAIN plan usually find a missing index in minutes.
The biggest behavioral change: a customer with a slow query no longer slows every other customer. They throttle themselves, and the support evidence is generated automatically. Stack Harbor turns on Governor as part of cPanel/WHM management.