简体   繁体   中英

Improving MySQL I/O Performance (Hardware & Partitioning)

I need to improve I/O performance for my database. I'm using the "2xlarge" HW described below & considering upgrading to the "4xlarge" HW ( http://aws.amazon.com/ec2/instance-types/ ). Thanks for the help!

Details:

CPU usage is fine (usually under 30%), uptime load averages anywhere from 0.5 to 2.0 (but I believe I'm supposed to divide that by the number of CPU's) so that looks okay as well. However, the I/O is bad: iostat show favorable service times, but the time spent in queue (I suppose this means waiting to access the disk) is far too high. I've configured MySQL to flush to disk every 1sec instead of every write, which helps, but not enough. Profiling shows there are a handful of tables that are the culprits for most of the load (both read && write operations). Queries are already indexed & optimized, but not partitioned. Average MySQL states are: Sending Data @ 45%, statistics @ 20%, Updating @ 15%, Sorting result @ 8%.

Questions:

  1. How much performance will I get by upgrading HW?
  2. Same question, but if I partition the high-load tables?

Machines:

  • m2.2xlarge

    • 64-bit
    • 4 vCPU
    • 13 ECU
    • 34.2 Gb Mem
    • EBS-Optimized
    • Network Performance: "Moderate"
  • m2.4xlarge

    • 64-bit
    • 6 vCPU
    • 26 ECU
    • 68.4 Gb Mem
    • EBS-Optimized
    • Network Performance: "High"

In my experience, the biggest boost in MySQL performance comes from IO. You have alot of RAM. Try setting up a ram drive and point the tmpdir to it.

I have several MySQL servers that are very busy. My settings are below - maybe this can help you tweak your settings.

My Setup is: -Dual 2.66 CPU 8 core box with a 6-drive Raid-1E array - 1.3TB. -innodblogs on a separate SSD drives. -tmpdir is on a 2GB tempfs partition. -32GB of ram

InnoDB settings:

innodb_thread_concurrency=16
innodb_buffer_pool_size = 22G
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 400M
innodb_log_files_in_group=8
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2 (This is a slave machine - 1 is not required fo my purposes) 
innodb_flush_method=O_DIRECT

Current Queries per second avg: 5185.650

I am using Percona Server, which is quite a bit faster that other MySQLs from my testing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM