How to do it...

  1. Set the CAP_SYS_NICE capability to mysqld:
shell> ps aux | grep mysqld | grep -v grepmysql     5238  0.0 28.1 1253368 488472 ?      Sl   Nov19   4:04 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidshell> sudo setcap cap_sys_nice+ep /usr/sbin/mysqldshell> getcap /usr/sbin/mysqld/usr/sbin/mysqld = cap_sys_nice+ep
  1. Create a resource group using the CREATE RESOURCE GROUP statement. You have to mention the resource group name, number of VCPUS, thread priority, and type, which can be either USER or SYSTEM. If you do not specify the VCPU, all the CPUs will be used:
mysql> CREATE RESOURCE GROUP report_groupTYPE = USERVCPU = 2-3THREAD_PRIORITY = 15ENABLE;# You should have at least 4 CPUs for the above resource group to create. ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.