Нашел хороший и быстрый способ оптимизации работы баз данных mysql.
Есть очень хороший скрипт на перл, который позволяет узнать, что вам нужно оптимизировать в настройках, дабы у вас все было очень круто.
Закачать его можно вот так:
wget http://mysqltuner.pl/
Затем запускаем
perl mysqltuner.pl
Скрипт запросит рут-доступ к вашему серверу БД. Дайте ему то, что он просит.
Вот выдача скрипта с моего компа:
:~$ perl mysqltuner.pl
>> MySQLTuner 1.0.1 — Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with ‘—help’ for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
——— General Statistics —————————————————
[—] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.37-1ubuntu5.1
[OK] Operating on 32-bit architecture with less than 2GB RAM
——— Storage Engine Statistics ——————————————-
[—] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[—] Data in MyISAM tables: 2M (Tables: 537)
[!!] InnoDB is enabled but isn’t being used
[!!] Total fragmented tables: 16
——— Performance Metrics ————————————————-
[—] Up for: 5h 55m 1s (1K q [0.081 qps], 577 conn, TX: 144K, RX: 106K)
[—] Reads / Writes: 100% / 0%
[—] Total buffers: 58.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 463.8M (24% of installed RAM)
[OK] Slow queries: 0% (0/1K)
[OK] Highest usage of available connections: 1% (2/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/2.5M
[!!] Query cache efficiency: 0.0% (0 cached / 1K selects)
[OK] Query cache prunes per day: 0
[OK] Temporary tables created on disk: 24% (48 on disk / 200 total)
[OK] Thread cache hit rate: 99% (2 created / 577 connections)
[!!] Table cache hit rate: 1% (64 open / 3K opened)
[OK] Open file limit used: 12% (128/1K)
[OK] Table locks acquired immediately: 100% (579 immediate / 579 locks)
——— Recommendations ——————————————————
General recommendations:
Add skip-innodb to MySQL configuration to disable InnoDB
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours — recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_limit (> 1M, or use smaller result sets)
table_cache (> 64)
Удачной оптимизации товарищи.