Please help me to optimize mysql (my.cnf)
Hello, I would like to help me set up my mysql, weekends have increased visits and the server restarts for excessive CPU usage.
Thanks in advanced.
Technical details of my VPS:
CENTOS 6.5 x86_64 virtuozzo " vps
Total processors: 4
Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
Speed
2000.195 MHz
Cache
15360 KB
(x 4 processors)
Mysql DataBase 5.1.73-cll
PHP Version 5.3.28
Web Server Apache
WebServer PHP Interface cgi-fcgi
Current Memory Usage
total used free shared buffers cached
Mem: 2097152 1938724 158428 0 0 1669088
-/+ buffers/cache: 269636 1827516
Swap: 4194304 437680 3756624
Total: 6291456 2376404 3915052
Current my.cnf file
mysqltuner.pl output
Thanks in advanced.
[mysqld]
innodb_file_per_table=1
open_files_limit=10192
query_cache_size=16M
join_buffer_size=128K
tmp_table_size=32M
max_heap_table_size=32M
thread_cache_size=4
table_open_cache=64mysqltuner.pl output
>> 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
[OK] Currently running supported MySQL version 5.1.73-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 24M (Tables: 254)
[--] Data in InnoDB tables: 1M (Tables: 72)
[--] Data in MEMORY tables: 0B (Tables: 2)
[!!] Total fragmented tables: 8
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 3d 14h 6m 28s (16M q [51.946 qps], 171K conn, TX: 24B, RX: 2B)
[--] Reads / Writes: 63% / 37%
[--] Total buffers: 66.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 481.2M (23% of installed RAM)
[OK] Slow queries: 0% (0/16M)
[OK] Highest usage of available connections: 14% (22/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/9.1M
[OK] Key buffer hit rate: 100.0% (105M cached / 12K reads)
[OK] Query cache efficiency: 95.7% (14M cached / 15M selects)
[!!] Query cache prunes per day: 4128
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 83K sorts)
[!!] Joins performed without indexes: 8854
[!!] Temporary tables created on disk: 43% (151K on disk / 347K total)
[OK] Thread cache hit rate: 99% (1K created / 171K connections)
[!!] Table cache hit rate: 0% (64 open / 13K opened)
[OK] Open file limit used: 1% (111/10K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
[OK] InnoDB buffer pool / data size: 8.0M/1.1M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Increase table_open_cache gradually to avoid file descriptor limits
Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
query_cache_size (> 16M)
join_buffer_size (> 128.0K, or always use indexes with joins)
tmp_table_size (> 32M)
max_heap_table_size (> 32M)
table_open_cache (> 64)
Thanks in advanced.
-
[quote="touringxx, post: 1693341">weekends have increased visits and the server restarts for excessive CPU usage.
Hello :) I just wanted to note that if your server is restarting for excessive CPU usage, then you may have a more serious problem. How high is the load reaching? What do you notice in /var/log/dmesg when the server restarts? Thank you.0 -
Hello, thanks for your answer, again a few hours ago was reset automatically. This is the current state of the server: Current Time: Thursday, 24-Jul-2014 11:54:02 UYT Restart Time: Thursday, 24-Jul-2014 00:27:11 UYT Parent Server Generation: 6 Server uptime: 11 hours 26 minutes 51 seconds Total accesses: 126290 - Total Traffic: 399.4 MB CPU Usage: u.32 s.7 cu91.06 cs0 - .223% CPU load 3.06 requests/sec - 9.9 kB/second - 3316 B/request 4 requests currently being processed, 9 idle workers Daily Process Log You have 4 CPUs; therefore, these CPU percentages are divided by 4 to indicate the true percentage of all CPU power used. User Domain % CPU % MEM MySQL Processes myuseer mydomain.com 5.83 1.78 0.5 root 0.45 4.75 2.0 mysql 0.21 1.90 0.0 User Domain % CPU Process Top Processes mysuer mydomain.com 95.6 /usr/bin/php /home/myuser/public_html/index.php myuser mydomain.com 92.0 /usr/bin/php /home/mysuer/public_html/index.php Try to see the output of dmesg with: "dmesg | less" and appears to be empty I only see these symbols (~) How can I fix this?, What adjustments can I do in the my.cnf file? Thanks in advanced. 0
Please sign in to leave a comment.
Comments
2 comments