#key-value-store #numbers #constant-time #byte #byte-stream #data-stream #generator

bin+lib guacamole

Guacamole provides a linearly-seekable random number generator

11 releases (breaking)

0.9.0 Oct 8, 2024
0.7.0 Aug 19, 2024
0.6.1 Jan 15, 2024
0.5.0 Dec 27, 2023
0.2.1 Jul 9, 2023

#76 in Profiling

Download history 182/week @ 2024-07-29 324/week @ 2024-08-05 329/week @ 2024-08-12 511/week @ 2024-08-19 263/week @ 2024-08-26 220/week @ 2024-09-02 221/week @ 2024-09-09 142/week @ 2024-09-16 155/week @ 2024-09-23 89/week @ 2024-09-30 258/week @ 2024-10-07 199/week @ 2024-10-14 40/week @ 2024-10-21 74/week @ 2024-10-28 108/week @ 2024-11-04 124/week @ 2024-11-11

351 downloads per month
Used in 22 crates (16 directly)

Apache-2.0

70KB
2K SLoC

guacamole

Guacamole provides a linearly-seekable random number generator. It gives you a long continous stream of bytes (2**70 bytes worth) and the ability to seek to any 64-byte aligned offset within that stream in constant time. This is useful for benchmarks and other trials that need pseudo-data as it recreates the same data over time, so long as the same index and procedure are used.

The key example that guacamole is useful for is a large key-value-store workload. Imagine having 1e12 key-value pairs in a database. How would you keep track of that many keys to perform queries over the data in the workload without a second, large key-value store for them?

One answer is guacamole. Divide the 2**64 offsets into N contiguous ranges. Make them of equal size and it can be done with division/modulus. Each of the N ranges generates a different sequence of 2**64/N bytes which should be used as the sole basis of randomness for generating workload operations. Each time the same seed is used the same operation results.

Use Cases

Please link yours here as appropriate.

key-value-store workload: As described above, the guacamole is partitioned into N different keys and each acts as an independent stream. Higher- level randomness can take control of which key gets generated when, picking numbers [0, N) using that other source of randomness and then acting like pseudo-fn(x: usize) -> [blargh; x]

distributed filesystem workload: Files can be carved out of the seed-space, and then generated in parallel, with a 1:1 correspondence between bytes of guacamole and bytes of the files written out.

Status

Maintenance track. The library is considered stable and will be put into maintenance mode if unchanged for one year.

Scope

This library provides the guacamole type and a tool for drawing from a Zipf distribution.

Warts

Documentation

The latest documentation is always available at docs.rs.

Dependencies

~0–445KB