mysql database optimization must be several parameters of the Chinese explanation
- 2020-05-07 20:33:05
- OfStack
Step 1:
1: disk seek ability, with high speed hard disk (7200 RPM), theoretically 7200 seek per second.
2: hard disk read and write speed, this speed is very fast, this is easier to solve - can read and write from multiple hard disks in parallel.
cpu.cpu deals with in-memory data, which is the most common limiting factor when there are relatively small tables.
4: memory limitations. When cpu needs more data than is suitable for cpu's cache, the bandwidth of the cache becomes a bottleneck in memory - but now the memory is so large that this problem is unlikely to occur.
Step 2: (I use the linux platform of the school website (Linux ADVX.Mandrakesoft.com 2.4.3-19mdk))
1: adjust server parameters
Use shell > mysqld-help a table of all mysql options and configurable variables. Output the following information:
possible variables for option-- set-variable (-o) are:
back_log current value:5 // requires the number of connections mysql can have
connect_timeout current value:5 // time for mysql server to wait for 1 connection before replying with bad handshake
delayed_insert_timeout current value:200 // the time for one insert delayed to wait for insert before termination
delayed_insert_limit current value:50 //insert delayed processor will check to see if any select statements have not been executed, and if so, proceed before executing them
delayed_queue_size current value:1000 // how large a team is allocated for insert delayed
flush_time current value:0 // if set to non-0, all tables are closed for each flush_time time
interactive_timeout current value:28800 // time the server waits on the interconnect before shutting it down
join_buffer_size current es1064en es1064en es106:131072 // with the buffer size of all connections
key_buffer_size current value:1048540 // increase the size of the buffer of the index block to better handle the index
lower_case_table_names current value: 0 / /
long_query_time current value:10 // if a query takes longer than that, the slow_queried count increases
max_allowed_packet current value:1048576 // size of 1 package
max_connections current value:300 // number of simultaneous connections allowed
max_connect_errors current value:10 // if there are more than this number of interrupted connections, the next step will be blocked. flush hosts can be used
max_delayed_threads current value:15 // the number of processing insert delayed that can be started
max_heap_table_size current value: / / 16777216
max_join_size current value:4294967295 // number of connections allowed to be read
max_sort_length current value:1024 // number of bytes used to sort blob or text
max_tmp_tables current value:32 // the number of temporary tables open for one join
max_write_lock_count value:4294967295 // specify a value (usually small) to start mysqld so that an read lock occurs after a fixed number of write locks
net_buffer_length current value:16384 // size of the communication buffer - reset to this size on query
query_buffer_size current value:0 // buffer size at query time
record_buffer current value:131072 // the size of the buffer allocated by each sequential scan connection for each table it scans
sort_buffer current value:2097116 // size of buffer allocated for each sorted connection
table_cache current value:64 // number of tables open for all connections
thread_concurrency current value: 10 / /
tmp_table_size current value:1048576 // size of temporary table
thread_stack current value:131072 // size per thread
wait_timeout current value:28800 // how long the server waited for a connection before shutting it down 3 times
Configuring the above information to suit your needs will help you
1: disk seek ability, with high speed hard disk (7200 RPM), theoretically 7200 seek per second.
2: hard disk read and write speed, this speed is very fast, this is easier to solve - can read and write from multiple hard disks in parallel.
cpu.cpu deals with in-memory data, which is the most common limiting factor when there are relatively small tables.
4: memory limitations. When cpu needs more data than is suitable for cpu's cache, the bandwidth of the cache becomes a bottleneck in memory - but now the memory is so large that this problem is unlikely to occur.
Step 2: (I use the linux platform of the school website (Linux ADVX.Mandrakesoft.com 2.4.3-19mdk))
1: adjust server parameters
Use shell > mysqld-help a table of all mysql options and configurable variables. Output the following information:
possible variables for option-- set-variable (-o) are:
back_log current value:5 // requires the number of connections mysql can have
connect_timeout current value:5 // time for mysql server to wait for 1 connection before replying with bad handshake
delayed_insert_timeout current value:200 // the time for one insert delayed to wait for insert before termination
delayed_insert_limit current value:50 //insert delayed processor will check to see if any select statements have not been executed, and if so, proceed before executing them
delayed_queue_size current value:1000 // how large a team is allocated for insert delayed
flush_time current value:0 // if set to non-0, all tables are closed for each flush_time time
interactive_timeout current value:28800 // time the server waits on the interconnect before shutting it down
join_buffer_size current es1064en es1064en es106:131072 // with the buffer size of all connections
key_buffer_size current value:1048540 // increase the size of the buffer of the index block to better handle the index
lower_case_table_names current value: 0 / /
long_query_time current value:10 // if a query takes longer than that, the slow_queried count increases
max_allowed_packet current value:1048576 // size of 1 package
max_connections current value:300 // number of simultaneous connections allowed
max_connect_errors current value:10 // if there are more than this number of interrupted connections, the next step will be blocked. flush hosts can be used
max_delayed_threads current value:15 // the number of processing insert delayed that can be started
max_heap_table_size current value: / / 16777216
max_join_size current value:4294967295 // number of connections allowed to be read
max_sort_length current value:1024 // number of bytes used to sort blob or text
max_tmp_tables current value:32 // the number of temporary tables open for one join
max_write_lock_count value:4294967295 // specify a value (usually small) to start mysqld so that an read lock occurs after a fixed number of write locks
net_buffer_length current value:16384 // size of the communication buffer - reset to this size on query
query_buffer_size current value:0 // buffer size at query time
record_buffer current value:131072 // the size of the buffer allocated by each sequential scan connection for each table it scans
sort_buffer current value:2097116 // size of buffer allocated for each sorted connection
table_cache current value:64 // number of tables open for all connections
thread_concurrency current value: 10 / /
tmp_table_size current value:1048576 // size of temporary table
thread_stack current value:131072 // size per thread
wait_timeout current value:28800 // how long the server waited for a connection before shutting it down 3 times
Configuring the above information to suit your needs will help you