1. Use row-level locks to prevent table-level or page-level locks from using storage engines that support row-level locks, such as InnoDB; in scenarios where reading operations are significantly higher than writing operations (such as data warehouse applications), use table-Level Lock Storage
1. Use row-level locks to prevent table-level or page-level locks from using storage engines that support row-level locks, such as InnoDB; in scenarios where reading operations are significantly higher than writing operations (such as data warehouse applications), use table-Level Lock Storage
1. Use row-level locks to avoid table-level or page-level locks
Try to use a storage engine that supports row-level locks, such as InnoDB. Read-only operations are significantly higher than those in writing scenarios (such as data warehouse applications) the storage engine that uses table-level locks, such as MyISAM ;.
2. Reduce the possibility of hot gaint lock to avoid global mutex
The critical section (only resources that can be accessed by a single thread) seriously reduces the concurrency of the MySQL system. the InnoDB buffer pool and data dictionary are common critical sections. Fortunately, the Hong Kong virtual host, VM. The new InnoDB version can run well on multi-core processors. It supports using the innodb_buffer_pool_instances server variable to create multiple buffer pool instances, each buffer pool instance manages its own idle list, list flushing, LRU, and other data structures related to the buffer pool, and uses their respective mutex locks for protection.
3. run multiple I/O threads in parallel
Using innodb_io_capacity server variables to increase the number of disk I/O threads can improve the performance of front-end operations (such as SELECT). However, the number of disk I/O threads should not exceed the disk IOPS (about 100 IOPS of a single hardware block at rpm ).
In addition, asynchronous I/O can also improve the system's concurrency to a certain extent. In Linux, you can set the innodb_use_native_aio value of the MySQL server variable to ON to set InnoDB to use the asynchronous I/O subsystem of Linux.
4. Parallel backend tasks
By default, the MySQL purge operation (used to remove records with deletion tags) is completed by the InnoDB main thread, which can reduce the probability of internal resource competition, in this way, the MySQL service scaling capability is enhanced. However, as various kinds of internal competition in InnoDB grows, the performance advantage brought by such settings is hardly worth mentioning. Therefore, in the production environment, you should set innodb_purge_threads server variable to ON to separate the master thread from the clean write thread.
5. the SQL thread in the single-thread replication model is a hot zone
Running multiple SQL threads concurrently on the slave server can effectively improve MySQL slave server performance. MySQL 5.6 supports multi-threaded replication (one replication thread per database );
This article is from the "Marco Education" blog. For more information, contact the author!