• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

MariaDB my.cnf tuning

Sheratan

Well-known member
#1
I had 600MB VPS (no kidding, 600MB)

This is my my.cnf

Code:
# * Fine Tuning
#
max_connections     = 50
connect_timeout     = 5
wait_timeout     = 600
max_allowed_packet   = 16M
thread_cache_size  = 128
sort_buffer_size   = 4M
bulk_insert_buffer_size   = 16M
tmp_table_size     = 40M
max_heap_table_size   = 40M
#
# * MyISAM
#
myisam_recover  = BACKUP
key_buffer_size     = 32M
#open-files-limit   = 2000
table_open_cache   = 100
myisam_sort_buffer_size   = 128M
concurrent_insert   = 2
read_buffer_size   = 2M
read_rnd_buffer_size   = 1M
#
# * Query Cache Configuration
#
query_cache_limit     = 128K
query_cache_size     = 64M
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type     = DEMAND
#
# * Logging and Replication
#
log_warnings     = 2
#
#slow_query_log[={0|1}]
slow_query_log_file   = /var/log/mysql/mariadb-slow.log
long_query_time = 10
#log_slow_rate_limit   = 1000
log_slow_verbosity   = query_plan

#log-queries-not-using-indexes
#log_slow_admin_statements
#server-id     = 1
#report_host     = master1
#auto_increment_increment = 2
#auto_increment_offset   = 1
log_bin       = /var/log/mysql/mariadb-bin
log_bin_index     = /var/log/mysql/mariadb-bin.index
#sync_binlog     = 1
expire_logs_days   = 10
max_binlog_size  = 100M
# slaves
#relay_log     = /var/log/mysql/relay-bin
#relay_log_index   = /var/log/mysql/relay-bin.index
#relay_log_info_file   = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# * InnoDB
#
default_storage_engine   = InnoDB
#innodb_log_file_size   = 50M
innodb_buffer_pool_size   = 256M
innodb_log_buffer_size   = 8M
innodb_file_per_table   = 1
innodb_open_files   = 400
innodb_io_capacity   = 400
innodb_flush_method   = O_DIRECT

[mysqldump]
quick
quote-names
max_allowed_packet   = 16M

[mysql]
#no-auto-rehash   # faster start of mysql but no tab completition

[isamchk]
key_buffer     = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#  The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
This is mysqltuner result:
Code:
>>  MySQLTuner 1.2.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] Logged in using credentials from debian maintenance account.

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.34-MariaDB-1~wheezy-log
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB +Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 12M (Tables: 3)
[--] Data in InnoDB tables: 151M (Tables: 175)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 5M (Tables: 3)
[!!] Total fragmented tables: 20

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 9h 3m 27s (124K q [3.813 qps], 3K conn, TX: 476M, RX: 106M)
[--] Reads / Writes: 47% / 53%
[--] Total buffers: 496.0M global + 7.4M per thread (100 max threads)
[!!] Maximum possible memory usage: 1.2G (209% of installed RAM)
[OK] Slow queries: 0% (0/124K)
[OK] Highest usage of available connections: 3% (3/100)
[OK] Key buffer size / total MyISAM indexes: 128.0M/20.1M
[!!] Key buffer hit rate: 90.6% (15K cached / 1K reads)
[OK] Query cache efficiency: 27.8% (18K cached / 67K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts)
[!!] Joins performed without indexes: 531
[!!] Temporary tables created on disk: 42% (1K on disk / 3K total)
[OK] Thread cache hit rate: 99% (3 created / 3K connections)
[OK] Table cache hit rate: 44% (400 open / 895 opened)
[OK] Open file limit used: 6% (62/1K)
[OK] Table locks acquired immediately: 99% (106K immediate / 106K locks)
[OK] InnoDB data size / buffer pool: 151.3M/256.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
  Run OPTIMIZE TABLE to defragment tables for better performance
  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
  When making adjustments, make tmp_table_size/max_heap_table_size equal
  Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
  join_buffer_size (> 128.0K, or always use indexes with joins)
  tmp_table_size (> 32M)
  max_heap_table_size (> 32M)
Any suggestion? This server server only xenforo.