Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce time-series distribution args to bench tool #253

Merged
merged 2 commits into from
Dec 26, 2023

Conversation

MrCroxx
Copy link
Owner

@MrCroxx MrCroxx commented Dec 25, 2023

What's changed and what's your intention?

Please explain IN DETAIL what the changes are in this PR and why they are needed. :D

This PR introduce some args to the bench tool to set the time-series distribution.

For example, the user can generate a workload with the Zipf's Law time-series distribution with:

rm -rf /p44pro/foyer && cargo build --release && RUST_BACKTRACE=1 RUST_LOG=warn ./target/release/foyer-storage-bench --dir /p44pro/foyer --capacity 204800 --region-size 64 --lookup-range 10000 --flushers 12 --reclaimers 12 --time 180 --writers 64 --w-rate 8 --ticket-insert-rate-limit 500 --readers 1024 --r-rate 1 --runtime --metrics --compression none --io-size 262144 --distribution zipf --distribution-zipf-s 0.8

The bench tool will give the histogram of samples and the distribution of intervals:

zipf's diagram [N = 100][s = 0.8][samples = 100000]
  0 :  42058 : 42.058% : ====================================================================================================
  1 :  14773 : 14.773% : ===================================
  2 :   9731 :  9.731% : =======================
  3 :   7199 :  7.200% : =================
  4 :   5851 :  5.851% : =============
  5 :   5005 :  5.005% : ===========
  6 :   4413 :  4.413% : ==========
  7 :   3910 :  3.910% : =========
  8 :   3571 :  3.571% : ========
  9 :   3172 :  3.172% : =======
loop interval: 781.25ms, zipf intervals:
    [ 42 ==> 1.855ms   ]
    [ 15 ==> 5.191ms   ]
    [ 10 ==> 8.206ms   ]
    [  7 ==> 11.082ms  ]
    [  6 ==> 13.730ms  ]
    [  5 ==> 15.501ms  ]
    [  4 ==> 17.837ms  ]
    [  4 ==> 18.825ms  ]
    [  3 ==> 23.603ms  ]
    [  3 ==> 23.046ms  ]

Full args:

storage engine bench tool for foyer - the hybrid cache for Rust

Usage: foyer-storage-bench [OPTIONS] --dir <DIR>

Options:
  -d, --dir <DIR>
          dir for cache data
      --capacity <CAPACITY>
          (MiB) [default: 1024]
  -t, --time <TIME>
          (s) [default: 60]
      --report-interval <REPORT_INTERVAL>
          (s) [default: 2]
      --iostat-dev <IOSTAT_DEV>
          Some filesystem (e.g. btrfs) can span across multiple block devices and it's hard to decide which device to moitor. Use this argument to specify which block device to monitor [default: ]
      --w-rate <W_RATE>
          (MiB) [default: 0]
      --r-rate <R_RATE>
          (MiB) [default: 0]
      --entry-size-min <ENTRY_SIZE_MIN>
          [default: 65536]
      --entry-size-max <ENTRY_SIZE_MAX>
          [default: 65536]
      --lookup-range <LOOKUP_RANGE>
          [default: 10000]
      --region-size <REGION_SIZE>
          (MiB) [default: 64]
      --flushers <FLUSHERS>
          [default: 4]
      --reclaimers <RECLAIMERS>
          [default: 4]
      --align <ALIGN>
          [default: 4096]
      --io-size <IO_SIZE>
          [default: 16384]
      --writers <WRITERS>
          [default: 16]
      --readers <READERS>
          [default: 16]
      --recover-concurrency <RECOVER_CONCURRENCY>
          [default: 16]
      --ticket-insert-rate-limit <TICKET_INSERT_RATE_LIMIT>
          enable rated ticket admission policy if `ticket_insert_rate_limit` > 0 (MiB/s) [default: 0]
      --ticket-reinsert-rate-limit <TICKET_REINSERT_RATE_LIMIT>
          enable rated ticket reinsetion policy if `ticket_reinsert_rate_limit` > 0 (MiB/s) [default: 0]
      --clean-region-threshold <CLEAN_REGION_THRESHOLD>
          `0` means equal to reclaimer count [default: 0]
      --catalog-bits <CATALOG_BITS>
          Catalog indices sharding bits [default: 6]
      --metrics
          weigher to enable metrics exporter
      --runtime
          use separate runtime
      --compression <COMPRESSION>
          available values: "none", "zstd" [default: none]
      --distribution <DISTRIBUTION>
          Time-series operation distribution [default: none]
      --distribution-zipf-n <DISTRIBUTION_ZIPF_N>
          For `--distribution zipf` only [default: 100]
      --distribution-zipf-s <DISTRIBUTION_ZIPF_S>
          For `--distribution zipf` only [default: 0.5]
  -h, --help
          Print help (see more with '--help')
  -V, --version
          Print version

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have passed make check and make test or make all in my local envirorment.

Related issues or PRs (optional)

Signed-off-by: MrCroxx <mrcroxx@outlook.com>
@MrCroxx MrCroxx added the feature New feature or request label Dec 25, 2023
@MrCroxx MrCroxx self-assigned this Dec 25, 2023
@MrCroxx MrCroxx requested review from hzxa21 and Li0k December 25, 2023 09:02
Copy link

codecov bot commented Dec 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d3b375e) 77.41% compared to head (b9a6e1d) 77.41%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #253   +/-   ##
=======================================
  Coverage   77.41%   77.41%           
=======================================
  Files          46       46           
  Lines        5703     5703           
=======================================
  Hits         4415     4415           
  Misses       1288     1288           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: MrCroxx <mrcroxx@outlook.com>
Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM

@MrCroxx MrCroxx merged commit 32d5d3d into main Dec 26, 2023
11 checks passed
@MrCroxx MrCroxx deleted the xx/time-series branch December 26, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants