MySQL Performance diagnostics and tuning

Source: Internet
Author: User
Tags mysql host mysql in phpmyadmin

[MySQL performance diagnostics and tuning]

LAMP System Performance Tuning, part 3rd: MySQL Server Tuning

Http://www.ibm.com/developerworks/cn/linux/l-tune-lamp-3.html

LoadRunner monitoring MySQL

Http://www.docin.com/p-92272846.html

Advanced MySQL Performance Optimization

http://www.mysqlperformanceblog.com/files/presentations/uc2005-advanced-mysql-

Performance-optimization.pdf

Improving MySQL Server Performance with Intel C + + Compiler

Http://www.mysqlperformanceblog.com/files/presentations/LinuxWorld2005-Intel.pdf

MySQL performance diagnostics and tuning related tools:

http://www.mysqlperformanceblog.com/tools/

Http://hackmysql.com/mysqlreport

Spotlight on MySQL:

http://www.quest.com/spotlight-on-mysql/

Mysql Administator

Http://downloads.mysql.com/archives.php?p=MySQLAdministrationSuite

PhpMyAdmin

http://www.phpmyadmin.net/home_page/index.php

MySQL Slow log analysis tool

http://hackmysql.com/

Http://www.willamowius.de/mysql-tools.html

http://code.google.com/p/mysql-log-filter/

http://myprofi.sourceforge.net/

MySQL Network protocol sniffer tool-Mysqlsniffer

Http://hackmysql.com/mysqlsniffer

MySQL performance diagnostics and tuning related books:

"High performance MySQL Second Edition"

Optimized MySQL 10 parameters for database performance

(1), Max_connections:

The number of simultaneous customers allowed. Increase this value to increase the number of file descriptors required by the mysqld. This number should be increased, otherwise you will often see too many connections error. The default value is 100, I change it to 1024.

(2), Record_buffer:

Each thread that makes a sequential scan allocates a buffer of that size for each table it scans. If you do a lot of sequential scans, you may want to increase the value. The default value is 131072 (128k), I change it to 16773120 (16m)

(3), Key_buffer_size:

The index block is buffered and shared by all threads. Key_buffer_size is the buffer size used for the index block, increasing the index (for all reads and multiple writes) that can be better processed, to the extent that you can afford it. If you make it too big, the system will start to change pages and really become slow. The default value is 8388600 (8m), my MySQL host has 2GB memory, so I changed it to 402649088 (400MB).

4), Back_log:

The number of connections required for MySQL to be available. When the primary MySQL thread gets very many connection requests in a very short time, this works, and then the main thread takes some time (albeit very short) to check the connection and start a new thread.

The Back_log value indicates how many requests can be present in the stack for a short period of time before MySQL temporarily stops answering a new request. Only if you expect to have a lot of connections in a short period of time, you need to increase it, in other words, the size of the listening queue for incoming TCP/IP connections. Your operating system has its own limits on this queue size. Attempting to set a limit of back_log above your operating system will be invalid.

When you look at your host process list, you find a lot of 264084 | Unauthenticated user | xxx.xxx.xxx.xxx | null | Connect | null | Login | Null to connect the process, it is necessary to increase the value of Back_log. The default value is 50, I change it to 500.

(5), Interactive_timeout:

The number of seconds the server waits for an action on an interactive connection before shutting it down. An interactive customer is defined as a customer who uses the client_interactive option for Mysql_real_connect (). The default value is 28800, I change it to 7200.

(6), Sort_buffer:

Each thread that needs to be sorted allocates a buffer of that size. Increase this value to accelerate the order by or group by operation. The default value is 2097144 (2m), and I change it to 16777208 (16m).

(7), Table_cache:

The number of tables opened for all threads. Increasing this value can increase the number of file descriptors required by the mysqld. MySQL requires 2 file descriptors for each unique open table. The default value is 64, I change it to 512.

(8), Thread_cache_size:

The number of threads that can be reused for saving in. If there is, a new thread is obtained from the cache, and if there is space when disconnected, the customer's line is placed in the cache. If there are many new threads, the value of this variable can be increased in order to improve performance. By comparing the variables of the connections and threads_created states, you can see the effect of this variable. I set it to 80.

(9) MySQL search function

Search with MySQL in order to be able to search in Chinese with no case

Specify--default-character-set=gb2312 only when starting mysqld

(10), Wait_timeout:

The number of seconds the server waits for an action on a connection before shutting it down. The default value is 28800, I change it to 7200.

Note: Parameters can be adjusted by modifying the/etc/my.cnf file and restarting the MySQL implementation. This is a relatively cautious work, the above results are just some of my views, you can be based on the hardware of your own host (especially memory size) to further modify.

MySQL Performance diagnostics and tuning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.