Reputation: 13
What is the recommended configuration for server dedicated 128 GB of RAM
my.cnf
[mysqld]
datadir="/home/mysql"
default-storage-engine=MyISAM
innodb_file_per_table=1
max_allowed_packet=268435456
innodb_buffer_pool_size = 94G
innodb_buffer_pool_instances = 12
innodb_open_files=20000
innodb_io_capacity=10000
innodb_io_capacity_max=25000
innodb_read_io_threads=8
innodb_write_io_threads=8
innodb_flush_log_at_trx_commit=2
innodb_max_dirty_pages_pct = 90
open_files_limit=100000
interactive_timeout=60
wait_timeout=60
max_connections=20000
max_connect_errors=20000
tmp_table_size=1G
max_heap_table_size=1G
# MyISAM
key_buffer_size = 1G
join_buffer_size = 10M
sort_buffer_size=256K
read_buffer_size=64K
read_rnd_buffer_size=256K
slow-query-log
table_open_cache = 5000
query_cache_type = 1
query_cache_limit = 10M
query_cache_min_res_unit = 1M
query_cache_size = 256M
thread_cache_size = 4
skip_name_resolve=ON
MySQLTuning:
>> MySQLTuner 1.4.0 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[!!] Currently running unsupported MySQL version 10.0.17-MariaDB-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +Aria +BLACKHOLE +CSV +FEDERATED +InnoDB +MRG_MyISAM
[--] Data in MyISAM tables: 603M (Tables: 470)
[--] Data in InnoDB tables: 93G (Tables: 563)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 52)
[--] Data in MEMORY tables: 60K (Tables: 3)
[!!] Total fragmented tables: 216
-------- Performance Metrics -------------------------------------------------
[--] Up for: 16h 58m 38s (22M q [366.226 qps], 920K conn, TX: 8B, RX: 1B)
[--] Reads / Writes: 35% / 65%
[--] Total buffers: 96.1G global + 10.8M per thread (20000 max threads)
[!!] Maximum possible memory usage: 307.9G (244% of installed RAM)
[OK] Slow queries: 0% (0/22M)
[OK] Highest usage of available connections: 0% (106/20000)
[OK] Key buffer size / total MyISAM indexes: 1.0G/589.3M
[OK] Key buffer hit rate: 99.7% (28M cached / 74K reads)
[OK] Query cache efficiency: 22.8% (1M cached / 6M selects)
[!!] Query cache prunes per day: 1568144
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 46K sorts)
[OK] Temporary tables created on disk: 5% (3K on disk / 66K total)
[OK] Thread cache hit rate: 98% (14K created / 920K connections)
[OK] Table cache hit rate: 104% (1K open / 1K opened)
[OK] Open file limit used: 1% (1K/100K)
[OK] Table locks acquired immediately: 99% (14M immediate / 14M locks)
[OK] InnoDB buffer pool / data size: 94.0G/93.2G
[OK] InnoDB log waits: 0
i have a big databases my cpu usage:
https://i.sstatic.net/4azch.png
https://i.sstatic.net/mm7oZ.png
and have 5k users
the querys :
SELECT * FROM users ORDER BY RAND();
is very slow have +900k rows in users
Upvotes: 0
Views: 2320
Reputation: 13
Something?
[mysqld]
datadir = "/home/mysql"
default-storage-engine = MyISAM
innodb_file_per_table = 1
max_allowed_packet = 268435456
innodb_buffer_pool_size = 94G
innodb_buffer_pool_instances = 12
innodb_open_files = 20000
innodb_io_capacity = 10000
innodb_io_capacity_max = 25000
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_flush_log_at_trx_commit = 2
innodb_max_dirty_pages_pct = 90
open_files_limit = 100000
interactive_timeout = 60
wait_timeout = 60
max_connections = 20000
max_connect_errors = 20000
tmp_table_size = 60M
max_heap_table_size = 60M
# MyISAM
key_buffer_size = 1G
join_buffer_size = 10M
sort_buffer_size = 256K
read_buffer_size = 64K
read_rnd_buffer_size = 256K
slow-query-log
table_open_cache = 5000
query_cache_type = 1
query_cache_limit = 10M
query_cache_min_res_unit = 1M
query_cache_size = 512M
log_queries_not_using_indexes = 0
long_query_time = 2
thread_cache_size = 4
skip_name_resolve = ON
Upvotes: 0
Reputation: 142258
The value is bogus. It is computed from a combination of worst case situations. And it does not even include all the cases!
This, however, is ludicrous:
max_connections = 20000 [OK] Highest usage of available connections: 0% (106/20000)
Rarely is even 2000 a sensible number. Lower it. If you do hit max_connections, then there are problems elsewhere. Anyway, notice that Max_used_connections is only 106. (106 is kinda high, but not necessarily a problem.)
tmp_table_size=1G max_heap_table_size=1G
If you were running 20K SELECTs, each of which needed 3 tmp tables, that could add up to 60TB of RAM being needed! So, lower these two settings as extra protection against blowing out RAM. Swapping is terrible for MySQL.
[!!] Total fragmented tables: 216
Ignore that; tables are often fragmented; taking action is not worth it.
[OK] Slow queries: 0% (0/22M)
Lower long_query_time to, say, 2 (seconds).
[!!] Query cache prunes per day: 1568144
Sounds like turning the Query cache ON (1) is hurting.
[OK] Key buffer size / total MyISAM indexes: 1.0G/589.3M
Seriously consider changing to InnoDB.
Upvotes: 1