]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Add appropriate parameters to make bulk-load go faster.
authorDhruba Borthakur <dhruba@fb.com>
Fri, 8 Mar 2013 17:19:24 +0000 (09:19 -0800)
committerDhruba Borthakur <dhruba@fb.com>
Fri, 8 Mar 2013 18:52:16 +0000 (10:52 -0800)
Summary:
1. Create only 2 levels so that manual compactions are fast.
2. Set target file size to a large value

Test Plan: make clean check

Reviewers: kailiu, zshao

Reviewed By: zshao

CC: leveldb
Differential Revision: https://reviews.facebook.net/D9231

include/leveldb/options.h
util/options.cc

index 28aaba485f8a13b337fbc781d090ef52db1852d4..4e6d5e0d62ac67b51d5d65a700a43a8be66ccc8d 100644 (file)
@@ -347,7 +347,7 @@ struct Options {
 
   // Set appropriate parameters for bulk loading.
   // The reason that this is a function that returns "this" instead of a
-  // constructure is to enable chaining of multiple similar calls in the future.
+  // constructor is to enable chaining of multiple similar calls in the future.
   //
   // All data will be in level 0 without any automatic compaction.
   // It's recommended to manually call CompactRange(NULL, NULL) before reading
index 9597b7c854da9e29cb6e21828dbdd66e6caf4f81..a9d7719dd6f0addec585c140e26ecde2dd177a3d 100644 (file)
@@ -161,17 +161,40 @@ Options::Dump(Logger* log) const
         manifest_preallocation_size);
 }   // Options::Dump
 
+//
+// The goal of this method is to create a configuration that
+// allows an application to write all files into L0 and
+// then do a single compaction to output all files into L1.
 Options*
 Options::PrepareForBulkLoad()
 {
+  // never slowdown ingest.
   level0_file_num_compaction_trigger = (1<<30);
   level0_slowdown_writes_trigger = (1<<30);
   level0_stop_writes_trigger = (1<<30);
+
+  // no auto compactions please. The application should issue a
+  // manual compaction after all data is loaded into L0.
   disable_auto_compactions = true;
   disable_seek_compaction = true;
   disableDataSync = true;
+
+  // A manual compaction run should pick all files in L0 in
+  // a single compaction run.
   source_compaction_factor = (1<<30);
 
+  // It is better to have only 2 levels, otherwise a manual
+  // compaction would compact at every possible level, thereby
+  // increasing the total time needed for compactions.
+  num_levels = 2;
+
+  // Prevent a memtable flush to automatically promote files
+  // to L1. This is helpful so that all files that are
+  // input to the manual compaction are all at L0.
+  max_background_compactions = 2;
+
+  // The compaction would create large files in L1.
+  target_file_size_base = 256 * 1024 * 1024;
   return this;
 }