Databases

How To Place MySQL Governor’s Queries Inside Users LVE

In this article, we have covered how to place MySQL Governor’s queries inside users LVE.

Starting from MySQL Governor version 1.0+, it contains two modes of operation that allows running users queries inside their LVE.

The Abusers mode: Once MySQL Governor detects user going over the limits specified in config, all customer’s queries will be executed inside that user’s LVE.

The All mode: The benefits of this approach is that LVE limits are applied to both PHP & MySQL at the same time, all the time, preventing any spikes whatsoever. This way there is no need for separate limits for MySQL. Depending on overhead we see in the future, we might decide to use it as a primary way of operating MySQL Governor. We believe this mode will help with the condition when the site is still fast, but MySQL is slow (restricted) for that user. If someone abuses MySQL, it will cause queries to share LVE with PHP processes, and PHP processes will also be throttled, causing less of new queries being sent to MySQL.

The mode of operation can be specified with dbctl tool, for example:

# dbctl –lve-mode abusers

Abusers is the default mode of operation currently. Both modes require correct dbname <=> username mapping with /etc/container/dbuser-map file. It is automatically generated on cPanel servers (currently that is only one fully supported panel for these modes). The format of the file is:

[dbuser_name1]&nbsp;[account_name1]&nbsp;[UID1] …
[dbuser_nameN]&nbsp;[account_nameN]&nbsp;[UIDN]

The file is being checked for modifications every 5 minutes, if you need to apply changes immediately – just restart db_governor service.

[dbuser_name1] [account_name1] [UID1] …
[dbuser_nameN] [account_nameN] [UIDN]

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles