high CPU usage of MySQL and recommendation from Mysqltunner

http://mysql.rjweb.org/doc.php/mysql_analysis

That has two parts -- one is a deeper dive into the settings on your machine. The other is capturing the slowlog.

High CPU almost always means poor indexing and/or poor formulation of queries. The slowlog is a very efficient way to find the "worst" queries. Then we can discuss how to improve them.

Tuner...

  • The number of instances is not worth changing.
  • 7G for the buffer_pool is too big for a 7.8G machine. Limit it to about 70% of RAM; let's say 5G.
  • Was MySQL swapping? That is terrible for performance (but won't show up as high CPU).