Mysql Optimization
hi,
I have a VDS server with Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz and 8 GB memory.
One of my website have a INSERT and POST queries to another website's API then i have to check result and UPDATE my database. There isn't any problem under 1000 queries but when its larger then 1000, mysql stuck, give me "too many connections" error and need restart :/
I know i have to wait at least 24 hours but i cant, i have restart mysql ( too many conn. ) after 1000 queries because of the other websites :/
This is mysqltuner.pl result;
and this is my.cnf, i found on the net then i try to optimize for my server settings :/
Thanks.
>> MySQLTuner 1.3.0 - Major Hayden
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[[0;32mOK[0m] Currently running supported MySQL version 5.5.36-cll
[[0;32mOK[0m] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[[0;34m--[0m] Status: [0;32m+ARCHIVE [0m[0;32m+BLACKHOLE [0m[0;32m+CSV [0m[0;31m-FEDERATED [0m[0;32m+InnoDB [0m[0;32m+MRG_MYISAM [0m
[[0;34m--[0m] Data in MyISAM tables: 110M (Tables: 605)
[[0;34m--[0m] Data in InnoDB tables: 65M (Tables: 272)
[[0;34m--[0m] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[[0;31m!![0m] Total fragmented tables: 78
-------- Security Recommendations -------------------------------------------
[[0;32mOK[0m] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[[0;34m--[0m] Up for: 1h 14m 10s (341K q [76.716 qps], 661 conn, TX: 306M, RX: 44M)
[[0;34m--[0m] Reads / Writes: 1% / 99%
[[0;34m--[0m] Total buffers: 656.0M global + 4.1M per thread (400 max threads)
[[0;32mOK[0m] Maximum possible memory usage: 2.3G (29% of installed RAM)
[[0;32mOK[0m] Slow queries: 0% (0/341K)
[[0;32mOK[0m] Highest usage of available connections: 25% (100/400)
[[0;32mOK[0m] Key buffer size / total MyISAM indexes: 256.0M/30.5M
[[0;32mOK[0m] Key buffer hit rate: 100.0% (1M cached / 397 reads)
[[0;32mOK[0m] Query cache efficiency: 72.6% (12K cached / 17K selects)
[[0;32mOK[0m] Query cache prunes per day: 0
[[0;32mOK[0m] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts)
[[0;32mOK[0m] Temporary tables created on disk: 2% (68 on disk / 2K total)
[[0;32mOK[0m] Thread cache hit rate: 84% (100 created / 661 connections)
[[0;32mOK[0m] Table cache hit rate: 81% (1K open / 1K opened)
[[0;32mOK[0m] Open file limit used: 25% (1K/4K)
[[0;32mOK[0m] Table locks acquired immediately: 99% (342K immediate / 342K locks)
[[0;32mOK[0m] InnoDB buffer pool / data size: 128.0M/65.0M
[[0;32mOK[0m] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------and this is my.cnf, i found on the net then i try to optimize for my server settings :/
[mysqld]
innodb_file_per_table=1
open_files_limit=4950
local-infile=0
max_connections = 400
max_user_connections=600
key_buffer_size = 256M
myisam_sort_buffer_size = 64M
read_buffer_size = 1M
table_open_cache = 2000
thread_cache_size = 384
wait_timeout = 20
connect_timeout = 10
tmp_table_size = 256M
max_heap_table_size = 128M
max_allowed_packet = 64M
net_buffer_length = 16384
max_connect_errors = 10
concurrent_insert = 2
read_rnd_buffer_size = 786432
bulk_insert_buffer_size = 8M
query_cache_limit = 5M
query_cache_size = 128M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65535
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
max_write_lock_count = 8
slow_query_log
log-error
external-locking=FALSE
[mysqld_safe]
[mysqldump]
quick
max_allowed_packet = 16M
[isamchk]
key_buffer = 384M
sort_buffer = 384M
read_buffer = 256M
write_buffer = 256M
[myisamchk]
key_buffer = 384M
sort_buffer = 384M
read_buffer = 256M
write_buffer = 256M
#### Per connection configuration ####
sort_buffer_size = 1M
join_buffer_size = 1M
thread_stack = 192K
Thanks.
-
I just wanted to point out that you can find more information about the "Too Many Connections" error message here: [url=http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html]MySQL :: MySQL 5.5 Reference Manual :: C.5.2.7 Too many connections Thank you. 0
Please sign in to leave a comment.
Comments
1 comment