Answer the question
In order to leave comments, you need to log in
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);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question