Multiple long running mysqld processes

today i've checked our server status with htop and i saw somethig that i could not believe.

Could someone please answer me the following questions?

  1. Why are there so much mysqld processes?
  2. Why they are running for so long?

On this server we have a plesk system with 3 PHP Symfony Projects running. Only 1 project has load.

The server has 12 cores and 126GB of RAM (it's dedicated)

htop


That's normal.

You might have max_connections = 151, which is the default in some versions. That means that up to 151 threads/processes may be running for MySQL. They are probably just sitting there, not doing anything, waiting to wake up when some action is needed.

That setting can be decreased, but there is no urgency unless you are running out of RAM. But I serious doubt that, since you have a very large 128GB.

The "time" on each process refers to how long ago it was started. Also something not to be concerned about.

Some OSs will show only one line for mysqld, some show one line per thread/process. This difference is not a problem.

htop has a Load average with 3 numbers after it? (Just like top.) What values are there? "1" or "2" is probably a reasonably idle system. "12" or more could indicate that some queries are CPU-bound.

MySQL's "slowlog" is useful, in my opinion, for tracking down naughty queries.