我的数据库大小为13.4Gb。该服务器具有32 GB的RAM。
但是查询类型选择仍然很慢。
我启动了mysqltuner,他发出了以下消息:
-------- Performance Metrics -------------------------------------------------
[--] Up for: 5s (9 q [1.800 qps], 7 conn, TX: 17K, RX: 1K)
[--] Reads / Writes: 100% / 0%
[--] Binary logging is disabled
[--] Total buffers: 24.5G global + 392.4M per thread (64 max threads)
[OK] Maximum reached memory usage: 24.9G (79.27% of installed RAM)
[!!] Maximum possible memory usage: 49.0G (156.10% of installed RAM)
[OK] Slow queries: 0% (0/9)
[OK] Highest usage of available connections: 1% (1/64)
[!!] Aborted connections: 14.29% (1/7)
[!!] Query cache efficiency: 0.0% (0 cached / 4 selects)
[OK] Query cache prunes per day: 0
[OK] Temporary tables created on disk: 0% (0 on disk / 2 total)
[OK] Thread cache hit rate: 85% (1 created / 7 connections)
[OK] Table cache hit rate: 93% (100 open / 107 opened)
[OK] Open file limit used: 0% (15/1M)
[OK] Table locks acquired immediately: 100% (100 immediate / 100 locks)
-------- InnoDB Metrics -----------------------------------------------------
[--] InnoDB is enabled.
[OK] InnoDB buffer pool / data size: 23.4G/13.4G
[!!] InnoDB buffer pool instances: 24
[!!] InnoDB Used buffer: 0.03% (414 used/ 1535976 total)
[!!] InnoDB Read buffer efficiency: 79.34% (1463 hits/ 1844 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[OK] InnoDB log waits: 0.00% (0 waits / 2 writes)
我具有以下服务器mysql配置:
key_buffer_size = 1024M
sort_buffer_size = 256M
max_allowed_packet = 1024M
read_buffer_size = 8M
read_rnd_buffer_size = 128M
thread_stack = 128K
query_cache_limit = 1M
query_cache_size = 8M
query_cache_type = 1
thread_cache_size = 16
max_heap_table_size = 128M
tmp_table_size = 64M
net_read_timeout = 3600
net_write_timeout = 3600
wait_timeout = 120
interactive_timeout = 120
table_open_cache = 1024M
#join_buffer_size=2048M
max_connections = 64
innodb_open_files = 4096
innodb_file_per_table = 1
innodb_flush_method=O_DIRECT
innodb_flush_log_at_trx_commit=2
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
innodb_buffer_pool_size=24000M
innodb_buffer_pool_instances=24
innodb_buffer_pool_chunk_size = 500M
#innodb_additional_mem_pool_size = 20M
#innodb_thread_concurrency = 16
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_stats_on_metadata = 0
#innodb_io_capacity=2000
innodb_data_file_path=ibdata1:10M:autoextend
能否请您告诉我如何正确纠正以下错误并提高从数据库采样的速度?
[!!] InnoDB buffer pool instances: 24
[!!] InnoDB Used buffer: 0.03% (414 used/ 1535976 total)
[!!] InnoDB Read buffer efficiency: 79.34% (1463 hits/ 1844 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[!!] Maximum possible memory usage: 49.0G (156.10% of installed RAM)
[!!] Aborted connections: 14.29% (1/7)
P.S。我不使用索引,因为它会增加查询超时并增加数据库的大小。
答案 0 :(得分:1)
我可能会在这里留下所有有助于解决此问题的有用答案。
如果需要快速键入请求-选择,则需要牺牲磁盘的大小。
正确的数据库结构将避免复杂的查询并提高性能。
我无法挑出一条对我有帮助的建议,因为它们都很好。
答案 1 :(得分:0)
有关my.cnf或my.ini [mysqld]部分的建议
max_connections=500 # from 1000 to conserve RAM - only 3 were used on this day
thread_cache_size=100 # from 16384 V8 indicated to CAP at 100
read_rnd_buffer_size=256K # from ~512K to reduce handler_read_rnd_next RPS
innodb_adaptive_hash_index=ON # from OFF to minimize deadlocks
innodb_buffer_pool_dump_pct=90 # from 25 for more WARM data at startup
innodb_buffer_pool_instances=8 # from 24 will be sufficient and conserve CPU
innodb_flushing_avg_loops=10 # from 30 to reduce loop delay
innodb_lru_scan_depth=128 # from 1024 to conserve CPU every second
innodb_page_cleaners=8 # from 24 for same as number of pool_instances
innodb_read_io_threads=64 # from 4 see dba.stackexchange Question 5666 9/12/11 entry
innodb_write_io_threads=64 # from 4 explained by RolandoMySQLDBA in Q 5666
innodb_thread_concurrency=0 # from 4 also explained by Rolando
open_files_limit=30000 # from ~1 Million - for a reasonable limit
query_cache_limit=0 # conserve RAM since QC is NOT being USED - and that is GOOD
要获取更多帮助,请查看我的个人资料,网络个人资料以获取联系信息(包括Skype ID)并取得联系。
请在几天/几周内让我们知道您的进度。