1# Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2# This source code is licensed under both the GPLv2 (found in the 3# COPYING file in the root directory) and Apache 2.0 License 4# (found in the LICENSE.Apache file in the root directory). 5# 6# FORMAT: very similar to the Rocksdb ini file in terms of syntax 7# (refer rocksdb/examples/rocksdb_option_file_example.ini) 8# 9# The Rules INI file is made up of multiple sections and each section is made 10# up of multiple key-value pairs. The recognized section types are: 11# Rule, Suggestion, Condition. Each section must have a name specified in "" 12# in the section header. This name acts as an identifier in that section 13# type's namespace. A section header looks like: 14# [<section_type> "<section_name_identifier>"] 15# 16# There should be at least one Rule section in the file with its corresponding 17# Condition and Suggestion sections. A Rule is triggered only when all of its 18# conditions are triggered. The order in which a Rule's conditions and 19# suggestions are specified has no significance. 20# 21# A Condition must be associated with a data source specified by the parameter 22# 'source' and this must be the first parameter specified for the Condition. 23# A condition can be associated with one or more Rules. 24# 25# A Suggestion is an advised change to a Rocksdb option to improve the 26# performance of the database in some way. Every suggestion can be a part of 27# one or more Rules. 28 29[Rule "stall-too-many-memtables"] 30suggestions=inc-bg-flush:inc-write-buffer 31conditions=stall-too-many-memtables 32 33[Condition "stall-too-many-memtables"] 34source=LOG 35regex=Stopping writes because we have \d+ immutable memtables \(waiting for flush\), max_write_buffer_number is set to \d+ 36 37[Rule "stall-too-many-L0"] 38suggestions=inc-max-subcompactions:inc-max-bg-compactions:inc-write-buffer-size:dec-max-bytes-for-level-base:inc-l0-slowdown-writes-trigger 39conditions=stall-too-many-L0 40 41[Condition "stall-too-many-L0"] 42source=LOG 43regex=Stalling writes because we have \d+ level-0 files 44 45[Rule "stop-too-many-L0"] 46suggestions=inc-max-bg-compactions:inc-write-buffer-size:inc-l0-stop-writes-trigger 47conditions=stop-too-many-L0 48 49[Condition "stop-too-many-L0"] 50source=LOG 51regex=Stopping writes because we have \d+ level-0 files 52 53[Rule "stall-too-many-compaction-bytes"] 54suggestions=inc-max-bg-compactions:inc-write-buffer-size:inc-hard-pending-compaction-bytes-limit:inc-soft-pending-compaction-bytes-limit 55conditions=stall-too-many-compaction-bytes 56 57[Condition "stall-too-many-compaction-bytes"] 58source=LOG 59regex=Stalling writes because of estimated pending compaction bytes \d+ 60 61[Suggestion "inc-bg-flush"] 62option=DBOptions.max_background_flushes 63action=increase 64suggested_values=2 65 66[Suggestion "inc-write-buffer"] 67option=CFOptions.max_write_buffer_number 68action=increase 69 70[Suggestion "inc-max-subcompactions"] 71option=DBOptions.max_subcompactions 72action=increase 73 74[Suggestion "inc-max-bg-compactions"] 75option=DBOptions.max_background_compactions 76action=increase 77suggested_values=2 78 79[Suggestion "inc-write-buffer-size"] 80option=CFOptions.write_buffer_size 81action=increase 82 83[Suggestion "dec-max-bytes-for-level-base"] 84option=CFOptions.max_bytes_for_level_base 85action=decrease 86 87[Suggestion "inc-l0-slowdown-writes-trigger"] 88option=CFOptions.level0_slowdown_writes_trigger 89action=increase 90 91[Suggestion "inc-l0-stop-writes-trigger"] 92option=CFOptions.level0_stop_writes_trigger 93action=increase 94 95[Suggestion "inc-hard-pending-compaction-bytes-limit"] 96option=CFOptions.hard_pending_compaction_bytes_limit 97action=increase 98 99[Suggestion "inc-soft-pending-compaction-bytes-limit"] 100option=CFOptions.soft_pending_compaction_bytes_limit 101action=increase 102 103[Rule "level0-level1-ratio"] 104conditions=level0-level1-ratio 105suggestions=inc-base-max-bytes 106 107[Condition "level0-level1-ratio"] 108source=OPTIONS 109options=CFOptions.level0_file_num_compaction_trigger:CFOptions.write_buffer_size:CFOptions.max_bytes_for_level_base 110evaluate=int(options[0])*int(options[1])-int(options[2])>=1 # should evaluate to a boolean, condition triggered if evaluates to true 111 112[Suggestion "inc-base-max-bytes"] 113option=CFOptions.max_bytes_for_level_base 114action=increase 115 116[Rules "tuning-iostat-burst"] 117conditions=large-db-get-p99 118suggestions=bytes-per-sync-non0:wal-bytes-per-sync-non0:set-rate-limiter 119#overlap_time_period=10m 120 121[Condition "write-burst"] 122source=TIME_SERIES 123keys=dyno.flash_write_bytes_per_sec 124behavior=bursty 125window_sec=300 # the smaller this window, the more sensitivity to changes in the time series, so the rate_threshold should be bigger; when it's 60, then same as diff(%) 126rate_threshold=20 127 128[Condition "large-p99-read-latency"] 129source=TIME_SERIES 130keys=[]rocksdb.read.block.get.micros.p99 131behavior=bursty 132window_sec=300 133rate_threshold=10 134 135[Condition "large-db-get-p99"] 136source=TIME_SERIES 137keys=[]rocksdb.db.get.micros.p50:[]rocksdb.db.get.micros.p99 138behavior=evaluate_expression 139evaluate=(keys[1]/keys[0])>5 140 141[Suggestion "bytes-per-sync-non0"] 142option=DBOptions.bytes_per_sync 143action=set 144suggested_values=1048576 145 146[Suggestion "wal-bytes-per-sync-non0"] 147option=DBOptions.wal_bytes_per_sync 148action=set 149suggested_values=1048576 150 151[Suggestion "set-rate-limiter"] 152option=rate_limiter_bytes_per_sec 153action=set 154suggested_values=1024000 155 156[Rule "bloom-filter-percent-useful"] 157conditions=bloom-filter-percent-useful 158suggestions=inc-bloom-bits-per-key 159 160[Condition "bloom-filter-percent-useful"] 161source=TIME_SERIES 162keys=[]rocksdb.bloom.filter.useful.count:[]rocksdb.bloom.filter.full.positive.count:[]rocksdb.bloom.filter.full.true.positive.count 163behavior=evaluate_expression 164evaluate=((keys[0]+keys[2])/(keys[0]+keys[1]))<0.9 # should evaluate to a boolean 165aggregation_op=latest 166 167[Rule "bloom-not-enabled"] 168conditions=bloom-not-enabled 169suggestions=inc-bloom-bits-per-key 170 171[Condition "bloom-not-enabled"] 172source=TIME_SERIES 173keys=[]rocksdb.bloom.filter.useful.count:[]rocksdb.bloom.filter.full.positive.count:[]rocksdb.bloom.filter.full.true.positive.count 174behavior=evaluate_expression 175evaluate=keys[0]+keys[1]+keys[2]==0 176aggregation_op=avg 177 178[Suggestion "inc-bloom-bits-per-key"] 179option=bloom_bits 180action=increase 181suggested_values=2 182 183[Rule "small-l0-files"] 184conditions=small-l0-files 185suggestions=dec-max-bytes-for-level-base:inc-write-buffer-size 186 187[Condition "small-l0-files"] 188source=OPTIONS 189options=CFOptions.max_bytes_for_level_base:CFOptions.level0_file_num_compaction_trigger:CFOptions.write_buffer_size 190evaluate=int(options[0])>(10*int(options[1])*int(options[2])) 191 192[Rule "decompress-time-long"] 193conditions=decompress-time-long 194suggestions=dec-block-size:inc-block-cache-size:faster-compression-type 195 196[Condition "decompress-time-long"] 197source=TIME_SERIES 198keys=block_decompress_time:block_read_time:block_checksum_time 199behavior=evaluate_expression 200evaluate=(keys[0]/(keys[0]+keys[1]+keys[2]))>0.3 201 202[Suggestion "dec-block-size"] 203option=TableOptions.BlockBasedTable.block_size 204action=decrease 205 206[Suggestion "inc-block-cache-size"] 207option=cache_size 208action=increase 209suggested_values=16000000 210 211[Suggestion "faster-compression-type"] 212option=CFOptions.compression 213action=set 214suggested_values=kLZ4Compression 215