views:

394

answers:

5

How to measure current load of MySQL server? I know I can measure different things like CPU usage, RAM usage, disk IO etc but is there a generic load measure for example the server is at 40% load etc?

A: 
mysql> SHOW GLOBAL STATUS;

Found here.

Andrew Sledge
I believe the OP wants a single load measure rather that the fine grain detail provided by the status query.
whatnick
This requirement was not explicitly requested.
Andrew Sledge
A: 

On linux based systems the standard check is usually uptime, a load index is returned according to metrics described here.

whatnick
+1  A: 

The notion of "40% load" is not really well-defined. Your particular application may react differently to constraints on different resources. Applications will typically be bound by one of three factors: available (physical) memory, available CPU time, and disk IO.

On Linux (or possibly other *NIX) systems, you can get a snapshot of these with vmstat, or iostat (which provides more detail on disk IO).

However, to connect these to "40% load", you need to understand your database's performance characteristics under typical load. The best way to do this is to test with typical queries under varying amounts of load, until you observe response times increasing dramatically (this will mean you've hit a bottleneck in memory, CPU, or disk). This load should be considered your critical level, which you do not want to exceed.

dcrosta
+1  A: 

with top or htop you can follow the usage in Linux realtime

A: 

aside from all the good answers on this page (SHOW GLOBAL STATUS, VMSTAT, TOP...) there is also a very simple to use tool written by Jeremy Zawodny, it is perfect for non-admin users. It is called "mytop". more info @ http://jeremy.zawodny.com/mysql/mytop/

Mohammad