Mysql – Tuning dedicated Percona Server with XtraDB for OLTP

innodbMySQLpercona-servertuningxtradb

Hardware specs for an OLTP DB

  • dual quad core xeon with hyperthreading
  • 24GB ram
  • Hardware RAID10 BBU

Software specs

  • Standard install of Ubuntu 10.04LTS with default LVM partitioning
  • Installed Percona Server with XtraDB

My priority is data integrity/protection followed closely by performance.

QUESTIONS

  • Are there settings in the RAID card that should be or should not be set? Since I have BBU, write-back should be set right?
  • Is ext4 ok or should I create a separate xfs volume for the data?
  • What should the kernel scheduler be set to? noop? deadline?
  • Are there other settings that I should tweak at the Hardware/OS/Filesystem level?

Best Answer

When I head the word 'Percona Server', the first thing that jumps at me is : "Does the DB Server have multiple CPUs?" These days, that is taken for granted. What is unfortunate is that most people forget to configure MySQL or Percona Server to summon those multiple CPUs.

MySQL 5.1 with InnoDB 5.1 Plugin, MySQL 5.5 and Percona Server have options to increase threading. Here are those options along with other InnoDB features you may wish to tune:

innodb_thread_concurrency sets the upper bound on number of concurrent threads that InnoDB can hold open. Best round number to set for this is (2 X Number of CPUs) + Number of Disks. As I learned firsthand from the Percona NYC Conference back in May 2011, you should set this to 0 in order to alert InnoDB Storage Engine to find the best number of threads for the environment it is running in.

innodb_concurrency_tickets sets the number of threads that can bypass concurrency checking with impunity. After that limit is reached, thread concurrency checking becomes the norm again.

innodb_commit_concurrency sets the number of concurrent transactions that can be committed. Since the default is 0, not setting this allows any number of transactions to commit simultaneously.

innodb_thread_sleep_delay sets the number of milliseconds an InnoDB thread can be dormant before reentering the InnoDB queue. Default is 10000 (10 sec).

innodb_read_io_threads and innodb_write_io_threads (both since MySQL 5.1.38) allocate the specified number of threads for reads and writes. Default is 4 and maximum is 64.

innodb_replication_delay imposes thread delay on a slave is innodb_thread_concurrency is reached.

innodb_read_ahead_threshold allows linear readings of the set number of extents (64 pages [page = 16K]) before switching to asynchronous reading.

Time would escape me if I named more options. You can read about them in MySQL's Documentation.

Switching gears to RAID: Please stick with your RAID10. It is easier to maintain other redundant setups, especially RAID5.. Also, make sure you have the latest firmware for your RAID card. Otherwise, RAID firmware may conflict with the OS kernel resulting either in disk crashes or lower overall throughput.

As for Is ext4 ok or should I create a separate xfs volume for the data?, keep in mind that ext3 places a max size limit of 2TB per file. If you are not dealing with TBs of data, don't sweat using ext3 or ext4.

A separate data volume would increase disk performance since mysqld will not compete with the OS.