Skip to content

Instantly share code, notes, and snippets.

@jonathanvx
Created January 27, 2017 15:30
Show Gist options
  • Save jonathanvx/0da6f563a2a2392967b6c15037a6e1af to your computer and use it in GitHub Desktop.
Save jonathanvx/0da6f563a2a2392967b6c15037a6e1af to your computer and use it in GitHub Desktop.
Optimised Moodle Config file
[mysqld]
## Performance Specific ##
##########################
innodb_buffer_pool_size = 12G ### How much innodb data to store in memory. Higher = faster performance
innodb_file_per_table = 1 ### Each innodb table is its own file on disk.
innodb_flush_log_at_trx_commit = 2 ### Flushes to disk in batches instead of per change
innodb_io_capacity = 800 ### Min IO speed expected to write to disk.
read_buffer_size = 2M ### Helps with reading temp tables faster, bulk inserts and nested queries
read_rnd_buffer_size = 8M ### Helps with multi range queries and ORDER Bys.
sort_buffer_size = 8M ### Helps with ORDER BY queries.
table_open_cache = 4096 ### Cache data about open tables. Saves reopening tables.
thread_cache_size = 128 ### How many threads to cache. Can help reduce thread count.
thread_stack = 256k ### How much cache each thread can have. Higher = more complicated results are cached
tmp_table_size = 64M ### Max size a tmp table can be.
innodb_flush_method = O_DIRECT ## Innodb flushes to table files directly
innodb_log_file_size = 512M ##
innodb_log_files_in_group = 3 ##
innodb_read_io_threads = 8 ## innodb background threads for reads. Helps with reads
join_buffer_size = 2M ## Helps when a join doesn’t have an index or an index wont be more helpful than a full table scan
max_heap_table_size = 64M ## Max size a tmp table can be in memory
query_cache_limit = 2M ##
query_cache_min_res_unit = 2048 ##
query_cache_size = 196M ##
query_cache_type = 1 ## Caches complete query results. Data gets invalidated when underlying tables are changed.
table_open_cache_instances = 8 ## Divides the table cache to reduce contention
table-definition-cache = 4096 ## Stores table definitions - .frm files
key_buffer_size = 16M # As there are no MyISAM tables, this variable helps with MyISAM temp tables.
back_log = 1500 # When MySQL gets a lot of connections in a short time, it will keep them in a back log
innodb_purge_threads = 2 # May reduce locks for when updates/deletes are run often
innodb_sort_buffer_size = 2M # Helps with index changes and create table statements
#innodb_page_cleaners = 4 # Will help with start up and shutdown in 5.7
binlog_cache_size = 128K # May speed up transactions
binlog_stmt_cache_size = 1M # May speed up transactions
## General ##
#############
port=3306
log_bin = /data/mysql/binlog
log-bin-index = /data/mysql/binlog.index
master-info-repository = TABLE
relay-log-info-repository = TABLE
default-storage-engine = InnoDB
innodb_file_format = Barracuda # The newer version of Innodb.
innodb_open_files = 131072 # Max number of open files innodb can have - Safety feature
interactive_timeout = 28800
max_allowed_packet = 32M
max-connect-errors = 1000000
min_examined_row_limit = 1 # Slow log setting
open-files-limit = 65535
sql_mode = NO_ENGINE_SUBSTITUTION
sync_binlog = 0 # Moves to commiting in batches instead of per command
wait_timeout = 28800
## UTF-8 compatibility ##
#########################
character-set-server = utf8
init_connect = 'SET collation_connection = utf8_general_ci'
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment