diff --git a/tools/benchmark.sh b/tools/benchmark.sh index aea54c98ef..1cbeef6a5b 100755 --- a/tools/benchmark.sh +++ b/tools/benchmark.sh @@ -49,6 +49,8 @@ mb_written_per_sec=${MB_WRITE_PER_SEC:-0} # Only for tests that do range scans num_nexts_per_seek=${NUM_NEXTS_PER_SEEK:-10} cache_size=${CACHE_SIZE:-$((1 * G))} +compression_max_dict_bytes=${COMPRESSION_MAX_DICT_BYTES:-0} +compression_type=${COMPRESSION_TYPE:-snappy} duration=${DURATION:-0} num_keys=${NUM_KEYS:-$((1 * G))} @@ -68,9 +70,9 @@ const_params=" --block_size=$block_size \ --cache_size=$cache_size \ --cache_numshardbits=6 \ - --compression_type=snappy \ - --min_level_to_compress=3 \ + --compression_max_dict_bytes=$compression_max_dict_bytes \ --compression_ratio=0.5 \ + --compression_type=$compression_type \ --level_compaction_dynamic_level_bytes=true \ --bytes_per_sync=$((8 * M)) \ --cache_index_and_filter_blocks=0 \ diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 65d5830f47..e5ebeaff9a 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -562,6 +562,10 @@ DEFINE_int32(compression_level, -1, "Compression level. For zlib this should be -1 for the " "default level, or between 0 and 9."); +DEFINE_int32(compression_max_dict_bytes, 0, + "Maximum size of dictionary used to prime the compression " + "library."); + static bool ValidateCompressionLevel(const char* flagname, int32_t value) { if (value < -1 || value > 9) { fprintf(stderr, "Invalid value for --%s: %d, must be between -1 and 9\n", @@ -2556,6 +2560,7 @@ class Benchmark { FLAGS_level0_slowdown_writes_trigger; options.compression = FLAGS_compression_type_e; options.compression_opts.level = FLAGS_compression_level; + options.compression_opts.max_dict_bytes = FLAGS_compression_max_dict_bytes; options.WAL_ttl_seconds = FLAGS_wal_ttl_seconds; options.WAL_size_limit_MB = FLAGS_wal_size_limit_MB; options.max_total_wal_size = FLAGS_max_total_wal_size;