Memcashe can help you but try to optimize it for dynamic content.
Also can you give us the output of the file my.cnf
in terminal type : cat /etc/my.cnf
As default you will have something like this :
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
My recommendation is that you install mysqltuner :
yum install mysqltuner
and when you run it (just type mysqltuner in terminal) you will get something like this:
>> MySQLTuner 1.1.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
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.73
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 2K (Tables: 19)
[--] Data in InnoDB tables: 224K (Tables: 14)
[!!] Total fragmented tables: 14
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 15d 17h 44m 2s (153K q [0.113 qps], 66K conn, TX: 9M, RX: 8M)
[--] Reads / Writes: 99% / 1%
[--] Total buffers: 34.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 449.2M (23% of installed RAM)
[OK] Slow queries: 0% (0/153K)
[OK] Highest usage of available connections: 5% (8/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/122.0K
[!!] Key buffer hit rate: 75.0% (20 cached / 5 reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 120 sorts)
[!!] Temporary tables created on disk: 36% (1K on disk / 3K total)
[!!] Thread cache is disabled
[!!] Table cache hit rate: 11% (64 open / 552 opened)
[OK] Open file limit used: 5% (55/1K)
[OK] Table locks acquired immediately: 100% (14K immediate / 14K locks)
[OK] InnoDB data size / buffer pool: 224.0K/8.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Set thread_cache_size to 4 as a starting value
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
>> MySQLTuner 1.1.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
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.73
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 2K (Tables: 19)
[--] Data in InnoDB tables: 224K (Tables: 14)
[!!] Total fragmented tables: 14
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 15d 17h 44m 2s (153K q [0.113 qps], 66K conn, TX: 9M, RX: 8M)
[--] Reads / Writes: 99% / 1%
[--] Total buffers: 34.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 449.2M (23% of installed RAM)
[OK] Slow queries: 0% (0/153K)
[OK] Highest usage of available connections: 5% (8/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/122.0K
[!!] Key buffer hit rate: 75.0% (20 cached / 5 reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 120 sorts)
[!!] Temporary tables created on disk: 36% (1K on disk / 3K total)
[!!] Thread cache is disabled
[!!] Table cache hit rate: 11% (64 open / 552 opened)
[OK] Open file limit used: 5% (55/1K)
[OK] Table locks acquired immediately: 100% (14K immediate / 14K locks)
[OK] InnoDB data size / buffer pool: 224.0K/8.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Set thread_cache_size to 4 as a starting value
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (>= 8M)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
thread_cache_size (start at 4)
table_cache (> 64) (>= 8M)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
thread_cache_size (start at 4)
table_cache (> 64)
As you can see its recommendation is to change query_cacshe_size :
so we edit /etc/my.cnf and add query_cache_size like this under mysqld section:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
query_cache_size = 128M
restart mysqld with command: service mysqld restart