From c3dda7276c0cc1decbe693005c6d53b2cf25d133 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Tue, 12 Nov 2013 16:09:57 -0800 Subject: [PATCH] Update documentation Summary: Added more options for compaction settings + thread pools. Please check if thread pool description is correct. Test Plan: - Reviewers: dhruba Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D14043 --- doc/index.html | 131 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 121 insertions(+), 10 deletions(-) diff --git a/doc/index.html b/doc/index.html index e9a41922b..088a73722 100644 --- a/doc/index.html +++ b/doc/index.html @@ -387,7 +387,8 @@ of point reads of small values may wish to switch to a smaller block size if performance measurements indicate an improvement. There isn't much benefit in using blocks smaller than one kilobyte, or larger than a few megabytes. Also note that compression will be more effective -with larger block sizes. +with larger block sizes. To change block size parameter, use +Options::block_size.

Write buffer

@@ -434,7 +435,7 @@ filesystem and each file stores a sequence of compressed blocks. If used uncompressed block contents. If options.block_cache_compressed is non-NULL, it is used to cache frequently used compressed blocks. Compressed cache is an alternative to OS cache, which also caches compressed blocks. If -compressed cache is used, you should disable OS cache by setting +compressed cache is used, the OS cache will be disabled automatically by setting options.allow_os_buffer to false.

@@ -588,7 +589,7 @@ Here we give overview of the options that impact behavior of Compactions:
 
 

Other options impacting performance of compactions and when they get triggered -are: access_hint_on_compaction_start, -level0_file_num_compaction_trigger, -max_mem_compaction_level, target_file_size_base, -target_file_size_multiplier, -expanded_compaction_factor, source_compaction_factor, -max_grandparent_overlap_factor, -disable_seek_compaction, max_background_compactions. +are: +

+

You can learn more about all of those options in rocksdb/options.h +

Universal style compaction specific settings

+

+If you're using Universal style compaction, there is an object CompactionOptionsUniversal +that hold all the different options for that compaction. The exact definition is in +rocksdb/universal_compaction.h and you can set it in Options::compaction_options_universal. +Here we give short overview of options in CompactionOptionsUniversal: +

+ +

Thread pools

+

+A thread pool is associated with Env environment object. The client has to create a thread pool by setting the number of background +threads using method Env::SetBackgroundThreads() defined in rocksdb/env.h. +We use the thread pool for compactions and memtable flushes. +Since memtable flushes are in critical code path (stalling memtable flush can stall writes, increasing p99), we suggest +having two thread pools - with priorities HIGH and LOW. Memtable flushes can be set up to be scheduled on HIGH thread pool. +There are two options available for configuration of background compactions and flushes: +

+

+

+  #include "rocksdb/env.h"
+  #include "rocksdb/db.h"
+
+  auto env = rocksdb::Env::Default();
+  env->SetBackgroundThreads(2, rocksdb::Env::LOW);
+  env->SetBackgroundThreads(1, rocksdb::Env::HIGH);
+  rocksdb::DB* db;
+  rocksdb::Options options;
+  options.env = env;
+  options.max_background_compactions = 2;
+  options.max_background_flushes = 1;
+  rocksdb::Status status = rocksdb::DB::Open(options, "/tmp/testdb", &db);
+  assert(status.ok());
+  ...
+

Approximate Sizes

The GetApproximateSizes method can used to get the approximate -- GitLab