Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

So I have a site that has a crap ton of traffic. I see a decent amount of latency when the site has over 1,000 active visitors on it. I have new relic installed and it seems Im only using 10% of the physical memory. The site is running on wordpress. I am using memcache, apc, and w3 Total cache. I am now my 3rd server upgrade and its as follows:

  • Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz x 24
  • 16GB DDR3 SDRAM
  • 2 x SATA Software RAID1 (7,200 rpm)
  • 120GB Kingston Hyper-X SSD (mysql drive)

Here are the results of tuning-primer

     -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.6.17-log x86_64

Uptime = 0 days 23 hrs 24 min 38 sec
Avg. qps = 81
Total Questions = 6834930
Threads Connected = 9

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 1.000000 sec.
You have 0 out of 6834954 that take longer than 1.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.6/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 200
Current threads_cached = 38
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 9
Historic max_used_connections = 45
The number of used connections is 45% of the configured maximum.
Your max_connections variable seems to be fine.

INNODB STATUS
Current InnoDB index space = 6 M
Current InnoDB data space = 84 M
Current InnoDB buffer pool free = 91 %
Current innodb_buffer_pool_size = 1.00 G
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 1.69 G
Configured Max Per-thread Buffers : 287 M
Configured Max Global Buffers : 1.56 G
Configured Max Memory Limit : 1.84 G
Physical Memory : 11.59 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 134 M
Current key_buffer_size = 500 M
Key cache miss rate is 1 : 6390
Key buffer free ratio = 80 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 64 M
Current query_cache_used = 13 M
Current query_cache_limit = 28 M
Current Query cache Memory fill ratio = 21.23 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 260.00 K
You have had 65 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 1024 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 457 tables
Current table_definition_cache = 628 tables
You have a total of 240 tables
You have 281 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 512 M
Current tmp_table_size = 512 M
Of 3216 temp tables, 32% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 0 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 6835375
Your table locking seems to be fine

and here is the mysqltuner

 >>  MySQLTuner 1.3.0 - Major Hayden <major@mhtx.net>
 >>  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.6.17-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 838M (Tables: 23)
[--] Data in InnoDB tables: 82M (Tables: 136)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 52)
[!!] Total fragmented tables: 2

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 23h 28m 17s (6M q [81.204 qps], 824K conn, TX: 847M, RX: 469M)
[--] Reads / Writes: 98% / 2%
[--] Total buffers: 2.1G global + 2.9M per thread (100 max threads)
[OK] Maximum possible memory usage: 2.3G (20% of installed RAM)
[OK] Slow queries: 0% (0/6M)
[OK] Highest usage of available connections: 45% (45/100)
[OK] Key buffer size / total MyISAM indexes: 500.0M/134.8M
[OK] Key buffer hit rate: 100.0% (1M cached / 172 reads)
[OK] Query cache efficiency: 37.4% (1M cached / 2M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (9 temp sorts / 2K sorts)
[!!] Temporary tables created on disk: 32% (1K on disk / 4K total)
[OK] Thread cache hit rate: 99% (45 created / 824K connections)
[OK] Table cache hit rate: 34% (281 open / 804 opened)
[OK] Open file limit used: 11% (113/1K)
[OK] Table locks acquired immediately: 100% (47K immediate / 47K locks)
[OK] InnoDB buffer pool / data size: 1.0G/82.8M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Temporary table size is already large - reduce result set size
    Reduce your SELECT DISTINCT queries without LIMIT clauses

And here is my my.cnf config

####################################
###########################################################
### Begin MySQL Server 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

## General Settings ##
tmpdir                                  = /tmp
skip_external_locking

## Performance and Capacity Settings##
max_connections  = 100
query_cache_size = 64M
query_cache_type = 1
query_cache_limit = 28M
thread_cache_size = 200
max_heap_table_size = 512M
tmp_table_size =  512M
###########################################################
###########################################################
## Good starting points are 64M, then double this value as RAM doubles. 1GB RAM = 64M, 2GB = 128M, 4GB = 256M. Should not be set higher than 4GB( can be removed from the deployed version of the file, just added this comment to explain how this should scale)

key_buffer_size                         = 500M

## Good starting points are 64M, then double this value as RAM doubles. 1GB RAM = 64M, 2GB = 128M, 4GB = 256M, etc, etc (can be removed from the deployed version of the file, just added this comment to explain how this should scale)

innodb_buffer_pool_size                 = 1G

###########################################################
###########################################################

## Misc settings that can be changed if you have a reason to change them, otherwise these should be good starting points ##
max_allowed_packet=268435456
table_open_cache                        = 512M
sort_buffer_size                        = 2M
myisam_sort_buffer_size                 = 4M


## If ACID compliant transactions are not required, this can be changed to either 0 or 2 for better performance at the risk of transaction loss.
#innodb_flush_log_at_trx_commit          = 1

innodb_log_buffer_size                  = 8M
innodb_file_per_table=1

## Changing this setting requires you to stop MySQL, move the current logs out of the way, and then starting MySQL ##
innodb_log_file_size                    = 512M

## Diagnostics ##
slow_query_log                          = 1
slow_query_log_file                     = /var/log/mysql-slow.log
long_query_time                         = 1

Any tips on how to increase performance would be awesome!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.