Three major directions of MySQL optimization
① Hardware optimization
② Optimize MySQL configuration parameters (my.cnf) This optimization requires a stress test to adjust parameters.
③ Optimize SQL statements and tables.
Hardware optimization
Optimization of hardware such as cpu, memory, hard disk, etc.
MySQL parameter optimization
Set the maximum number of connections
set globle max_connections = 5000;
long_query_time = 2 queries longer than two seconds are logged
log_slow_queries = /data/mysql/slowlog.log
Query_cache_type can be 0 , 1, 2, 0 means do not use cache, 1 means use cache, 2 means use as needed