A
A
Andrzej Wielski2016-01-11 17:29:51
MySQL
Andrzej Wielski, 2016-01-11 17:29:51

What is the formula for calculating the load on the database?

Hello.
The goal is to display the total load on the database in the control panel .
Ideally, of course, I would also like to have the average number of requests to the database per second, the maximum number of requests, etc., but I did not find information on these data.
At the moment, I formed approximately the following formula:

$mysqlQueries = (int)DB::select('SHOW STATUS like \'Queries\'')[0]->Value;
$mysqlConnections = (int)DB::select('SHOW STATUS like \'Connections\'')[0]->Value;
$mysqlLoad = round((time() - strtotime('today')) / ($mysqlQueries / $mysqlConnections) / 100, 2);

Time in seconds since the start of the day divided by (total number of requests / total number of connections).
To bring it into a more or less understandable human form - rounding, and dividing by 100 (the figure turns out to be very large) .
How correct is the data when calculating using such a formula, and is there a better option for calculating?
Also interested in the above (average number of requests per second and the maximum number of requests).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-01-11
@Nc_Soft

It's all here.
You can just connect zabbix, it will show it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question