O
O
olegxxxl2021-06-09 11:20:41
MySQL
olegxxxl, 2021-06-09 11:20:41

How to unload mysql server and debug queries?

There is a site written in Laravel, the database is placed separately on a different server. Server 24 core, that
is, not the weakest server and everything was fine, up to a certain point. Approximately
1-2 weeks ago, every other day, and sometimes every day, the processes on the server are clogged almost by 100%

, that is, from 70 to 100% of individual cores. When I began to look at what was loading through htop, I saw that there was
a huge number of mysqld processes.

crkIufA3w07yw72cFz9uGjZM7qypV17UCUdcd5mg.png

The question is, how can you log which requests flies the most, in order to understand and optimize in the future?
Is it possible to do this separately on the server with the base or do I need to change something on the back?

It happens at about the same time from 18 to 19 pm, during rush hour.
Perhaps someone has come across and knows how to fix it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2021-06-09
@New_Horizons

Probably the easiest way to start is to enable the query log at the database level.
Another option is to do \DB::listen() in Laravel and analyze which queries leave.

V
Vladimir, 2021-06-09
@MechanID

Go to mysql console and execute
SHOW FULL PROCESSLIST;
so you will see the currently running queries, then you can already study them using EXPLAIN

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question