Conserving Server Resources With MySQL Governor

Jul 30, 2020 2:30:00 PM / by Alexander Vinogradov




For companies that provide shared hosting, MySQL is often a source of headaches, especially when it comes to customers who use too many server resources. Some customers use MySQL so heavily that it threatens the stability of that application and even the server itself. 

MySQL Governor is a tool included in CloudLinux OS that helps resolve and prevent these issues. With the latest versions of MySQL and MariaDB, it enables sysadmins to identify abusers and throttle their database usage in real time. 

With MySQL Governor, users’ sites are monitored through resource usage statistics on each MySQL thread. It can work in monitor-only mode, or employ different throttling scenarios based on these limits:




CPU speed relative to one core. 150% means one and a half cores



Bytes read. Cached reads are not counted, only those that were actually read from disk will be counted



Bytes written. Cached writes are not counted, only once data is written to disk, it is counted


Different limits can be set for different periods: current (1 second), short (5 seconds), medium (1 minute), and long (5 minutes). These are the defaults, but these periods can be redefined using MySQL Governor’s configuration file

In throttling customers’ MySQL usage, the idea is to use larger acceptable values for shorter periods. For example, a customer could be allowed to use two cores (200%) for one second, but only 1 core (on average) for 1 minute, and only 70% within 5 minutes. These settings would  ensure that the customer’s site could burst for only short periods of time.

When a customer’s MySQL usage is restricted, the customer’s site is placed in a special LVE with ID 3. All restricted customers are placed in that LVE, where the resources available to them can be controlled. Restricted customers can be limited to only 30 concurrent MySQL connections, and slow SELECT queries can be killed off. 

MySQL Governor currently supports these versions of MySQL: 

    • MySQL v5.1
    • MySQL v5.5
    • MySQL v5.6
    • MySQL v5.7
    • MySQL v8.0
      Requires MySQL Governor 1.2-37+. Database packages are available in beta only, so use --install-beta flag instead of --install.


It also supports these versions of MariaDB: 

    • MariaDB v5.5
    • MariaDB v10.0
    • MariaDB v10.1
    • MariaDB v 10.2
    • MariaDB v 10.3
      Requires MySQL Governor 1.2-36+. For cPanel, MySQL Governor 1.2-41+. 
    • MariaDB v 10.4
      Requires MySQL Governor 1.2-53+. Database packages are available in Beta only, so use --install-beta flag instead of --install.
    • Percona Server v 5.6


Topics: mysql-governor, MySQL, Technical Blog, MariaDB, Marketing Blog

Alexander Vinogradov

Written by Alexander Vinogradov

CloudLinux OS Product Manager

    Subscribe to Email Updates

    Lists by Topic

    see all

    Posts by Topic

    See all

    Recent Posts