MariaDB thread and Connection
Today, we will introduce how to check the number of links and threads of mariaDB (the same as MySQL. What is the difference between MariaDB and MySQL.
This is an entry to reduce database load and improve database operation efficiency.
Connect to mariaDB
# mysql -uroot -pEnter password:Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 1176Server version: 5.5.41-MariaDB-log MariaDB ServerCopyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]>
Max connections
MariaDB [(none)]> show global variables like 'max_connections';+-----------------+-------+| Variable_name | Value |+-----------------+-------+| max_connections | 151 |+-----------------+-------+1 row in set (0.00 sec)
Cumulative number of connections after MariaDB is started
MariaDB [(none)]> show global status like 'Connections';+---------------+-------+| Variable_name | Value |+---------------+-------+| Connections | 1190 |+---------------+-------+1 row in set (0.00 sec)
Maximum number of concurrent connections after mariaDB is started
MariaDB [(none)]> show global status like 'Max_used_connections';+----------------------+-------+| Variable_name | Value |+----------------------+-------+| Max_used_connections | 7 |+----------------------+-------+1 row in set (0.00 sec)
MariaDB thread Information
MariaDB [(none)]> show global status like 'Thread_%';+-------------------------+-------+| Variable_name | Value |+-------------------------+-------+| Threadpool_idle_threads | 0 || Threadpool_threads | 0 || Threads_cached | 6 || Threads_connected | 1 || Threads_created | 7 || Threads_running | 1 |+-------------------------+-------+6 rows in set (0.01 sec)
- Threads_cached: Number of standby threads (threads can be reused)
- Threads_connected: current number of connections
- Threads_created: When the standby thread is insufficient, a new thread will be generated (when this value increases continuously, it indicates that Threads_cached is insufficient)
- Threads_running: the thread in progress. It can be said that the thread is not in Sleep state.
Threads_cached + Threads_connected <thread_cache_size is ideal.
MariaDB [(none)]> show global variables like ‘thread_cache_size’;+——————-+——-+| Variable_name | Value |+——————-+——-+| thread_cache_size | 52 |+——————-+——-+1 row in set (0.00 sec)
Summary
As you can see above, the commands used on MySQL can also be used in MariaDB.
The most important thing is that the MySQL logic and MariaDB logic are different. We can see that different may require more in-depth use of MariaDB.
Linux Tutorial: How to check the MariaDB server version
Implementation of MariaDB Proxy read/write splitting
How to compile and install the MariaDB database in Linux
Install MariaDB database using yum in CentOS
Install MariaDB and MySQL
How to migrate MySQL 5.5 database to MariaDB 10 on Ubuntu
Install MariaDB on the Ubuntu 14.04 (Trusty) Server