Skip to content

Memory consumption

Description

These benchmarks utilize pre-generated 32-byte key-value pairs (fixed-size strings). All implementations were tested with expiration policies enabled to measure memory overhead - representing the most common cache usage pattern.

The source code can be found here.

Capacity (1000)

This benchmark measures memory overhead for a cache with a fixed capacity of 1,000 entries.

memory_1000

Capacity (10000)

This benchmark measures memory overhead for a cache with a fixed capacity of 10,000 entries.

memory_10000

Capacity (25000)

This benchmark measures memory overhead for a cache with a fixed capacity of 25,000 entries.

memory_25000

Capacity (100000)

This benchmark measures memory overhead for a cache with a fixed capacity of 100,000 entries.

memory_100000

Capacity (1000000)

This benchmark measures memory overhead for a cache with a fixed capacity of 1,000,000 entries.

memory_1000000

Conclusion

Otter maintains low memory overhead across all capacity levels - a notable achievement considering its additional read/write buffer implementation.

Note that Ristretto typically consumes less memory than competing cache implementations. This optimization comes with a significant tradeoff - the library employs an unconventional approach where it stores only dual hash values instead of actual keys.