PHP & MySQL Performance Tweaks

PHP


MySQL

  1. Grab your total memory

    grep MemTotal /proc/meminfo
  2. Take that number and convert it to GB: https://www.google.com/search?q=kb+to+mb&oq=kb+to+mb

  3. Take 80% of that, use this in the innodb_buffer_pool_size below

  4. Edit the MySQL config

    sudo nano /etc/mysql/my.cnf
  5. Put these settings at the bottom

    open_files_limit = 6144
    innodb_autoinc_lock_mode = 2
    innodb_read_io_threads = 16
    innodb_spin_wait_delay = 24
    innodb_sync_spin_loops = 200
    innodb_write_io_threads = 16
    innodb_buffer_pool_size = 0.8G // OR WHATEVER YOU CAME UP WITH IN #3
    innodb_lock_wait_timeout = 20
    query_cache_type = 0
    table_definition_cache = 600
    thread_cache_size = 19
    tx_isolation='READ-COMMITTED'
    wait_timeout = 600
    join_buffer_size = 8388608
    read_rnd_buffer_size = 8388608