Skip to content

Instantly share code, notes, and snippets.

@onyxraven
Forked from douglasjarquin/gist:2208690
Last active June 21, 2022 13:42
Show Gist options
  • Save onyxraven/3834532 to your computer and use it in GitHub Desktop.
Save onyxraven/3834532 to your computer and use it in GitHub Desktop.
Amazon RDS Performance Tuning Settings
#XLarge DBInstanceClassMemory = 15892177440 = 14.8GB
#/32 = 496630545 = 473MB
#/64 = 248315272 = 236MB
#/128 = 124157636 = 118MB
#/256 = 62078818 = 59MB
#/512 = 31039409 = 29MB
#/12582880 = 1263 #default same divisor as max_connections = 4041.6MB = 4237924762
#/25165760 = 623 # half of max_connections = 1993.6MB
#/50331520 = 315 # quarter of max_connections = 1008MB = 1056964608
#*(3/4) #default innodb pool size = 11922309120
#*(5/8) innodb pool size = 9932610900
#*(7/8) innodb pool size = 13905655260
#each connection =~ 3.2mb
#default 1263 conns + 3/4 innodb = 16160233882 mem (-268056442 = 255.6MB over)
#315 conns + 7/8 innodb = 14962619868 mem (929557572 = 886MB free)
#** defaults **
#tmp_table_size = 16777216
#max_heap_table_size = 16777216
#table_open_cache = 400
#thread_cache_size = 0
#innodb_flush_log_at_trx_commit = 1
#max_allowed_packet = 1048576
#join_buffer_size = 131072 = 128k => 1mb?
#read buffer size = 262144 = 256k
#sort buffer size = 2097152 = 2mb
#read rand buffer size = 524288 = 512k
rds-modify-db-parameter-group utf8-unused \
--parameters="name=character_set_server, value=utf8, method=immediate" \
--parameters="name=collation_server, value=utf8_general_ci, method=immediate" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/512}, method=immediate" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/512}, method=immediate" \
--parameters="name=table_open_cache, value=1000, method=immediate" \
--parameters="name=thread_cache_size, value=30, method=immediate" \
--parameters="name=innodb_flush_log_at_trx_commit, value=2, method=immediate" \
--parameters="name=max_allowed_packet, value=8388608, method=immediate" \
--parameters="name=innodb_buffer_pool_size, value={DBInstanceClassMemory*5/8}, method=pending-reboot" \
--parameters="name=max_connections, value={DBInstanceClassMemory/9082880}, method=pending-reboot"
rds-modify-db-parameter-group utf8-new \
--parameters="name=character_set_server, value=utf8, method=immediate" \
--parameters="name=collation_server, value=utf8_general_ci, method=immediate" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/512}, method=immediate" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/512}, method=immediate" \
--parameters="name=table_open_cache, value=1000, method=immediate" \
--parameters="name=thread_cache_size, value=30, method=immediate" \
--parameters="name=innodb_flush_log_at_trx_commit, value=2, method=immediate" \
--parameters="name=max_allowed_packet, value=8388608, method=immediate" \
--parameters="name=log_bin_trust_function_creators, value=1, method=immediate" \
--parameters="name=read_only, value=0, method=immediate"
rds-modify-db-parameter-group utf8-olap \
--parameters="name=character_set_server, value=utf8, method=immediate" \
--parameters="name=collation_server, value=utf8_general_ci, method=immediate" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/64}, method=immediate" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/64}, method=immediate" \
--parameters="name=table_open_cache, value=100, method=immediate" \
--parameters="name=thread_cache_size, value=10, method=immediate" \
--parameters="name=innodb_flush_log_at_trx_commit, value=2, method=immediate" \
--parameters="name=max_allowed_packet, value=8388608, method=immediate" \
--parameters="name=log_bin_trust_function_creators, value=1, method=immediate" \
--parameters="name=read_only, value=0, method=immediate" \
--parameters="name=max_connections, value={DBInstanceClassMemory/50331520}, method=pending-reboot" \
--parameters="name=key_buffer_size, value=67108864, method=immediate" \
--parameters="name=read_buffer_size, value=524288, method=immediate" \
--parameters="name=read_rnd_buffer_size, value=1048576, method=immediate" \
--parameters="name=innodb_buffer_pool_size, value={DBInstanceClassMemory*7/8}, method=pending-reboot" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment