Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL processes and connections

I'm using phpmyadmin built-in monitor tools to evaluate the usage of my MySQL db. This graphed has raised my attention:

enter image description here

I assume the blue means connections, and the orange processes.

I'm trying to get a deep understanding of what this graph actually means, and act accordingly.

If I understand correctly, it seems as if I'm creating multiple connections per script (process). What situations can cause such a behavior (in addition to simply calling mysql_connect more than once), and how much does this effect performance?

like image 668
Noam Avatar asked Jul 08 '13 15:07

Noam


People also ask

What are connections in MySQL?

The MySQL Clients send connection requests to the MySQL Server. A connection request is simply a TCP-IP connect message sent to port 3306 on the server host machine. Receiver Thread. Incoming connection requests are queued and then processed by the receiver thread one by one.

What is a MySQL process?

The MySQL process list indicates the operations currently being performed by the set of threads executing within the server. The SHOW PROCESSLIST statement is one source of process information. For a comparison of this statement with other sources, see Sources of Process Information.

How can I see what processes are running in MySQL?

Type in MYSQL to get into the mysql command line. Type show processlist; in order to see current processes on the server.

Where can I find MySQL connection details?

mysql> SELECT CURRENT_USER(); Here is the output that displays the name of the current user. In the above, % tells us about localhost. mysql> SELECT CONNECTION_ID();


1 Answers

The blue line shows recently opened connections (i.e. opened since the last sample), while the orange one shows currently opened connections (at the time of sampling). The latter are processes in MySQL (the ones that show when you issue a SHOW PROCESSLIST command to MySQL -- it really means active connections)

This means that most connections stay opened for less than your sampling period. This is a good thing.

I am unable to find official documention for this feature.

like image 182
RandomSeed Avatar answered Sep 29 '22 04:09

RandomSeed