MySQL optimization II: My SQL Server Performance optimization

Source: Internet
Author: User

1 Installation optimization

In general, the more complex the system functions, the worse the performance will be. Therefore, when compiling and installing MySQL, only the required function modules are installed. such as the storage engine, the required character set, and so on, make the system as simple as possible.


2nd Log Set Optimization

Because the performance loss caused by logging directly is the most expensive I/O resource in the database, MySQL only turns on the error log by default and closes all other logs. In a production environment, however, at a minimum, binary and slow query logs need to be turned on, which is the basis for incremental backups, which facilitates further optimization of the database. Typically, a generic query log is rarely turned on in a production environment, and if opened, the database records every action record that has a significant impact on system I/O performance.

To view binary log settings, turn off by default:

Mysql> Show variables like '%log%bin% ';

+---------------------------------+-------+

| variable_name | Value |

+---------------------------------+-------+

| Log_bin | OFF |

|       Log_bin_basename | |

|       Log_bin_index | |

| log_bin_trust_function_creators | OFF |

| log_bin_use_v1_row_events | OFF |

| Sql_log_bin | On |

+---------------------------------+-------+

6 rows in Set (0.00 sec)

To view the slow query log settings, close by default:

Mysql> Show variables like "slow%";

+---------------------+-----------------------------+

| variable_name | Value |

+---------------------+-----------------------------+

| Slow_launch_time | 2 |

| Slow_query_log | OFF |

| Slow_query_log_file | /data/mysql/slave2-slow.log |

+---------------------+-----------------------------+


3 Memory optimization

Key_buffer_size:myisam engine index cache size, 4G memory recommended set to 256M, maximum not more than 4G

Read_buffer_size: The buffer size used by the read query (sequential read), which defaults to 128KB, is not too large for each connection, and should be tested multiple times in a production environment to find the best value (in multiples of 4KB)

Read_rnd_buffer_size: Read query (Random read) using the buffer size, the default is 256KB, the same is each connection exclusive, generally speaking, can be properly adjusted

Max_connections:mysql Maximum number of connections allowed, default is 151, 500-800 more appropriate if host performance and memory are allowed

Maximum number of connection threads that can be cached in the Thread_cache_size:thread_cache pool, within 100 recommended


This article from "10,000 years too long, seize" blog, please be sure to keep this source http://zengwj1949.blog.51cto.com/10747365/1920738

MySQL optimization II: My SQL Server Performance optimization

Related Article

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.