This article mainly introduces the MySQL performance optimization parameters. I saw the MySQL performance optimization parameters on the relevant website two days ago and thought it was quite good. I will share it with you. I hope that you have mastered this technology and will be of great help in your future studies or work.
Description of MySQL installation parameters in linux
MySQL database server optimization details
Discuss MySQL variables and Optimization
Recommendation circle: D Language
More recommended Java code
MySQL performance optimization parameters 1), back_log:
The number of connections that MySQL can have. When the main MySQL thread receives a lot of connection requests in a very short period of time, this works, and then the main thread takes some time (although very short) to check the connection and start a new thread.
The back_log value indicates how many requests can be stored in the stack within a short time before MySQL temporarily stops answering new requests. Only if you want to have many connections in a short period of time, you need to increase it. In other words, this value is the size of the listener queue for the incoming TCP/IP connection. Your operating system has its own limit on the queue size. Trying to set back_log to be higher than your operating system limit will be invalid.
When you observe the process list of your host and find a large number of 264084 | unauthenticated user | xxx. xxx. xxx. xxx | NULL | Connect | NULL | login | when a NULL process is to be connected, increase the value of back_log. The default value is 50. I will change it to 500.
MySQL performance optimization parameters (2), interactive_timeout:
The number of seconds that the server waits for action on an interactive connection before closing it. An interactive customer is defined as a customer who uses the CLIENT_INTERACTIVE option for MySQL_real_connect. The default value is 28800. I will change it to 7200.
MySQL performance optimization parameters (3), key_buffer_size:
The index block is buffered and shared by all threads. Key_buffer_size is the buffer size used for index blocks. You can increase the size of indexes that can be better processed (for all reads and multi-Rewrite) so that you can afford that much. If you make it too large, the system will begin to change pages and it will really slow down. The default value is 8388600 (8 M). My MySQL host has 2 GB of memory, so I changed it to 402649088 (400 MB ).
MySQL performance optimization parameters (4), max_connections:
Number of customers allowed simultaneously. Increase the number of file descriptors required by MySQLd. This number should be added. Otherwise, you will often see the Too connector connections error. The default value is 100. I will change it to 1024.
MySQL performance optimization parameters (5), record_buffer:
Each thread that performs an ordered scan allocates a buffer of this size to each table it scans. If you perform many sequential scans, you may want to increase the value. The default value is 131072 (128 K). I changed it to 16773120 (16 M)
MySQL performance optimization parameters (6), sort_buffer:
Each thread that needs to be sorted allocates a buffer of this size. Add this value to accelerate the order by or group by operation. The default value is 2097144 (2 M). I changed it to 16777208 (16 M ).
MySQL performance optimization parameters (7) and table_cache:
Number of tables opened for all threads. Adding this value can increase the number of file descriptors required by MySQL. MySQL requires two file descriptors for each unique opened table. The default value is 64. I changed it to 512.
MySQL performance optimization parameters (8), thread_cache_size:
The number of threads that can be reused. If yes, the new thread is obtained from the cache. If there is space when the connection is disconnected, the customer's thread is placed in the cache. If there are many new threads, this variable value can be used to improve performance. By comparing variables in Connections and Threads_created states, you can see the role of this variable. I set it to 80.