Skip to content

Commit

Permalink
Merge pull request #39 from unum-cloud/main-dev
Browse files Browse the repository at this point in the history
Update default workloads
  • Loading branch information
ashvardanian authored Aug 29, 2023
2 parents 20883f5 + 92647ff commit d74c0ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
39 changes: 15 additions & 24 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,29 @@
import termcolor

"""
Run the script by passing arguments or selecting the settings below.
All the settings are also treated as defaults, so passed arguments will overwrite them.
See main() function.
Below are listed the supported databases, benchmark sizes, workloads and more settings.
All of them are optional and treated as defaults, so you can select settings here or pass arguments from outside.
Usage: sudo ./run.py [arguments], type -h or --help for help.
Note there are some databases and sizes commented by default just to minimize the sample run, so select them according to your needs.
"""

db_names = [
"ustore",
"rocksdb",
"leveldb",
"wiredtiger",
"mongodb",
"redis",
"lmdb",
# "mongodb",
# "redis",
# "lmdb",
]

sizes = [
"100MB",
"1GB",
"10GB",
"100GB",
"1TB",
"10TB",
# "1GB",
# "10GB",
# "100GB",
# "1TB",
# "10TB",
]

workload_names = [
Expand All @@ -47,11 +48,10 @@
"Remove",
]

threads_count = 15
transactional = True
threads_count = 1
transactional = False

drop_caches = False
cleanup_previous = False
run_in_docker_container = False

main_dir_path = "./db_main/"
Expand Down Expand Up @@ -186,7 +186,6 @@ def parse_args():
global storage_disk_paths
global threads_count
global transactional
global cleanup_previous
global drop_caches
global run_in_docker_container

Expand Down Expand Up @@ -247,13 +246,6 @@ def parse_args():
action=argparse.BooleanOptionalAction,
default=transactional,
)
parser.add_argument(
"-cl",
"--cleanup-previous",
help="Drops existing database before start the new benchmark",
action=argparse.BooleanOptionalAction,
default=cleanup_previous,
)
parser.add_argument(
"-dp",
"--drop-caches",
Expand All @@ -277,7 +269,6 @@ def parse_args():
storage_disk_paths = args.storage_dirs
threads_count = args.threads
transactional = args.transactional
cleanup_previous = args.cleanup_previous
drop_caches = args.drop_caches
run_in_docker_container = args.run_docker

Expand All @@ -304,7 +295,7 @@ def main() -> None:
check_args()

# Cleanup old DBs (Note: It actually cleanups if the first workload is `Init`)
if cleanup_previous and workload_names[0] == "Init":
if workload_names[0] == "Init":
print(end="\x1b[1K\r")
print(" [✱] Cleanup...", end="\r")
for size in sizes:
Expand Down
4 changes: 2 additions & 2 deletions src/bench.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ struct progress_t {
delta = fmt::format(fmt::fg(fmt::color::red), "");
else if (opps_delta > 0 && std::abs(opps_delta) > prev_ops_per_second * 0.0001)
delta = fmt::format(fmt::fg(fmt::color::green), "");
auto fails = fails_percent == 0.0 ? fmt::format("{}%", fails_percent)
: fmt::format(fmt::fg(fmt::color::red), "{}%", fails_percent);
auto fails = fails_percent == 0.0 ? fmt::format("{:g}%", fails_percent)
: fmt::format(fmt::fg(fmt::color::red), "{:g}%", fails_percent);
fmt::print(" [✱] {}: {:.2f}% [{}/s {}| fails: {} | elapsed: {} | left: {}]\r",
name,
done_percent,
Expand Down
4 changes: 2 additions & 2 deletions src/core/reporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void console_reporter_t::ReportRuns(std::vector<Run> const& reports) {
fmt::format("{}", printable_bytes_t {mem_max}),
fmt::format("{:.1f}", cpu_avg),
fmt::format("{:.1f}", cpu_max),
fmt::format("{}", fails),
fmt::format("{:g}", fails),
fmt::format("{}", printable_duration_t {size_t(duration)})});
table.row(0).format().width(column_width_).font_align(tabulate::FontAlign::right).hide_border_top().locale("C");
table.column(0)
Expand All @@ -159,7 +159,7 @@ void console_reporter_t::ReportRuns(std::vector<Run> const& reports) {
.font_color(tabulate::Color::green);

// Highlight cells
if (fails > 0)
if (fails > 0.0)
table[0][fails_column_idx_].format().font_color(tabulate::Color::red);

// Print
Expand Down
3 changes: 2 additions & 1 deletion src/wiredtiger/wiredtiger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ operation_result_t wiredtiger_t::remove(key_t key) {
auto res = cursor->remove(cursor.get());
cursor->reset(cursor.get());

return {size_t(res == 0), res == 0 ? operation_status_t::ok_k : operation_status_t::error_k};
bool ok = res == 0 || res == WT_NOTFOUND;
return {size_t(ok), ok ? operation_status_t::ok_k : operation_status_t::error_k};
}

operation_result_t wiredtiger_t::read(key_t key, value_span_t value) const {
Expand Down

0 comments on commit d74c0ef

Please sign in to comment.