title: MySQL Optimization - Need advices
body: <p>I have a CentOS 7 VM with 32 GB RAM (4 cores/8 threads) 3.4 GHz+
  I ran the MySQLTuner script, and followed the recommendations that they gave, but it's still very slow</p>
  
  <p>My current config in my my.cnf file is:</p>
  
  <pre><code>[mysqld]
  local-infile=0
  datadir=/var/lib/mysql
  socket=/var/lib/mysql/mysql.sock
  
  symbolic-links=0
  
  key_buffer        = 32M
  max_allowed_packet    = 268435456
  thread_stack        = 192K
  thread_cache_size       = 384
  key_buffer_size=32G
  max_connections = 1200
  max_user_connections=1000
  table_open_cache=3000
  table_open_cache=5000
  table_definition_cache=2048
  sort_buffer_size=32M
  join_buffer_size = 32M
  read_buffer_size=32M
  wait_timeout=20
  read_rnd_buffer_size=786432
  bulk_insert_buffer_size = 8M
  
  myisam_sort_buffer_size=64M
  query_cache_size=128M
  query_cache_limit=8M
  query_cache_type = 1
  query_prealloc_size = 262144
  query_alloc_block_size = 65535
  transaction_alloc_block_size = 8192
  transaction_prealloc_size = 4096
  max_write_lock_count = 8
  tmp_table_size=320M
  thread_concurrency=32
  
  
  innodb_lock_wait_timeout = 600
  innodb_additional_mem_pool_size=60M
  innodb_buffer_pool_size=20G
  innodb_buffer_pool_instances=20
  innodb_table_locks=0
  max_heap_table_size=128M
  net_buffer_length = 16384
  max_connect_errors = 10
  open_files_limit=50000
  default-storage-engine=InnoDB
  low-priority-updates=1
  innodb_file_per_table=1
  concurrent_insert=ALWAYS
  
  
  [mysqld_safe]
  log-error=/var/log/mariadb/mariadb.log
  pid-file=/var/run/mariadb/mariadb.pid
  
  #
  # include all files from the config directory
  #
  !includedir /etc/my.cnf.d
  
  
  
  
  
  
  
  
  
  
  [myisamchk]
  key_buffer_size=512M
  sort_buffer_size=256M
  read_buffer=256M
  write_buffer=256M
  
  
  [mysqldump]
  quick
  quote-names
  max_allowed_packet    = 16M
  
  
  
  [isamchk]
  key_buffer = 384M
  sort_buffer = 384M
  read_buffer = 256M
  write_buffer = 256M
  </code></pre>
  
  <p>I restarted MySQL a short while ago to apply my most recent changes.</p>
  
  <p>When I run the script, this is what I get:</p>
  
  <pre><code> &gt;&gt;  MySQLTuner 1.4.4 - Major Hayden &lt;major@mhtx.net&gt;
   &gt;&gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/
   &gt;&gt;  Run with '--help' for additional options and output filtering
  [[0;32mOK[0m] Currently running supported MySQL version 5.5.41-MariaDB
  [[0;32mOK[0m] Operating on 64-bit architecture
  
  -------- Storage Engine Statistics -------------------------------------------
  [[0;34m--[0m] Status: [0;32m+ARCHIVE [0m[0;32m+Aria [0m[0;32m+BLACKHOLE [0m[0;32m+CSV [0m[0;32m+FEDERATED [0m[0;32m+InnoDB [0m[0;32m+MRG_MYISAM [0m
  [[0;34m--[0m] Data in MyISAM tables: 23M (Tables: 75)
  [[0;34m--[0m] Data in InnoDB tables: 65M (Tables: 643)
  [[0;34m--[0m] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
  [[0;34m--[0m] Data in MEMORY tables: 0B (Tables: 4)
  [[0;31m!![0m] Total fragmented tables: 516
  
  -------- Security Recommendations  -------------------------------------------
  [[0;32mOK[0m] There is no anonymous account in all database users
  [[0;32mOK[0m] All database users have passwords assigned
  [[0;31m!![0m] User 'pixoneo@%' hasn't specific host restriction.
  [[0;34m--[0m] There is 605 basic passwords in the list.
  
  -------- Performance Metrics -------------------------------------------------
  [[0;34m--[0m] Up for: 20m 58s (877K q [697.220 qps], 52K conn, TX: 16B, RX: 195M)
  [[0;34m--[0m] Reads / Writes: 96% / 4%
  [[0;34m--[0m] Total buffers: 22.3G global + 4.9M per thread (1200 max threads)
  [[0;31m!![0m] Maximum possible memory usage: 28.1G (89% of installed RAM)
  [[0;32mOK[0m] Slow queries: 0% (9/877K)
  [[0;32mOK[0m] Highest usage of available connections: 40% (483/1200)
  [[0;32mOK[0m] Key buffer size / total MyISAM indexes: 2.0G/773.0K
  [[0;31m!![0m] Key buffer hit rate: 94.3% (53 cached / 3 reads)
  [[0;32mOK[0m] Query cache efficiency: 45.6% (497K cached / 1M selects)
  [[0;32mOK[0m] Query cache prunes per day: 0
  [[0;32mOK[0m] Sorts requiring temporary tables: 0% (0 temp sorts / 22K sorts)
  [[0;31m!![0m] Joins performed without indexes: 15817
  [[0;32mOK[0m] Temporary tables created on disk: 11% (23K on disk / 204K total)
  [[0;32mOK[0m] Thread cache hit rate: 99% (483 created / 52K connections)
  [[0;32mOK[0m] Table cache hit rate: 102% (1K open / 1K opened)
  [[0;32mOK[0m] Open file limit used: 23% (239/1K)
  [[0;32mOK[0m] Table locks acquired immediately: 100% (199K immediate / 199K locks)
  
  -------- InnoDB Metrics -----------------------------------------------------
  [[0;34m--[0m] InnoDB is enabled.
  [[0;34m--[0m] InnoDB BufferPool Size :20.0G
  [[0;34m--[0m] InnoDB BufferPool Inst :1
  [[0;32mOK[0m] InnoDB buffer pool / data size: 20.0G/65.4M
  [[0;31m!![0m] InnoDB buffer pool instances: 1
  [[0;32mOK[0m] InnoDB log waits: 0
  
  -------- Recommendations -----------------------------------------------------
  General recommendations:
      Run OPTIMIZE TABLE to defragment tables for better performance
      Restrict Host for user@% to user@SpecificDNSorIp
      MySQL started within last 24 hours - recommendations may be inaccurate
      Reduce your overall MySQL memory footprint for system stability
      Enable the slow query log to troubleshoot bad queries
      Adjust your join queries to always utilize indexes
  Variables to adjust:
      join_buffer_size (&gt; 1.0M, or always use indexes with joins)
      innodb_buffer_pool_instances(=20)
  </code></pre>
  
  <p>Does anyone have any recommendations with what to do now? Thank you</p>