Giter Club home page Giter Club logo

mokabench's Introduction

Mokabench

A load generator for some of the concurrent cache libraries for Rust.

Usage

Install the Rust Toolchain

Install a recent stable Rust toolchain.

Clone this Repository and the Submodule

Clone this repository:

$ git clone https://github.com/moka-rs/mokabench.git
$ cd mokabench

Then clone the submodule cache-trace, which contains the trace datasets. Since these datasets are very large, use the --depth 1 option to clone only the latest revision.

$ git submodule init
$ git submodule update --depth 1

Expand the Trace Files

The cache-trace submodule has the arc directory. It contains the trace datasets used in the ARC paper1. Here are some examples:

Dataset Workload Type Description
S3.lis Search Engine Disk read accesses initiated by a large commercial search engine in response to various web search requests.
DS1.lis ERP Database A database server running at a commercial site running an ERP application on top of a commercial database.
OLTP.lis CODASYL References to a CODASYL database for a one hour period.

See the README in cache-trace/arc for more details.

They are compressed with Zstandard. Run the following command to expand.

$ cd cache-trace/arc
$ zstd -d *.lis.zst
$ cat spc1likeread.lis.zst.* | zstd -d - > spc1likeread.lis

You may need to install zstd first. For example, on Ubuntu:

$ sudo apt install zstd

or on macOS using Homebrew:

$ brew install zstd

In the future, you will not need to expand the trace files manually. Mokabench will add support for directly reading the compressed trace files. (#13)

Build Mokabench

To build with the default features, run the following command. This will enables the latest version of Moka.

$ cargo build --release

Enabling Other Cache Products

If you want to enable other cache products, use crate features.

For example:

## Enable Mini-Moka and quick_cache in addition to the latest version of Moka.
$ cargo build --release -F mini-moka,quick_cache

## Disable the latest version of Moka, but enable v0.9.x.
$ cargo build --release --no-default-features -F moka-v09,rt-tokio

Features to select cache products:

Feature Enabled Cache Product
moka-v012 Moka v0.12.x (Enabled by default)
moka-v011 Moka v0.11.x
moka-v010 Moka v0.10.x
moka-v09 Moka v0.9.x
moka-v08 Moka v0.8.x
hashlink HashLink
mini-moka Mini-Moka
quick_cache quick_cache
stretto Stretto
tiny-ufo TinyUFO

Features to select async runtime:

Only used by Moka async cache.

Feature Enabled Cache Product
rt-tokio Tokio (Enabled by default)
rt-async-std async-std

NOTES:

  • moka-v012 and rt-tokio are enabled by default.
  • moka-v012, moka-v011, moka-v010, moka-v09 and moka-v08 are mutually exclusive.
  • mini-moka cannot be enabled when moka-v09 or moka-v08 is enabled.

Run Benchmarks

Here are some examples to run benchmarks:

## Run with the default (S3.lis) dataset, using single client thread,
## and then 3 client threads, and so on.
$ ./target/release/mokabench --num-clients 1,3,6

## Run with DS1.lis dataset.
$ ./target/release/mokabench --num-clients 1,3,6 --trace-file ds1

## Run with an insertion delay (in microseconds) to simulate more
## realistic workload. The following example will try to add ~1
## microseconds delay before inserting a value to the cache.
##
## Note: It uses `std::thread::sleep` and many operating systems
## have a minimum sleep resolution larger than 1 microsecond. So
## the actual delay may be larger than the specified value.
##
$ ./target/release/mokabench --num-clients 1,3,6 --insertion-delay 1

You can also test Moka's advanced features/APIs:

## Call `get` and `insert` with time-to-live = 3 seconds and
## time-to-idle = 1 second.
$ ./target/release/mokabench --ttl 3 --tti 1

## Also call `get_or_insert_with`.
$ ./target/release/mokabench --ttl 3 --tti 1 --insert-once

## Call `get`, `insert` and `invalidate`.
$ ./target/release/mokabench --invalidate

## Call `get`, `insert` and `invalidate_all`.
$ ./target/release/mokabench --invalidate-all

## Call `get`, `insert` and `invalidate_entries-if`.
$ ./target/release/mokabench --invalidate-entries-if

## Run with everything.
$ ./target/release/mokabench --ttl 3 --tti 1 \
    --insert-once --invalidate \
    --invalidate-all --invalidate-entries-if

License

Mokabench is distributed under the MIT license. See LICENSE-MIT for details.

Footnotes

  1. "ARC: A Self-Tuning, Low Overhead Replacement Cache" by Nimrod Megiddo and Dharmendra S. Modha. โ†ฉ

mokabench's People

Contributors

tatsuya6502 avatar arthurprs avatar

Stargazers

 avatar Croxx avatar pa avatar JinYan Su avatar Basel Ajarmah avatar George Kontridze avatar Vipul Vaibhaw avatar

Watchers

 avatar James Cloos avatar

mokabench's Issues

`cargo update` emits an error on yanked version of`wg` crate

cargo update emits an error on yanked version ofwg crate.

$ cargo update
    ...
    Updating crates.io index
error: failed to select a version for the requirement `wg = "^0.3"`
candidate versions found which didn't match: 0.9.1, 0.9.0, 0.8.3, ...
location searched: crates.io index
required by package `stretto v0.7.1`
    ... which satisfies dependency `stretto = "^0.7.1"` of package `mokabench v0.10.0 (... /mokabench)`
perhaps a crate was updated and forgotten to be re-vendored?

stretto v0.7.1 depends on the yanked version v0.3 of wg. We should update stretto to v0.8.x.

Rename `.cargo/config` to `.cargo/config.toml`

We need to rename .cargo/config to .cargo/config.toml because the latest stable Cargo (Rust 1.78.0) emits the following warning:

$ cargo run
warning: `... /mokabench/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`

Support trace files compressed by Zstandard (`.zst`)

Support directly reading a trace file compressed by Zstandard (.zst). We can use ruzstd, a pure Rust implementation of Zstandard decompressor.

Background

I created a repository and put the ARC trace files there. I did it because the original files are no longer available for download (#12).

When I put them, I compressed them using Zstandard to save storage space. It will be convenient if mokabench can read them without decompressing by hands.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.