1.实战线上数据服务器参数:
数据库类型:MySQL 5.6 ;
CPU:10核;
数据库内存:12000MB;
最大IOPS:100000;
最大连接数:2000;
存储空间:共200.00G,数据文件空间26.72G;
MySQL数据库是常见的两个瓶颈是CPU和I/O的瓶颈,CPU在饱和的时候一般发生在数据装入内存或从磁盘上读取数据时候。
磁盘I/O瓶颈发生在装入数据远大于内存容量的时候,如果应用分布在网络上,那么查询量相当大的时候那么平瓶颈就会出现在网络上,
我们可以用mpstat(获取 CPU 相关统计信息), iostat(监控系统设备的IO负载情况), sar和vmstat来查看系统的性能状态。
备注:
1. mpstat :获取 CPU 相关统计信息;
语法:
iostat [ -c ] [ -d ] [ -h ] [ -N ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -z ] [ device [...] | ALL ] [ -p [ device [,...] | ALL ] ] [ interval [ count ] ]
入门使用:
iostat -d -k 2
参数 -d 表示,显示设备(磁盘)使用状态;-k某些使用block为单位的列强制使用Kilobytes为单位;2表示,数据显示每隔2秒刷新一次。
输出如下
iostat -d -k 1 10
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 39.29 21.14 1.44 441339807 29990031
sda1 0.00 0.00 0.00 1623 523
sda2 1.32 1.43 4.54 29834273 94827104
sda3 6.30 0.85 24.95 17816289 520725244
sda5 0.85 0.46 3.40 9543503 70970116
sda6 0.00 0.00 0.00 550 236
sda7 0.00 0.00 0.00 406 0
sda8 0.00 0.00 0.00 406 0
sda9 0.00 0.00 0.00 406 0
sda10 60.68 18.35 71.43 383002263 1490928140
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 327.55 5159.18 102.04 5056 100
sda1 0.00 0.00 0.00 0 0
输出信息的意义
tps:该设备每秒的传输次数(Indicate the number of transfers per second that were issued to the device.)。"一次传输"意思是"一次I/O请求"。多个逻辑请求可能会被合并为"一次I/O请求"。"一次传输"请求的大小是未知的。
kB_read/s:每秒从设备(drive expressed)读取的数据量;
kB_wrtn/s:每秒向设备(drive expressed)写入的数据量;
kB_read:读取的总数据量;
kB_wrtn:写入的总数量数据量;这些单位都为Kilobytes。
3. sar :
linux sar 命令详解 具体如下(不再做详细介绍):
除了服务器硬件的性能瓶颈,对于MySQL系统本身,我们可以使用工具来优化数据库的性能
在优化MySQL时,通常需要对数据库进行分析,常见的分析手段有:
1.慢查询日志;
2.EXPLAIN 分析查询==>使用索引;
3.profiling分析;
4.show命令查询系统状态及系统变量==>调整MySQL的内部参数配置;
通过定位分析性能的瓶颈,才能更好的优化数据库系统的性能。
4.性能瓶颈定位Show命令
我们可以通过show命令查看MySQL状态及变量,找到系统的瓶颈:
4.1
mysql>show status; ——显示状态信息(扩展show status like ‘XXX’)
具体如下:
=====================================================================================
欢迎进入SQL Command,请从底部输入框内输入要执行的SQL,按Ctrl+Enter运行.
=====================================================================================
mysql>show status;
+-----------------------------------------------------------------+--------------------------+
| Variable_name | Value |
+-----------------------------------------------------------------+--------------------------+
| Aborted_clients | 1281 |
| Aborted_connects | 357 |
| Binlog_cache_disk_use | 90 |
| Binlog_cache_use | 92281394 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 439639 |
| Buffer_read_bytes | 808 |
| Buffer_read_limits | 0 |
| Buffer_write_bytes | 808 |
| Buffer_write_limits | 0 |
| Bytes_received | 1503 |
| Bytes_sent | 2158 |
| Com_admin_commands | 0 |
| Com_assign_to_keycache | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 0 |
| Com_alter_tablespace | 0 |
| Com_alter_user | 0 |
| Com_analyze | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 0 |
| Com_change_db | 1 |
| Com_change_master | 0 |
| Com_change_repl_filter | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_create_db | 0 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_procedure | 0 |
| Com_create_server | 0 |
| Com_create_table | 0 |
| Com_create_trigger | 0 |
| Com_create_udf | 0 |
| Com_create_user | 0 |
| Com_create_view | 0 |
| Com_dealloc_sql | 0 |
| Com_delete | 0 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_event | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_procedure | 0 |
| Com_drop_server | 0 |
| Com_drop_table | 0 |
| Com_drop_trigger | 0 |
| Com_drop_user | 0 |
| Com_drop_view | 0 |
| Com_empty_query | 0 |
| Com_execute_sql | 0 |
| Com_flush | 0 |
| Com_get_diagnostics | 0 |
| Com_grant | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 0 |
| Com_insert | 0 |
| Com_insert_select | 0 |
| Com_install_plugin | 0 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_lock_tables | 0 |
| Com_lock_tables_for_backup | 0 |
| Com_lock_binlog_for_backup | 0 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_release_savepoint | 0 |
| Com_rename_table | 0 |
| Com_rename_user | 0 |
| Com_repair | 0 |
| Com_replace | 0 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_resignal | 0 |
| Com_revoke | 0 |
| Com_revoke_all | 0 |
| Com_rollback | 0 |
| Com_rollback_to_savepoint | 0 |
| Com_savepoint | 0 |
| Com_select | 3 |
| Com_set_option | 6 |
| Com_signal | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_create_db | 0 |
| Com_show_create_event | 0 |
| Com_show_create_func | 0 |
| Com_show_create_proc | 0 |
| Com_show_create_table | 0 |
| Com_show_create_trigger | 0 |
| Com_show_databases | 1 |
| Com_show_engine_logs | 0 |
| Com_show_engine_mutex | 0 |
| Com_show_engine_status | 0 |
| Com_show_events | 0 |
| Com_show_errors | 0 |
| Com_show_fields | 1 |
| Com_show_function_code | 0 |
| Com_show_function_status | 0 |
| Com_show_grants | 0 |
| Com_show_keys | 0 |
| Com_show_master_status | 0 |
| Com_show_open_tables | 0 |
| Com_show_plugins | 0 |
| Com_show_privileges | 0 |
| Com_show_procedure_code | 0 |
| Com_show_procedure_status | 0 |
| Com_show_processlist | 0 |
| Com_show_profile | 0 |
| Com_show_profiles | 0 |
| Com_show_relaylog_events | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_sql_filters | 0 |
| Com_show_status | 1 |
| Com_show_storage_engines | 0 |
| Com_show_table_status | 0 |
| Com_show_tables | 0 |
| Com_show_triggers | 0 |
| Com_show_variables | 1 |
| Com_show_warnings | 0 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_stmt_close | 0 |
| Com_stmt_execute | 0 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 0 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 0 |
| Com_stmt_send_long_data | 0 |
| Com_truncate | 0 |
| Com_uninstall_plugin | 0 |
| Com_unlock_binlog | 0 |
| Com_unlock_tables | 0 |
| Com_update | 0 |
| Com_update_multi | 0 |
| Com_xa_commit | 0 |
| Com_xa_end | 0 |
| Com_xa_prepare | 0 |
| Com_xa_recover | 0 |
| Com_xa_rollback | 0 |
| Com_xa_start | 0 |
| Com_repair_slave | 0 |
| Com_show_slave_lag | 0 |
| Com_rds_show_actual_processlist | 0 |
| Com_rds_change_user | 0 |
| Com_rds_executed_gtid_set | 0 |
| Compression | OFF |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 9651506 |
| Created_tmp_disk_tables | 1 |
| Created_tmp_files | 148511 |
| Created_tmp_tables | 5 |
| Db_time | 4469 |
| Delayed_errors | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Execute_plan_cache_hits | 0 |
| Execute_plan_cache_misses | 6 |
| Execute_plan_cache_records | 0 |
| Execute_plan_cache_total_hits | 0 |
| Execute_plan_cache_total_used_memory | 0 |
| Execute_plan_cache_used_memory | 0 |
| Execute_plan_total_cache_records | 0 |
| Extra_threads_connected | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 0 |
| Handler_discover | 0 |
| Handler_external_lock | 0 |
| Handler_mrr_init | 0 |
| Handler_prepare | 0 |
| Handler_read_first | 0 |
| Handler_read_key | 0 |
| Handler_read_last | 0 |
| Handler_read_next | 0 |
| Handler_read_prev | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_next | 72 |
| Handler_rollback | 0 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_update | 0 |
| Handler_write | 68 |
| IO_limit_count | 0 |
| Innodb_buffer_pool_dump_status | not started |
| Innodb_buffer_pool_load_status | not started |
| Innodb_buffer_pool_pages_data | 581234 |
| Innodb_buffer_pool_bytes_data | 9522937856 |
| Innodb_buffer_pool_pages_dirty | 13876 |
| Innodb_buffer_pool_bytes_dirty | 227344384 |
| Innodb_buffer_pool_pages_flushed | 244223667 |
| Innodb_buffer_pool_pages_free | 8218 |
| Innodb_buffer_pool_pages_misc | 24948 |
| Innodb_buffer_pool_pages_total | 614400 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_ahead | 15927155 |
| Innodb_buffer_pool_read_ahead_evicted | 3507 |
| Innodb_buffer_pool_read_requests | 993309667683 |
| Innodb_buffer_pool_reads | 10143948 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 6381147974 |
| Innodb_data_fsyncs | 253334866 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 435764924416 |
| Innodb_data_reads | 12822041 |
| Innodb_data_writes | 338986348 |
| Innodb_data_written | 8607201491968 |
| Innodb_dblwr_pages_written | 244223667 |
| Innodb_dblwr_writes | 61910733 |
| Innodb_have_atomic_builtins | ON |
| Innodb_log_waits | 0 |
| Innodb_log_write_requests | 1360327450 |
| Innodb_log_writes | 87674895 |
| Innodb_os_log_fsyncs | 89682594 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 603419657728 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 24172910 |
| Innodb_pages_read | 26596923 |
| Innodb_pages_written | 244223667 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 3387795 |
| Innodb_row_lock_time_avg | 19 |
| Innodb_row_lock_time_max | 51003 |
| Innodb_row_lock_waits | 169684 |
| Innodb_rows_deleted | 25435166 |
| Innodb_rows_inserted | 329456950 |
| Innodb_rows_read | 2242223629363 |
| Innodb_rows_updated | 120276508 |
| Innodb_num_open_files | 296 |
| Innodb_truncated_status_writes | 0 |
| Innodb_available_undo_logs | 128 |
| Innodb_background_flush_in_process | 0 |
| Innodb_in_crash_safe_state | 1 |
| Innodb_column_compressed | 0 |
| Innodb_column_decompressed | 0 |
| Innodb_buffered_aio_submitted | 0 |
| Innodb_defragment_compression_failures | 0 |
| Innodb_defragment_failures | 0 |
| Innodb_defragment_count | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 13396 |
| Key_blocks_used | 13396 |
| Key_read_requests | 13755755845 |
| Key_reads | 29116744 |
| Key_write_requests | 3301768534 |
| Key_writes | 60588554 |
| Last_query_cost | 0.000000 |
| Last_query_partial_plans | 0 |
| Logical_read | 0 |
| Max_statement_time_exceeded | 0 |
| Max_statement_time_set | 0 |
| Max_statement_time_set_failed | 0 |
| Max_used_connections | 167 |
| Memory_used | 18446744073709550600 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 13 |
| Open_streams | 0 |
| Open_table_definitions | 255 |
| Open_tables | 100 |
| Opened_files | 2418304 |
| Opened_table_definitions | 0 |
| Opened_tables | 0 |
| Performance_schema_accounts_lost | 0 |
| Performance_schema_cond_classes_lost | 0 |
| Performance_schema_cond_instances_lost | 0 |
| Performance_schema_digest_lost | 0 |
| Performance_schema_file_classes_lost | 0 |
| Performance_schema_file_handles_lost | 0 |
| Performance_schema_file_instances_lost | 0 |
| Performance_schema_hosts_lost | 0 |
| Performance_schema_locker_lost | 0 |
| Performance_schema_mutex_classes_lost | 0 |
| Performance_schema_mutex_instances_lost | 0 |
| Performance_schema_rwlock_classes_lost | 0 |
| Performance_schema_rwlock_instances_lost | 0 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Performance_schema_socket_classes_lost | 0 |
| Performance_schema_socket_instances_lost | 0 |
| Performance_schema_stage_classes_lost | 0 |
| Performance_schema_statement_classes_lost | 0 |
| Performance_schema_table_handles_lost | 0 |
| Performance_schema_table_instances_lost | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Performance_schema_users_lost | 0 |
| Physical_async_read | 0 |
| Physical_sync_read | 0 |
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 0 |
| Qcache_free_memory | 0 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 0 |
| Queries | 490527948 |
| Query_memory_used | 8208 |
| Questions | 13 |
| Rpl_semi_sync_master_clients | 1 |
| Rpl_semi_sync_master_get_ack | 73477498 |
| Rpl_semi_sync_master_net_avg_wait_time | 0 |
| Rpl_semi_sync_master_net_wait_time | 0 |
| Rpl_semi_sync_master_net_waits | 73477498 |
| Rpl_semi_sync_master_no_times | 32 |
| Rpl_semi_sync_master_no_tx | 648 |
| Rpl_semi_sync_master_request_ack | 73482338 |
| Rpl_semi_sync_master_status | ON |
| Rpl_semi_sync_master_timefunc_failures | 0 |
| Rpl_semi_sync_master_tx_avg_wait_time | 1093 |
| Rpl_semi_sync_master_tx_wait_time | 137368844436 |
| Rpl_semi_sync_master_tx_waits | 125582956 |
| Rpl_semi_sync_master_wait_pos_backtraverse | 3148488 |
| Rpl_semi_sync_master_wait_sessions | 0 |
| Rpl_semi_sync_master_yes_tx | 93901748 |
| Rpl_semi_sync_slave_send_ack | 0 |
| Rpl_semi_sync_slave_status | ON |
| Select_full_join | 0 |
| Select_full_range_join | 0 |
| Select_range | 0 |
| Select_range_check | 0 |
| Select_scan | 4 |
| Slave_heartbeat_period | 30.000 |
| Slave_last_heartbeat | 2017-05-18 10:53:30 |
| Slave_open_temp_tables | 0 |
| Slave_received_heartbeats | 651 |
| Slave_retried_transactions | 0 |
| Slave_running | ON |
| Slow_launch_threads | 0 |
| Slow_queries | 0 |
| Sort_merge_passes | 0 |
| Sort_range | 0 |
| Sort_rows | 0 |
| Sort_scan | 0 |
| Ssl_accept_renegotiates | 0 |
| Ssl_accepts | 0 |
| Ssl_callback_cache_hits | 0 |
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_ctx_verify_depth | 0 |
| Ssl_ctx_verify_mode | 0 |
| Ssl_default_timeout | 0 |
| Ssl_finished_accepts | 0 |
| Ssl_finished_connects | 0 |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_session_cache_hits | 0 |
| Ssl_session_cache_misses | 0 |
| Ssl_session_cache_mode | NONE |
| Ssl_session_cache_overflows | 0 |
| Ssl_session_cache_size | 0 |
| Ssl_session_cache_timeouts | 0 |
| Ssl_sessions_reused | 0 |
| Ssl_used_session_cache_entries | 0 |
| Ssl_verify_depth | 0 |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Table_locks_immediate | 924067626 |
| Table_locks_waited | 2117 |
| Table_open_cache_hits | 0 |
| Table_open_cache_misses | 0 |
| Table_open_cache_overflows | 0 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 0 |
| Tc_log_page_waits | 0 |
| Temp_sort_file_size | 0 |
| Temp_sort_table_size | 0 |
| Temp_user_table_size | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 77 |
| Threads_connected | 55 |
| Threads_created | 245 |
| Threads_rejected | 0 |
| Threads_running | 5 |
| Tokudb_rows_inserted | 45790742 |
| Tokudb_rows_read | 222559029 |
| Tokudb_rows_deleted | 0 |
| Tokudb_rows_updated | 11284 |
| Tokudb_DB_OPENS | 60357 |
| Tokudb_DB_CLOSES | 60077 |
| Tokudb_DB_OPEN_CURRENT | 280 |
| Tokudb_DB_OPEN_MAX | 360 |
| Tokudb_CHECKPOINT_PERIOD | 60 |
| Tokudb_CHECKPOINT_LAST_BEGAN | Fri Jun 2 14:33:16 2017 |
| Tokudb_CHECKPOINT_LAST_COMPLETE_BEGAN | Fri Jun 2 14:33:16 2017 |
| Tokudb_CHECKPOINT_LAST_COMPLETE_ENDED | Fri Jun 2 14:33:16 2017 |
| Tokudb_CHECKPOINT_DURATION | 40218 |
| Tokudb_CHECKPOINT_DURATION_LAST | 0 |
| Tokudb_CHECKPOINT_TAKEN | 246192 |
| Tokudb_CHECKPOINT_FAILED | 0 |
| Tokudb_CHECKPOINT_BEGIN_TIME | 29363701 |
| Tokudb_CHECKPOINT_LONG_BEGIN_TIME | 0 |
| Tokudb_CHECKPOINT_LONG_BEGIN_COUNT | 0 |
| Tokudb_CHECKPOINT_END_TIME | 37174243126 |
| Tokudb_CHECKPOINT_LONG_END_TIME | 0 |
| Tokudb_CHECKPOINT_LONG_END_COUNT | 0 |
| Tokudb_CHECKPOINT_WRITE_BYTES_PER_SECOND | 36751604 |
| Tokudb_CHECKPOINT_WRITE_BYTES | 7980758 |
| Tokudb_CHECKPOINT_WRITE_TIME | 217154 |
| Tokudb_CHECKPOINT_WRITE_SLEEP_TIME | 0 |
| Tokudb_CACHETABLE_MISS | 19059 |
| Tokudb_CACHETABLE_MISS_TIME | 40864904 |
| Tokudb_CACHETABLE_PREFETCHES | 10166 |
| Tokudb_CACHETABLE_SIZE_CURRENT | 62346737 |
| Tokudb_CACHETABLE_SIZE_LIMIT | 73819750 |
| Tokudb_CACHETABLE_SIZE_WRITING | 0 |
| Tokudb_CACHETABLE_SIZE_NONLEAF | 179705 |
| Tokudb_CACHETABLE_SIZE_LEAF | 62156424 |
| Tokudb_CACHETABLE_SIZE_ROLLBACK | 10608 |
| Tokudb_CACHETABLE_SIZE_CACHEPRESSURE | 0 |
| Tokudb_CACHETABLE_SIZE_CLONED | 0 |
| Tokudb_CACHETABLE_EVICTIONS | 33779 |
| Tokudb_CACHETABLE_CLEANER_EXECUTIONS | 15043132 |
| Tokudb_CACHETABLE_CLEANER_PERIOD | 1 |
| Tokudb_CACHETABLE_CLEANER_ITERATIONS | 5 |
| Tokudb_CACHETABLE_WAIT_PRESSURE_COUNT | 1580 |
| Tokudb_CACHETABLE_WAIT_PRESSURE_TIME | 7046641 |
| Tokudb_CACHETABLE_LONG_WAIT_PRESSURE_COUNT | 0 |
| Tokudb_CACHETABLE_LONG_WAIT_PRESSURE_TIME | 0 |
| Tokudb_CACHETABLE_CLONE_PAIR_COUNT | 2084359 |
| Tokudb_CACHETABLE_CLONE_PAIR_TIME | 2524826369 |
| Tokudb_LOCKTREE_MEMORY_SIZE | 0 |
| Tokudb_LOCKTREE_MEMORY_SIZE_LIMIT | 8388608 |
| Tokudb_LOCKTREE_ESCALATION_NUM | 2763 |
| Tokudb_LOCKTREE_ESCALATION_SECONDS | 39.297151 |
| Tokudb_LOCKTREE_LATEST_POST_ESCALATION_MEMORY_SIZE | 34600 |
| Tokudb_LOCKTREE_OPEN_CURRENT | 282 |
| Tokudb_LOCKTREE_PENDING_LOCK_REQUESTS | 0 |
| Tokudb_LOCKTREE_STO_ELIGIBLE_NUM | 0 |
| Tokudb_LOCKTREE_STO_ENDED_NUM | 33 |
| Tokudb_LOCKTREE_STO_ENDED_SECONDS | 0.000187 |
| Tokudb_LOCKTREE_WAIT_COUNT | 0 |
| Tokudb_LOCKTREE_WAIT_TIME | 0 |
| Tokudb_LOCKTREE_LONG_WAIT_COUNT | 0 |
| Tokudb_LOCKTREE_LONG_WAIT_TIME | 0 |
| Tokudb_LOCKTREE_TIMEOUT_COUNT | 0 |
| Tokudb_LOCKTREE_WAIT_ESCALATION_COUNT | 5526 |
| Tokudb_LOCKTREE_WAIT_ESCALATION_TIME | 78729675 |
| Tokudb_LOCKTREE_LONG_WAIT_ESCALATION_COUNT | 0 |
| Tokudb_LOCKTREE_LONG_WAIT_ESCALATION_TIME | 0 |
| Tokudb_DICTIONARY_UPDATES | 0 |
| Tokudb_DICTIONARY_BROADCAST_UPDATES | 0 |
| Tokudb_DESCRIPTOR_SET | 533 |
| Tokudb_MESSAGES_IGNORED_BY_LEAF_DUE_TO_MSN | 9467 |
| Tokudb_LEAF_NODES_FLUSHED_NOT_CHECKPOINT | 10671 |
| Tokudb_LEAF_NODES_FLUSHED_NOT_CHECKPOINT_BYTES | 4734876160 |
| Tokudb_LEAF_NODES_FLUSHED_NOT_CHECKPOINT_UNCOMPRESSED_BYTES | 19277200685 |
| Tokudb_LEAF_NODES_FLUSHED_NOT_CHECKPOINT_SECONDS | 2.890689 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_NOT_CHECKPOINT | 375 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_NOT_CHECKPOINT_BYTES | 105682432 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_NOT_CHECKPOINT_UNCOMPRESSE | 387189675 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_NOT_CHECKPOINT_SECONDS | 0.187063 |
| Tokudb_LEAF_NODES_FLUSHED_CHECKPOINT | 416198 |
| Tokudb_LEAF_NODES_FLUSHED_CHECKPOINT_BYTES | 293529518080 |
| Tokudb_LEAF_NODES_FLUSHED_CHECKPOINT_UNCOMPRESSED_BYTES | 803097610637 |
| Tokudb_LEAF_NODES_FLUSHED_CHECKPOINT_SECONDS | 168.717154 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_CHECKPOINT | 102462 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_CHECKPOINT_BYTES | 150900224 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_CHECKPOINT_UNCOMPRESSED_BY | 276475475 |
| Tokudb_NONLEAF_NODES_FLUSHED_TO_DISK_CHECKPOINT_SECONDS | 2.104613 |
| Tokudb_LEAF_NODE_COMPRESSION_RATIO | 2.757201 |
| Tokudb_NONLEAF_NODE_COMPRESSION_RATIO | 2.586555 |
| Tokudb_OVERALL_NODE_COMPRESSION_RATIO | 2.757054 |
| Tokudb_NONLEAF_NODE_PARTIAL_EVICTIONS | 840055 |
| Tokudb_NONLEAF_NODE_PARTIAL_EVICTIONS_BYTES | 268694261 |
| Tokudb_LEAF_NODE_PARTIAL_EVICTIONS | 2764798 |
| Tokudb_LEAF_NODE_PARTIAL_EVICTIONS_BYTES | 234053792570 |
| Tokudb_LEAF_NODE_FULL_EVICTIONS | 29357 |
| Tokudb_LEAF_NODE_FULL_EVICTIONS_BYTES | 51964428670 |
| Tokudb_NONLEAF_NODE_FULL_EVICTIONS | 3233 |
| Tokudb_NONLEAF_NODE_FULL_EVICTIONS_BYTES | 599166230 |
| Tokudb_LEAF_NODES_CREATED | 6676 |
| Tokudb_NONLEAF_NODES_CREATED | 739 |
| Tokudb_LEAF_NODES_DESTROYED | 0 |
| Tokudb_NONLEAF_NODES_DESTROYED | 0 |
| Tokudb_MESSAGES_INJECTED_AT_ROOT_BYTES | 1538360363 |
| Tokudb_MESSAGES_FLUSHED_FROM_H1_TO_LEAVES_BYTES | 1341844514 |
| Tokudb_MESSAGES_IN_TREES_ESTIMATE_BYTES | 196515849 |
| Tokudb_MESSAGES_INJECTED_AT_ROOT | 26996193 |
| Tokudb_BROADCASE_MESSAGES_INJECTED_AT_ROOT | 0 |
| Tokudb_BASEMENTS_DECOMPRESSED_TARGET_QUERY | 45 |
| Tokudb_BASEMENTS_DECOMPRESSED_PRELOCKED_RANGE | 517 |
| Tokudb_BASEMENTS_DECOMPRESSED_PREFETCH | 0 |
| Tokudb_BASEMENTS_DECOMPRESSED_FOR_WRITE | 751 |
| Tokudb_BUFFERS_DECOMPRESSED_TARGET_QUERY | 809 |
| Tokudb_BUFFERS_DECOMPRESSED_PRELOCKED_RANGE | 3134 |
| Tokudb_BUFFERS_DECOMPRESSED_PREFETCH | 0 |
| Tokudb_BUFFERS_DECOMPRESSED_FOR_WRITE | 843314 |
| Tokudb_PIVOTS_FETCHED_FOR_QUERY | 2941 |
| Tokudb_PIVOTS_FETCHED_FOR_QUERY_BYTES | 86445568 |
| Tokudb_PIVOTS_FETCHED_FOR_QUERY_SECONDS | 0.262694 |
| Tokudb_PIVOTS_FETCHED_FOR_PREFETCH | 9575 |
| Tokudb_PIVOTS_FETCHED_FOR_PREFETCH_BYTES | 313650176 |
| Tokudb_PIVOTS_FETCHED_FOR_PREFETCH_SECONDS | 0.652002 |
| Tokudb_PIVOTS_FETCHED_FOR_WRITE | 1480 |
| Tokudb_PIVOTS_FETCHED_FOR_WRITE_BYTES | 46337024 |
| Tokudb_PIVOTS_FETCHED_FOR_WRITE_SECONDS | 0.052421 |
| Tokudb_BASEMENTS_FETCHED_TARGET_QUERY | 155411 |
| Tokudb_BASEMENTS_FETCHED_TARGET_QUERY_BYTES | 3267691520 |
| Tokudb_BASEMENTS_FETCHED_TARGET_QUERY_SECONDS | 1.332598 |
| Tokudb_BASEMENTS_FETCHED_PRELOCKED_RANGE | 454131 |
| Tokudb_BASEMENTS_FETCHED_PRELOCKED_RANGE_BYTES | 6250294272 |
| Tokudb_BASEMENTS_FETCHED_PRELOCKED_RANGE_SECONDS | 2.655348 |
| Tokudb_BASEMENTS_FETCHED_PREFETCH | 1389169 |
| Tokudb_BASEMENTS_FETCHED_PREFETCH_BYTES | 17820028928 |
| Tokudb_BASEMENTS_FETCHED_PREFETCH_SECONDS | 10.723053 |
| Tokudb_BASEMENTS_FETCHED_FOR_WRITE | 1152600 |
| Tokudb_BASEMENTS_FETCHED_FOR_WRITE_BYTES | 32265176064 |
| Tokudb_BASEMENTS_FETCHED_FOR_WRITE_SECONDS | 9.410008 |
| Tokudb_BUFFERS_FETCHED_TARGET_QUERY | 8 |
| Tokudb_BUFFERS_FETCHED_TARGET_QUERY_BYTES | 4096 |
| Tokudb_BUFFERS_FETCHED_TARGET_QUERY_SECONDS | 0.000021 |
| Tokudb_BUFFERS_FETCHED_PRELOCKED_RANGE | 0 |
| Tokudb_BUFFERS_FETCHED_PRELOCKED_RANGE_BYTES | 0 |
| Tokudb_BUFFERS_FETCHED_PRELOCKED_RANGE_SECONDS | 0.000000 |
| Tokudb_BUFFERS_FETCHED_PREFETCH | 0 |
| Tokudb_BUFFERS_FETCHED_PREFETCH_BYTES | 0 |
| Tokudb_BUFFERS_FETCHED_PREFETCH_SECONDS | 0.000000 |
| Tokudb_BUFFERS_FETCHED_FOR_WRITE | 901 |
| Tokudb_BUFFERS_FETCHED_FOR_WRITE_BYTES | 35830272 |
| Tokudb_BUFFERS_FETCHED_FOR_WRITE_SECONDS | 0.009295 |
| Tokudb_LEAF_COMPRESSION_TO_MEMORY_SECONDS | 29746.697501 |
| Tokudb_LEAF_SERIALIZATION_TO_MEMORY_SECONDS | 1193.554112 |
| Tokudb_LEAF_DECOMPRESSION_TO_MEMORY_SECONDS | 773.051091 |
| Tokudb_LEAF_DESERIALIZATION_TO_MEMORY_SECONDS | 173.040626 |
| Tokudb_NONLEAF_COMPRESSION_TO_MEMORY_SECONDS | 110.062583 |
| Tokudb_NONLEAF_SERIALIZATION_TO_MEMORY_SECONDS | 2.094715 |
| Tokudb_NONLEAF_DECOMPRESSION_TO_MEMORY_SECONDS | 0.919275 |
| Tokudb_NONLEAF_DESERIALIZATION_TO_MEMORY_SECONDS | 1.279514 |
| Tokudb_PROMOTION_ROOTS_SPLIT | 146 |
| Tokudb_PROMOTION_LEAF_ROOTS_INJECTED_INTO | 10133329 |
| Tokudb_PROMOTION_H1_ROOTS_INJECTED_INTO | 22736387 |
| Tokudb_PROMOTION_INJECTIONS_AT_DEPTH_0 | 142 |
| Tokudb_PROMOTION_INJECTIONS_AT_DEPTH_1 | 17765504 |
| Tokudb_PROMOTION_INJECTIONS_AT_DEPTH_2 | 410970 |
| Tokudb_PROMOTION_INJECTIONS_AT_DEPTH_3 | 224416 |
| Tokudb_PROMOTION_INJECTIONS_LOWER_THAN_DEPTH_3 | 315 |
| Tokudb_PROMOTION_STOPPED_NONEMPTY_BUFFER | 3718927 |
| Tokudb_PROMOTION_STOPPED_AT_HEIGHT_1 | 1864 |
| Tokudb_PROMOTION_STOPPED_CHILD_LOCKED_OR_NOT_IN_MEMORY | 0 |
| Tokudb_PROMOTION_STOPPED_CHILD_NOT_FULLY_IN_MEMORY | 0 |
| Tokudb_PROMOTION_STOPPED_AFTER_LOCKING_CHILD | 0 |
| Tokudb_BASEMENT_DESERIALIZATION_FIXED_KEY | 3136859 |
| Tokudb_BASEMENT_DESERIALIZATION_VARIABLE_KEY | 18509 |
| Tokudb_CURSOR_SKIP_DELETED_LEAF_ENTRY | 24660 |
| Tokudb_TXN_BEGIN | 4616656 |
| Tokudb_TXN_BEGIN_READ_ONLY | 126 |
| Tokudb_TXN_COMMITS | 4616215 |
| Tokudb_TXN_ABORTS | 567 |
| Tokudb_LOGGER_WRITES | 1784890 |
| Tokudb_LOGGER_WRITES_BYTES | 13339956700 |
| Tokudb_LOGGER_WRITES_UNCOMPRESSED_BYTES | 13339956700 |
| Tokudb_LOGGER_WRITES_SECONDS | 82.774109 |
| Tokudb_LOGGER_WAIT_LONG | 5 |
| Tokudb_LOADER_NUM_CREATED | 63 |
| Tokudb_LOADER_NUM_CURRENT | 0 |
| Tokudb_LOADER_NUM_MAX | 28 |
| Tokudb_MEM_ESTIMATED_MAXIMUM_MEMORY_FOOTPRINT | 0 |
| Tokudb_FILESYSTEM_THREADS_BLOCKED_BY_FULL_DISK | 0 |
| Tokudb_FILESYSTEM_FSYNC_TIME | 4750262196 |
| Tokudb_FILESYSTEM_FSYNC_NUM | 2578568 |
| Tokudb_FILESYSTEM_LONG_FSYNC_TIME | 176558381 |
| Tokudb_FILESYSTEM_LONG_FSYNC_NUM | 85 |
| Tokudb_FILESYSTEM_WRITE_TIME | 85655606 |
| Tokudb_FILESYSTEM_WRITE_NUM | 1788565 |
| Tokudb_FILESYSTEM_WRITE_BYTES | 15561516093 |
| Tokudb_FILESYSTEM_PWRITE_TIME | 191556592 |
| Tokudb_FILESYSTEM_PWRITE_NUM | 1265824 |
| Tokudb_FILESYSTEM_PWRITE_BYTES | 303583620096 |
| Tokudb_FILESYSTEM_READ_TIME | 2397222 |
| Tokudb_FILESYSTEM_READ_NUM | 25467 |
| Tokudb_FILESYSTEM_READ_BYTES | 3652551234 |
| Tokudb_FILESYSTEM_LONG_READ_TIME | 0 |
| Tokudb_FILESYSTEM_LONG_READ_NUM | 0 |
| Tokudb_FILESYSTEM_PREAD_TIME | 26106502 |
| Tokudb_FILESYSTEM_PREAD_NUM | 3380491 |
| Tokudb_FILESYSTEM_PREAD_BYTES | 61453749248 |
| Tokudb_FILESYSTEM_LONG_PREAD_TIME | 0 |
| Tokudb_FILESYSTEM_LONG_PREAD_NUM | 0 |
| Uptime | 14771516 |
| Uptime_since_flush_status | 14771516 |
| sphinx_error | |
| sphinx_time | |
| sphinx_total | |
| sphinx_total_found | |
| sphinx_word_count | |
| sphinx_words | |
+-----------------------------------------------------------------+--------------------------+
共返回 616 行记录,花费 8 ms.
4.2
show variables; ——显示系统变量(扩展show variables like ‘XXX’)
具体如下:
=====================================================================================
欢迎进入SQL Command,请从底部输入框内输入要执行的SQL,按Ctrl+Enter运行.
=====================================================================================
mysql>show variables;
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| autocommit | ON |
| automatic_sp_privileges | OFF |
| back_log | 3000 |
| basedir | |
| big_tables | OFF |
| bind_address | * |
| binlog_cache_size | 1048576 |
| binlog_checksum | CRC32 |
| binlog_direct_non_transactional_updates | OFF |
| binlog_format | ROW |
| binlog_order_commits | OFF |
| binlog_row_image | FULL |
| binlog_rows_query_log_events | OFF |
| binlog_stmt_cache_size | 32768 |
| bulk_insert_buffer_size | 4194304 |
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | |
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
| core_file | ON |
| cuekt_spn_tpls | 0 |
| datadir | |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| default_storage_engine | InnoDB |
| default_tmp_storage_engine | InnoDB |
| default_week_format | 0 |
| delay_key_write | ON |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| disconnect_on_expired_password | ON |
| div_precision_increment | 4 |
| end_markers_in_json | OFF |
| enforce_gtid_consistency | ON |
| eq_range_index_dive_limit | 10 |
| error_count | 0 |
| event_scheduler | ON |
| expire_logs_days | 0 |
| explicit_defaults_for_timestamp | OFF |
| external_user | |
| extra_max_connections | |
| extra_port | |
| flush | OFF |
| flush_time | 0 |
| foreign_key_checks | ON |
| ft_boolean_syntax | + -><()~*:""&| |
| ft_max_word_len | 84 |
| ft_min_word_len | 4 |
| ft_query_expansion_limit | 20 |
| ft_stopword_file | |
| general_log | OFF |
| general_log_file | |
| group_concat_max_len | 10240000 |
| gtid_executed | |
| gtid_mode | ON |
| gtid_next | AUTOMATIC |
| gtid_owned | |
| gtid_purged | 051298c4-f01b-11e5-ab36-008cfae30eac:1-92331706,
43b7e4c5-efd3-11e5-a962-e435c87983c8:1-3972,
f5f7f5d5-f01a-11e5-ab36-008cfae410b8:1-156699751 |
| have_backup_locks | YES |
| have_compress | YES |
| have_crypt | YES |
| have_dynamic_loading | YES |
| have_geometry | YES |
| have_openssl | DISABLED |
| have_profiling | YES |
| have_query_cache | YES |
| have_rtree_keys | YES |
| have_ssl | DISABLED |
| have_statement_timeout | YES |
| have_symlink | DISABLED |
| host_cache_size | 705 |
| hostname | |
| identity | 0 |
| ignore_builtin_innodb | OFF |
| ignore_db_dirs | |
| init_connect | |
| init_file | |
| init_slave | |
| innodb_adaptive_flushing | ON |
| innodb_adaptive_flushing_lwm | 10 |
| innodb_adaptive_hash_index | ON |
| innodb_adaptive_hash_index_parts | 8 |
| innodb_adaptive_max_sleep_delay | 150000 |
| innodb_additional_mem_pool_size | 2097152 |
| innodb_api_bk_commit_interval | 5 |
| innodb_api_disable_rowlock | OFF |
| innodb_api_enable_binlog | OFF |
| innodb_api_enable_mdl | OFF |
| innodb_api_trx_level | 0 |
| innodb_autoextend_increment | 64 |
| innodb_autoinc_lock_mode | 1 |
| innodb_buffer_pool_dump_at_shutdown | OFF |
| innodb_buffer_pool_dump_now | OFF |
| innodb_buffer_pool_filename | ib_buffer_pool |
| innodb_buffer_pool_instances | 8 |
| innodb_buffer_pool_load_abort | OFF |
| innodb_buffer_pool_load_at_startup | OFF |
| innodb_buffer_pool_load_now | OFF |
| innodb_buffer_pool_size | 10066329600 |
| innodb_change_buffer_max_size | 25 |
| innodb_change_buffering | all |
| innodb_checksum_algorithm | innodb |
| innodb_checksums | ON |
| innodb_cmp_per_index_enabled | OFF |
| innodb_commit_concurrency | 0 |
| innodb_compression_failure_threshold_pct | 5 |
| innodb_compression_level | 6 |
| innodb_compression_pad_pct_max | 50 |
| innodb_concurrency_tickets | 500 |
| innodb_data_file_path | ibdata1:200M:autoextend |
| innodb_data_home_dir | |
| innodb_defragment | OFF |
| innodb_defragment_fill_factor | 0.900000 |
| innodb_defragment_fill_factor_n_recs | 20 |
| innodb_defragment_frequency | 40 |
| innodb_defragment_n_pages | 7 |
| innodb_defragment_stats_accuracy | 0 |
| innodb_disable_sort_file_cache | ON |
| innodb_doublewrite | ON |
| innodb_encrypt_algorithm | aes_128_ecb |
| innodb_fast_shutdown | 1 |
| innodb_file_format | Barracuda |
| innodb_file_format_check | ON |
| innodb_file_format_max | Barracuda |
| innodb_file_per_table | ON |
| innodb_flush_log_at_timeout | 1 |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_flush_method | O_DIRECT |
| innodb_flush_neighbors | 1 |
| innodb_flushing_avg_loops | 30 |
| innodb_force_load_corrupted | OFF |
| innodb_force_recovery | 0 |
| innodb_ft_aux_table | |
| innodb_ft_cache_size | 8000000 |
| innodb_ft_enable_diag_print | OFF |
| innodb_ft_enable_stopword | ON |
| innodb_ft_max_token_size | 84 |
| innodb_ft_min_token_size | 3 |
| innodb_ft_num_word_optimize | 2000 |
| innodb_ft_result_cache_limit | 2000000000 |
| innodb_ft_server_stopword_table | |
| innodb_ft_sort_pll_degree | 2 |
| innodb_ft_total_cache_size | 640000000 |
| innodb_ft_user_stopword_table | |
| innodb_io_capacity | 2000 |
| innodb_io_capacity_max | 4000 |
| innodb_large_prefix | OFF |
| innodb_lock_wait_timeout | 50 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_buffer_size | 8388608 |
| innodb_log_compressed_pages | OFF |
| innodb_log_file_size | 1572864000 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | |
| innodb_lru_scan_depth | 1024 |
| innodb_max_dirty_pages_pct | 75 |
| innodb_max_dirty_pages_pct_lwm | 0 |
| innodb_max_purge_lag | 0 |
| innodb_max_purge_lag_delay | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_monitor_disable | |
| innodb_monitor_enable | |
| innodb_monitor_reset | |
| innodb_monitor_reset_all | |
| innodb_old_blocks_pct | 37 |
| innodb_old_blocks_time | 0 |
| innodb_online_alter_log_max_size | 134217728 |
| innodb_open_files | 300 |
| innodb_optimize_fulltext_only | OFF |
| innodb_page_size | 16384 |
| innodb_print_all_deadlocks | OFF |
| innodb_purge_batch_size | 20 |
| innodb_purge_threads | 1 |
| innodb_random_read_ahead | OFF |
| innodb_rds_quick_lru_limit_per_instance | 4096 |
| innodb_rds_trx_own_block_max | 128 |
| innodb_read_ahead_threshold | 56 |
| innodb_read_io_threads | 4 |
| innodb_read_only | OFF |
| innodb_replication_delay | 0 |
| innodb_rollback_on_timeout | OFF |
| innodb_rollback_segments | 128 |
| innodb_sort_buffer_size | 1048576 |
| innodb_spin_wait_delay | 30 |
| innodb_stats_auto_recalc | ON |
| innodb_stats_method | nulls_equal |
| innodb_stats_on_metadata | OFF |
| innodb_stats_persistent | ON |
| innodb_stats_persistent_sample_pages | 20 |
| innodb_stats_sample_pages | 8 |
| innodb_stats_transient_sample_pages | 8 |
| innodb_status_output | OFF |
| innodb_status_output_locks | OFF |
| innodb_strict_mode | OFF |
| innodb_support_xa | ON |
| innodb_sync_array_size | 1 |
| innodb_sync_spin_loops | 100 |
| innodb_table_locks | ON |
| innodb_thread_concurrency | 0 |
| innodb_thread_sleep_delay | 10000 |
| innodb_undo_directory | . |
| innodb_undo_logs | 128 |
| innodb_undo_tablespaces | 0 |
| innodb_use_native_aio | OFF |
| innodb_use_sys_malloc | ON |
| innodb_version | 5.6.16 |
| innodb_write_io_threads | 4 |
| insert_id | 0 |
| interactive_timeout | 7200 |
| join_buffer_size | 1048576 |
| keep_files_on_create | OFF |
| key_buffer_size | 16777216 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| large_files_support | ON |
| large_page_size | 0 |
| large_pages | OFF |
| last_insert_id | 0 |
| lc_messages | en_US |
| lc_messages_dir | |
| lc_time_names | en_US |
| license | GPL |
| local_infile | ON |
| lock_wait_timeout | 31536000 |
| locked_in_memory | OFF |
| log_bin | ON |
| log_bin_basename | |
| log_bin_index | |
| log_bin_trust_function_creators | ON |
| log_bin_use_v1_row_events | ON |
| log_error | |
| log_output | TABLE |
| log_queries_not_using_indexes | OFF |
| log_slave_updates | ON |
| log_slow_admin_statements | ON |
| log_slow_slave_statements | OFF |
| log_throttle_queries_not_using_indexes | 0 |
| log_warnings | 2 |
| long_query_time | 1.000000 |
| low_priority_updates | OFF |
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
| master_info_repository | TABLE |
| master_verify_checksum | OFF |
| max_allowed_packet | 1073741824 |
| max_binlog_cache_size | 18446744073709547520 |
| max_binlog_size | 524288000 |
| max_binlog_stmt_cache_size | 18446744073709547520 |
| max_connect_errors | 20 |
| max_connections | 2050 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 67108864 |
| max_insert_delayed_threads | 20 |
| max_join_size | 18446744073709551615 |
| max_length_for_sort_data | 1024 |
| max_prepared_stmt_count | 16382 |
| max_relay_log_size | 0 |
| max_seeks_for_key | 18446744073709551615 |
| max_sort_length | 1024 |
| max_sp_recursion_depth | 0 |
| max_statement_time | 0 |
| max_tmp_tables | 32 |
| max_user_connections | 2050 |
| max_write_lock_count | 18446744073709551615 |
| metadata_locks_cache_size | 1024 |
| metadata_locks_hash_instances | 8 |
| min_examined_row_limit | 0 |
| multi_range_count | 256 |
| myisam_data_pointer_size | 6 |
| myisam_max_sort_file_size | 2097152 |
| myisam_mmap_size | 18446744073709551615 |
| myisam_recover_options | FORCE |
| myisam_repair_threads | 1 |
| myisam_sort_buffer_size | 262144 |
| myisam_stats_method | nulls_unequal |
| myisam_use_mmap | OFF |
| net_buffer_length | 16384 |
| net_read_timeout | 30 |
| net_retry_count | 10 |
| net_write_timeout | 60 |
| new | OFF |
| old | OFF |
| old_alter_table | OFF |
| old_passwords | 0 |
| open_files_limit | 65535 |
| optimizer_prune_level | 1 |
| optimizer_search_depth | 62 |
| optimizer_switch | index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on |
| optimizer_trace | enabled=off,one_line=off |
| optimizer_trace_features | greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on |
| optimizer_trace_limit | 1 |
| optimizer_trace_max_mem_size | 16384 |
| optimizer_trace_offset | -1 |
| performance_schema | OFF |
| performance_schema_accounts_size | -1 |
| performance_schema_digests_size | -1 |
| performance_schema_events_stages_history_long_size | -1 |
| performance_schema_events_stages_history_size | -1 |
| performance_schema_events_statements_history_long_size | -1 |
| performance_schema_events_statements_history_size | -1 |
| performance_schema_events_waits_history_long_size | -1 |
| performance_schema_events_waits_history_size | -1 |
| performance_schema_hosts_size | -1 |
| performance_schema_max_cond_classes | 80 |
| performance_schema_max_cond_instances | -1 |
| performance_schema_max_file_classes | 50 |
| performance_schema_max_file_handles | 32768 |
| performance_schema_max_file_instances | -1 |
| performance_schema_max_mutex_classes | 200 |
| performance_schema_max_mutex_instances | -1 |
| performance_schema_max_rwlock_classes | 40 |
| performance_schema_max_rwlock_instances | -1 |
| performance_schema_max_socket_classes | 10 |
| performance_schema_max_socket_instances | -1 |
| performance_schema_max_stage_classes | 150 |
| performance_schema_max_statement_classes | 189 |
| performance_schema_max_table_handles | -1 |
| performance_schema_max_table_instances | -1 |
| performance_schema_max_thread_classes | 50 |
| performance_schema_max_thread_instances | -1 |
| performance_schema_session_connect_attrs_size | -1 |
| performance_schema_setup_actors_size | 100 |
| performance_schema_setup_objects_size | 100 |
| performance_schema_users_size | -1 |
| pid_file | |
| plugin_dir | |
| port | |
| preload_buffer_size | 32768 |
| profiling | OFF |
| profiling_history_size | 15 |
| protocol_version | 10 |
| proxy_user | |
| pseudo_slave_mode | OFF |
| pseudo_thread_id | 755084151 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 1024 |
| query_cache_size | 0 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
| query_prealloc_size | 8192 |
| rand_seed1 | 0 |
| rand_seed2 | 0 |
| range_alloc_block_size | 4096 |
| rds_enable_sql_digest | |
| rds_ic_reduce_hint_enable | OFF |
| rds_max_digest_length | |
| rds_sql_max_affected_rows | 0 |
| read_buffer_size | 1048576 |
| read_only | OFF |
| read_rnd_buffer_size | 1048576 |
| relay_log | |
| relay_log_basename | |
| relay_log_index | |
| relay_log_info_file | |
| relay_log_info_repository | TABLE |
| relay_log_purge | ON |
| relay_log_recovery | OFF |
| relay_log_space_limit | 0 |
| report_host | |
| report_password | |
| report_port | |
| report_user | |
| rpl_semi_sync_master_enabled | ON |
| rpl_semi_sync_master_timeout | 1000 |
| rpl_semi_sync_master_trace_level | 1 |
| rpl_semi_sync_master_wait_no_slave | ON |
| rpl_semi_sync_master_wait_point | after_commit |
| rpl_semi_sync_slave_delay_master | OFF |
| rpl_semi_sync_slave_enabled | OFF |
| rpl_semi_sync_slave_kill_conn_timeout | 5 |
| rpl_semi_sync_slave_trace_level | 1 |
| rpl_stop_slave_timeout | 31536000 |
| secure_auth | ON |
| secure_file_priv | |
| server_id | 2570968366 |
| server_id_bits | 32 |
| server_uuid | 051298c4-f01b-11e5-ab36-008cfae30eac |
| skip_external_locking | ON |
| skip_name_resolve | ON |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_allow_batching | OFF |
| slave_checkpoint_group | 512 |
| slave_checkpoint_period | 300 |
| slave_compressed_protocol | OFF |
| slave_exec_mode | STRICT |
| slave_load_tmpdir | |
| slave_max_allowed_packet | 1073741824 |
| slave_net_timeout | 60 |
| slave_parallel_workers | 0 |
| slave_pending_jobs_size_max | 16777216 |
| slave_pr_mode | TABLE |
| slave_rows_search_algorithms | TABLE_SCAN,INDEX_SCAN |
| slave_skip_errors | OFF |
| slave_sql_verify_checksum | ON |
| slave_transaction_retries | 10 |
| slave_type_conversions | |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_log_file | |
| socket | |
| sort_buffer_size | 2097152 |
| sql_auto_is_null | OFF |
| sql_big_selects | ON |
| sql_buffer_result | OFF |
| sql_log_bin | ON |
| sql_log_off | OFF |
| sql_mode | |
| sql_notes | ON |
| sql_quote_show_create | ON |
| sql_safe_updates | OFF |
| sql_select_limit | 3000 |
| sql_slave_skip_counter | 0 |
| sql_warnings | OFF |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | |
| storage_engine | InnoDB |
| stored_program_cache | 256 |
| sync_binlog | 1 |
| sync_frm | ON |
| sync_master_info | 10000 |
| sync_relay_log | 10000 |
| sync_relay_log_info | 10000 |
| system_time_zone | CST |
| table_definition_cache | 512 |
| table_open_cache | 100 |
| table_open_cache_instances | 1 |
| thread_cache_size | 100 |
| thread_concurrency | 10 |
| thread_handling | one-thread-per-connection |
| thread_pool_high_prio_mode | transactions |
| thread_pool_high_prio_tickets | 4294967295 |
| thread_pool_idle_timeout | 60 |
| thread_pool_max_threads | 100000 |
| thread_pool_oversubscribe | 10 |
| thread_pool_size | 32 |
| thread_pool_stall_limit | 30 |
| thread_stack | 262144 |
| threadpool_workaround_epoll_bug | OFF |
| time_format | %H:%i:%s |
| time_zone | SYSTEM |
| timed_mutexes | OFF |
| timestamp | 1496385398.628738 |
| tmp_table_size | 262144 |
| tmpdir | |
| tokudb_alter_print_error | OFF |
| tokudb_analyze_delete_fraction | 1.000000 |
| tokudb_analyze_in_background | OFF |
| tokudb_analyze_mode | TOKUDB_ANALYZE_STANDARD |
| tokudb_analyze_throttle | 0 |
| tokudb_analyze_time | 5 |
| tokudb_auto_analyze | 0 |
| tokudb_backup_is_running | OFF |
| tokudb_block_size | 4194304 |
| tokudb_bulk_fetch | ON |
| tokudb_bypass_rightmost_insert | OFF |
| tokudb_cache_size | 67108864 |
| tokudb_cachetable_pool_threads | 0 |
| tokudb_cardinality_scale_percent | 50 |
| tokudb_check_jemalloc | 1 |
| tokudb_checkpoint_lock | OFF |
| tokudb_checkpoint_on_flush_logs | OFF |
| tokudb_checkpoint_pool_threads | 0 |
| tokudb_checkpointing_period | 60 |
| tokudb_checkpointing_write_bytes_per_second | 0 |
| tokudb_cleaner_iterations | 5 |
| tokudb_cleaner_period | 1 |
| tokudb_client_pool_threads | 0 |
| tokudb_commit_sync | ON |
| tokudb_cpu_nums | 0 |
| tokudb_create_index_online | ON |
| tokudb_data_dir | |
| tokudb_debug | 0 |
| tokudb_debug_pause_background_job_manager | OFF |
| tokudb_debug_trigger_auto_analyze | OFF |
| tokudb_directio | OFF |
| tokudb_disable_hot_alter | OFF |
| tokudb_disable_prefetching | OFF |
| tokudb_disable_slow_alter | OFF |
| tokudb_disable_slow_update | OFF |
| tokudb_disable_slow_upsert | OFF |
| tokudb_empty_scan | rl |
| tokudb_fixup_delete_key_not_found | 0 |
| tokudb_fs_reserve_percent | 5 |
| tokudb_fsync_log_period | 0 |
| tokudb_hide_default_row_format | ON |
| tokudb_killed_time | 4000 |
| tokudb_last_lock_timeout | |
| tokudb_load_save_space | ON |
| tokudb_loader_memory_size | 100000000 |
| tokudb_lock_timeout | 4000 |
| tokudb_lock_timeout_debug | 1 |
| tokudb_log_dir | |
| tokudb_max_lock_memory | 8388608 |
| tokudb_optimize_index_fraction | 1.000000 |
| tokudb_optimize_index_name | |
| tokudb_optimize_throttle | 0 |
| tokudb_pk_insert_mode | 1 |
| tokudb_pk_uniqueness_check_in_ft | OFF |
| tokudb_prelock_empty | ON |
| tokudb_read_block_size | 65536 |
| tokudb_read_buf_size | 131072 |
| tokudb_read_status_frequency | 10000 |
| tokudb_row_format | tokudb_zlib |
| tokudb_rpl_check_readonly | ON |
| tokudb_rpl_lookup_rows | OFF |
| tokudb_rpl_lookup_rows_delay | 0 |
| tokudb_rpl_unique_checks | OFF |
| tokudb_rpl_unique_checks_delay | 0 |
| tokudb_support_xa | ON |
| tokudb_tmp_dir | |
| tokudb_version | 7.5.6 |
| tokudb_write_status_frequency | 1000 |
| transaction_alloc_block_size | 8192 |
| transaction_allow_batching | OFF |
| transaction_prealloc_size | 4096 |
| tx_isolation | READ-COMMITTED |
| tx_read_only | OFF |
| unique_checks | ON |
| updatable_views_with_limit | YES |
| version | 5.6.16-log |
| version_comment | Source distribution |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
| wait_timeout | 86400 |
| warning_count | 0 |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
共返回 547 行记录,花费 8 ms.
4.3
show processlist;——查看当前SQL执行,包括执行状态、是否锁表等.
当前实例实时会话:
select id,user,host,db,command,time,state,info from information_schema.PROCESSLIST
order by time desc;
mysql> show processlist;
+----+-------+-----------------+-----------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------+-----------------+-----------+---------+------+----------+------------------+
| 25 | apple | localhost:61896 | NULL | Sleep | 18 | | NULL |
| 27 | apple | localhost:61904 | qttz_core | Query | 0 | starting | show processlist |
+----+-------+-----------------+-----------+---------+------+----------+------------------+
2 rows in set
4.5 配置优化:
# 不在 TCP/IP 端口上进行监听.
# 如果所有的进程都是在同一台服务器连接到本地的 mysqld,
# 这样设置将是增强安全的方法
# 所有 mysqld 的连接都是通过 Unix Sockets 或者命名管道进行的.
# 注意在 Windows下如果没有打开命名管道选项而只是用此项
# (通过 “enable-named-pipe” 选项) 将会导致 MySQL 服务没有任何作用!
#skip-networking
# MySQL 服务所允许的同时会话数的上限
# 其中一个连接将被 SUPER 权限保留作为管理员登录.
# 即便已经达到了连接数的上限
1) max_connections = 2050
# 每个客户端连接最大的错误允许数量,如果达到了此限制.
# 这个客户端将会被 MySQL 服务阻止直到执行了 “FLUSH HOSTS” 或者服务重启
# 非法的密码以及其他在链接时的错误会增加此值.
# 查看 “Aborted_connects” 状态来获取全局计数器.
1.1) max_connect_errors = 50
# back_log 是操作系统在监听队列中所能保持的连接数,
# 队列保存了在 MySQL 连接管理器线程处理之前的连接.
# 如果你有非常高的连接率并且出现 “connection refused” 报错,
# 你就应该增加此处的值.
# 检查你的操作系统文档来获取这个变量的最大值.
# 如果将back_log设定到比你操作系统限制更高的值,将会没有效果
2) back_log = 3000
# MySQL服务器所支持的最大连接数是有上限的,因为每个连接的建立都会消耗内存,因此我们希望客户端在连接到MySQL Server处理完相应的操作后,
# 应该断开连接并释放占用的内存。如果你的MySQL Server有大量的闲置连接,他们不仅会白白消耗内存,而且如果连接一直在累加而不断开,
# 最终肯定会达到MySQL Server的连接上限数,这会报'too many connections'的错误。对于wait_timeout的值设定,应该根据系统的运行情况来判断。
# 在系统运行一段时间后,可以通过show processlist命令查看当前系统的连接状态,如果发现有大量的sleep状态的连接进程,则说明该参数设置的过大,可以进行适当的调整小些。
# 服务器关闭交互式连接前等待活动的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端。
# 参数默认值:28800秒(8小时)
3) interactive_timeout = 7200
# 参数含义:服务器关闭非交互连接之前等待活动的秒数。
# 在线程启动时,根据全局wait_timeout值或全局interactive_timeout值初始化会话wait_timeout值,取决于客户端类型(由mysql_real_connect()的连接选项CLIENT_INTERACTIVE定义)。
# 参数默认值:28800秒(8小时)
3.1) wait_timeout = 86400
# 关键词缓冲的大小, 一般用来缓冲 MyISAM 表的索引块.
# 不要将其设置大于你可用内存的30%,
# 因为一部分内存同样被OS用来缓冲行数据
# 甚至在你并不使用 MyISAM 表的情况下, 你也需要仍旧设置起 8-64M 内存由于它同样会被内部临时磁盘表使用.
4) key_buffer_size = 16777216
# 查询缓冲常被用来缓冲 SELECT 的结果并且在下一次同样查询的时候不再执行直接返回结果.
# 打开查询缓冲可以极大的提高服务器速度, 如果你有大量的相同的查询并且很少修改表.
# 查看 “Qcache_lowmem_prunes” 状态变量来检查是否当前值对于你的负载来说是否足够高.
# 注意: 在你表经常变化的情况下或者如果你的查询原文每次都不同,
# 查询缓冲也许引起性能下降而不是性能提升.
5) query_cache_size = 0
# 随机读取数据缓冲区使用内存(read_rnd_buffer_size):和顺序读取相对应,
# 当 MySQL 进行非顺序读取(随机读取)数据块的时候,会利用>这个缓冲区暂存读取的数据
# 如根据索引信息读取表数据,根据排序后的结果集与表进行 Join 等等
# 总的来说,就是当数据块的读取需要满足>一定的顺序的情况下,MySQL 就需要产生随机读取,进而使用到 read_rnd_buffer_size 参数所设置的内存缓冲区
6) read_rnd_buffer_size = 1048576
# 当在排序之后,从一个已经排序好的序列中读取行时,行数据将从这个缓冲中读取来防止磁盘寻道.
# 如果你增高此值,可以提高很多 ORDER BY 的性能.
# 当需要时由每个线程分配
7) sort_buffer_size = 2097152
# 此缓冲被使用来优化全联合(FULL JOINS 不带索引的联合).
# 类似的联合在极大多数情况下有非常糟糕的性能表现,但是将此值设大能够减轻性能影响.
# 通过 “Select_full_join” 状态变量查看全联合的数量
# 当全联合发生时,在每个线程中分配
8) join_buffer_size = 1048576
# 所有线程所打开表的数量.
# 增加此值就增加了 mysqld 所需要的文件描述符的数量
# 这样你需要确认在 [mysqld_safe] 中 “open-files-limit” 变量设置打开文件数量允许至少等于 table_cache 的值
9) table_open_cache = 100
# 独立的内存表所允许的最大容量.
# 此选项为了防止意外创建一个超大的内存表导致永尽所有的内存资源.
10) max_heap_table_size = 67108864
# 内部(内存中)临时表的最大大小
# 如果一个表增长到比此值更大,将会自动转换为基于磁盘的表.
# 此限制是针对单个表的,而不是总和.
11) tmp_table_size = 262144
# 我们在 cache 中保留多少线程用于重用
# 当一个客户端断开连接后,如果 cache 中的线程还少于 thread_cache_size,则客户端线程被放入cache 中.
# 这可以在你需要大量新连接的时候极大的减少线程创建的开销
# (一般来说如果你有好的线程模型的话,这不会有明显的性能提升.)
12) thread_cache_size = 100
# 此允许应用程序给予线程系统一个提示在同一时间给予渴望被运行的线程的数量.
# 此值只对于支持 thread_concurrency() 函数的系统有意义( 例如Sun Solaris).
# 你可可以尝试使用 [CPU数量]*(2..4) 来作为 thread_concurrency 的值
13) thread_concurrency = 10
# 服务所能处理的请求包的最大大小以及服务所能处理的最大的请求大小(当与大的 BLOB 字段一起工作时相当必要)
# 每个连接独立的大小,大小动态增加
14) max_allowed_packet = 1073741824
# 在一个事务中 binlog 为了记录 SQL 状态所持有的 cache 大小
# 如果你经常使用大的,多声明的事务,你可以增加此值来获取更大的性能.
# 所有从事务来的状态都将被缓冲在 binlog 缓冲中然后在提交后一次性写入到 binlog 中
# 如果事务比此值大, 会使用磁盘上的临时文件来替代.
# 此缓冲在每个连接的事务第一次更新状态时被创建
15) binlog_cache_size = 1048576
# 只有小于此设定值的结果才会被缓冲
# 此设置用来保护查询缓冲,防止一个极大的结果集将其他所有的查询结果都覆盖.
16) query_cache_limit = 1048576
# 被全文检索索引的最小的字长.
# 你也许希望减少它,如果你需要搜索更短字的时候.
# 注意在你修改此值之后,你需要重建你的 FULLTEXT 索引
17) ft_min_word_len = 4
# 线程使用的堆大小. 此容量的内存在每次连接时被预留.
# MySQL 本身常不会需要超过 64K 的内存
# 如果你使用你自己的需要大量堆的 UDF 函数或者你的操作系统对于某些操作需要更多的堆,你也许需要将其设置的更高一点.
18) thread_stack = 262144
# 所有的使用了比这个时间(以秒为单位)更多的查询会被认为是慢速查询.
# 不要在这里使用“1″, 否则会导致所有的查询,甚至非常快的查询页被记录下来(由于 MySQL 目前时间的精确度只能达到秒的级别).
# 取值范围 [0.03-10]
19) long_query_time = 1
# 用来做 MyISAM 表全表扫描的缓冲大小.
# 当全表扫描需要时,在对应线程中分配.
20) read_buffer_size = 1048576
# MyISAM 使用特殊的类似树的 cache 来使得突发插入
# (这些插入是,INSERT … SELECT, INSERT … VALUES (…), (…), …, 以及 LOAD DATA INFILE) 更快.
# 此变量限制每个进程中缓冲树的字节数.
# 设置为 0 会关闭此优化.
# 为了最优化不要将此值设置大于 “key_buffer_size”.
# 当突发插入被检测到时此缓冲将被分配.
21) bulk_insert_buffer_size = 4194304
#*** MyISAM 相关选项
# 此缓冲当 MySQL 需要在 REPAIR, OPTIMIZE, ALTER 以及 LOAD DATA INFILE 到一个空表中引起重建索引时被分配.
# 这在每个线程中被分配.所以在设置大值时需要小心.
22) myisam_sort_buffer_size= 262144
#*** MyISAM 相关选项
# MySQL 重建索引时所允许的最大临时文件的大小 (当 REPAIR, ALTER TABLE 或者 LOAD DATA INFILE).
# 如果文件大小比此值更大,索引会通过键值缓冲创建(更慢)
23) myisam_max_sort_file_size = 2097152
#*** MyISAM 相关选项
# 如果一个表拥有超过一个索引, MyISAM 可以通过并行排序使用超过一个线程去修复他们.
# 这对于拥有多个 CPU 以及大量内存情况的用户,是一个很好的选择.
24) myisam_repair_threads = 1
# *** INNODB 相关选项 ***
# InnoDB使用一个缓冲池来保存索引和原始数据, 不像 MyISAM.
# 这里你设置越大,这能保证你在大多数的读取操作时使用的是内存而不是硬盘,在存取表里面数据时所需要的磁盘 I/O 越少.
# 在一个独立使用的数据库服务器上,你可以设置这个变量到服务器物理内存大小的80%
# 不要设置过大,否则,由于物理内存的竞争可能导致操作系统的换页颠簸.
# 注意在32位系统上你每个进程可能被限制在 2-3.5G 用户层面内存限制,
# 所以不要设置的太高.
25) innodb_buffer_pool_size = 10066329600
# InnoDB 将数据保存在一个或者多个数据文件中成为表空间.
# 如果你只有单个逻辑驱动保存你的数据,一个单个的自增文件就足够好了.
# 其他情况下.每个设备一个文件一般都是个好的选择.
# 你也可以配置 InnoDB 来使用裸盘分区 – 请参考手册来获取更多相关内容
26) innodb_data_file_path = ibdata1:200M:autoextend
# 如果你发现 InnoDB 表空间损坏, 设置此值为一个非零值可能帮助你导出你的表.
# 从1开始并且增加此值知道你能够成功的导出表.
27) innodb_force_recovery = 0
# 在 InnoDb 核心内的允许线程数量.
# 最优值依赖于应用程序,硬件以及操作系统的调度方式.
# 过高的值可能导致线程的互斥颠簸.
28) innodb_thread_concurrency = 0
# 如果设置为1 ,InnoDB 会在每次提交后刷新(fsync)事务日志到磁盘上,
# 这提供了完整的 ACID 行为.
# 如果你愿意对事务安全折中, 并且你正在运行一个小的事物, 你可以设置此值到0或者2来减少由事务日志引起的磁盘I/O
# 0代表日志只大约每秒写入日志文件并且日志文件刷新到磁盘.
# 2代表日志写入日志文件在每次提交后,但是日志文件只有大约每秒才会刷新到磁盘上.
#(说明:如果是游戏服务器,建议此值设置为2;
# 如果是对数据安全要求极高的应用,建议设置为1;
# 设置为0性能最高,但如果发生故障,数据可能会有丢失的危险!
# 默认值1的意思是每一次事务提交或事务外的指令都需要把日志写入(flush)硬盘,这是很费时的。特别是使用电池供电缓存(Battery backed up cache)时。
# 设成2对于很多运用,特别是从MyISAM表转过来的是可以的,它的意思是不写入硬盘而是写入系统缓存。日志仍然会每秒flush到硬盘,所以你一般不会丢失超过1-2秒的更新。
# 设成0会更快一点,但安全方面比较差,即使MySQL挂了也可能会丢失事务的数据。而值2只会在整个操作系统挂了时才可能丢数据。)
29) innodb_flush_log_at_trx_commit = 1
# 加速 InnoDB 的关闭. 这会阻止 InnoDB 在关闭时做全清除以及插入缓冲合并.
# 这可能极大增加关机时间, 但是取而代之的是 InnoDB 可能在下次启动时做这些操作.
30) innodb_fast_shutdown = 1
# 用来缓冲日志数据的缓冲区的大小.
# 当此值快满时, InnoDB 将必须刷新数据到磁盘上.
# 由于基本上每秒都会刷新一次,所以没有必要将此值设置的太大(甚至对于长事务而言)
31) innodb_log_buffer_size = 8388608
# 在日志组中每个日志文件的大小.
# 你应该设置日志文件总合大小到你缓冲池大小的25%~100%
# 来避免在日志文件覆写上不必要的缓冲池刷新行为.
# 不论如何, 请注意一个大的日志文件大小会增加恢复进程所需要的时间.
32) innodb_log_file_size = 1572864000
# 在日志组中的文件总数.
# 通常来说2~3是比较好的.
33) innodb_log_files_in_group = 2
# 在 InnoDB 缓冲池中最大允许的脏页面的比例.
# 如果达到限额, InnoDB 会开始刷新他们防止他们妨碍到干净数据页面.
# 这是一个软限制,不被保证绝对执行.
34) innodb_max_dirty_pages_pct = 75
# INNODB会自动维护后台作业自动从buffer pool当中清除脏数据,
# 当buffer pool中的脏页占用比 达到innodb_max_dirty_pages_pct_lwm的设定值的时候,就会自动将脏页清出buffer pool
35) innodb_max_dirty_pages_pct_lwm = 0
# 在被回滚前,一个 InnoDB 的事务应该等待一个锁被批准多久.
# InnoDB 在其拥有的锁表中自动检测事务死锁并且回滚事务.
# 如果你使用 LOCK TABLES 指令, 或者在同样事务中使用除了 InnoDB 以外的其他事务安全的存储引擎
# 那么一个死锁可能发生而 InnoDB 无法注意到.
# 这种情况下这个 timeout 值对于解决这种问题就非常有帮助.
36) innodb_lock_wait_timeout = 50
# 这项设置告知InnoDB是否需要将所有表的数据和索引存放在共享表空间里(innodb_file_per_table = OFF) 或者为每张表的数据单独放在一个.ibd文件(innodb_file_per_table = ON)
# 每张表一个文件允许你在drop、truncate或者rebuild表时回收磁盘空间
# 这对于一些高级特性也是有必要的,比如数据压缩,但是它不会带来任何性能收益
37) innodb_file_per_table = ON
文章参考来源:
http://blog.csdn.net/wlzx120/article/details/52301383
https://yq.aliyun.com/articles/38255?spm=5176.100240.searchblog.78.qOy6bB
https://yq.aliyun.com/articles/3541?spm=5176.100240.searchblog.73.qOy6bB
https://yq.aliyun.com/articles/54696?spm=5176.100240.searchblog.63.qOy6bB
https://yq.aliyun.com/articles/5893?spm=5176.100240.searchblog.58.qOy6bB
https://yq.aliyun.com/articles/75306?spm=5176.100240.searchblog.8.qOy6bB
https://yq.aliyun.com/articles/74566?spm=5176.100240.searchblog.70.mlrtrX
http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858810.html