This is a usability enhancement for db_bench.
Currently, db_bench allows running multiple benchmarks in a single invocation, for example:
./db_bench -benchmarks fillseq,flush,overwrite …. [other flags as applicable]
However, all of the benchmarks share the same configuration.
A user could run db_bench multiple times on an existing Database(s), each run with its own configuration, by specifying the ‘-use_existing_db’ flag. For example, say the user wanted to do a long fillup of a database, followed by multiple benchmarks, on the filled up database. That user could do that by running the following commands:
./db_bench -benchmarks fillrandom -duration 3600 -threads 50 …
./db_bench -benchmarks overwrite -use_existing_db -duration 60 -report_file overwrite.csv …
./db_bench -benchmarks readrandom -use_existing_db -duration 60 -report_file readrandom.csv …
However, whenever db_bench exits (at the end of each run), it closes the database (and flushes the memtables).
This new feature allows a user to run db_bench once, but specify groups of benchmarks, each with its own configuration, as if they were run separately. For example, the above 3 commands could be combined using the new feature as follows:
./db_bench -groups “-benchmarks fillrandom -duration 3600 -threads 50 …“ “-benchmarks overwrite -duration 60 -report_file overwrite.csv …“ “-benchmarks readrandom -duration 60 -report_file readrandom.csv …“
The same 3 benchmarks would run (each has its own group), each with its own desired configuration. The difference is that the DB(s) remain open between groups. So, when one group ends and a new one starts, the database retains its state. Specifically, the database stays open, and the memtables are not flushed.
./db_bench -groups '<group1>' '<group2>' '<group3>' …
- Each group has its own configuration. A group’s configuration is a set of valid db_bench flags, exactly as if they were given in the normal db_bench invocation (single-group mode).
- The first group (the MASTER group) sets the initial configuration for all subsequent groups. Subsequent groups may override the initial configuration (some limitations apply, see below). Please note that the master group’s configuration is the default for any of the following groups. So, each group following the first starts with the master’s configuration, and may override or add to that.
- As noted above, the database(s) are opened when running the first group and remain open thereafter. They are closed, as always, when db_bench exits. However, please note that:
- Any flag that affects the options may only be set during the first group. These flags will be silently ignored in subsequent groups (e.g., flags such as ‘-write_buffer_size’, or ‘max_write_buffer_number’).
- The following flags may only be set for the first group. Attempting to override them in subsequent groups will cause db_bench to abort when running the violating group:
- The ‘-groups’ or ‘--groups’ keyword indicates that the user works in groups mode.
- The ‘groups’ keyword is not a gflags flag. It is displayed in the db_bench’s help as do all other flags, but, again, is not a gflags flag:
- It must be the first “flag”, right after the db_bench executable’s name
- It is not passed to gflags for parsing as do all other flags.
- If the “-groups” keyword is missing or misplaced, db_bench assumes the default, “single-group” mode, that was the only one thus far.
- Every group is delimited by ‘’ (single-quotes) or “” (double-quotes). When values of flags themselves need to use quotes, the user should just use one type of quotes as the group’s delimiter, and the other for the values.
./db_bench -groups '-num 100 -benchmarks "fillseq,readrandom"' '-num 200 -benchmarks readrandom' '-benchmarks readrandom -reads 10000'
- The fillseq,readrandom benchmarks will run.
- -num = 100
- All other flags have their default values as usual.
- The readrandom benchmark will run.
- -num = 200 (set by the group 1 and not overridden).
- All other flags retain their (default) values from group 1
- The readrandom benchmark will run
- -num = 1000 (overriding -num of group 1).
- -reads = 1000 (overriding the default (implicit) value of -reads set internally by db_bench)