glittershark / rust-evmap

A lock-free, eventually consistent, concurrent multi-value map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This crate holds the implementation of the left-right concurrency primitive, and its primary user evmap. See the documentation for each crate for details.

Left-right is a concurrency primitive for high concurrency reads over a single-writer data structure. The primitive keeps two copies of the backing data structure, one that is accessed by readers, and one that is access by the (single) writer. This enables all reads to proceed in parallel with minimal coordination, and shifts the coordination overhead to the writer. In the absence of writes, reads scale linearly with the number of cores.

Build Status Codecov

left-right

Crates.io Documentation

evmap

Crates.io Documentation

Performance

These benchmarks are outdated at this point, but communicate the right point. Hopefully I'll have a chance to update them again some time soon.

I've run some benchmarks of evmap against a standard Rust HashMap protected by a reader-writer lock, as well as against chashmap — a crate which provides "concurrent hash maps, based on bucket-level multi-reader locks". The benchmarks were run using the binary in benchmark/ on a 40-core machine with Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz CPUs.

The benchmark runs a number of reader and writer threads in tight loops, each of which does a read or write to a random key in the map respectively. Results for both uniform and skewed distributions are provided below. The benchmark measures the average number of reads and writes per second as the number of readers and writers increases.

Preliminary results show that evmap performs well under contention, especially on the read side. This benchmark represents the worst-case usage of evmap in which every write also does a refresh. If the map is refreshed less often, performance increases (see bottom plot).

Read throughput Write throughput Write throughput

About

A lock-free, eventually consistent, concurrent multi-value map.

License:Apache License 2.0


Languages

Language:Rust 98.5%Language:R 1.5%