Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This is a basic benchmarking implementation for the https://github.com/srivathsashreyas/cache-custom repository. It simulates concurrent TCP clients accessing a cache (using a Zipfian key distribution) measuring hit rate, latency, memory usage, and eviction behavior.

How to Run

  1. go build -o benchmark cmd/cache-custom-benchmark/*.go
  2. ./benchmark -entries 100000 -clients 10 tps 100 duration 1000 (runs the benchmark for 1000 seconds at 100 TPS using 10 concurrent TCP clients. Keys will be in the range [0, 100000[ )

How it Works

  1. The benchmark generates a scrambled zipfian distribution of keys (simulating realistic access patterns where some keys are accessed more frequently than others) in the range [0, numEntries[
  2. A connection pool of size numClients is created
  3. A request is initiated every 1/tps seconds. If a connection from the pool is available, it is used to send the request. If not, the request is aborted
  4. Each request performs a GET on a generated key. If the key is not found, a SET is issued to insert it. The value is identical to the key.

Sample Output

The output below was obtained by running the benchmark and cache server on WSL

-------------------------------------
Key range: [0,100000[
TPS: 100
Num Clients (connection pool size): 10
Time to complete all operations: 16m40.726864096s
Used Memory: 160000 bytes | Max Memory: 160000 bytes | Evictions: 54334 | Heap Usage(All Tenants): 2951616 bytes
GET -> P50: 688.282µs, P90: 1.109475ms, P99: 1.65301ms
SET -> P50: 506.886µs, P90: 889.565µs, P99: 1.303599ms
Total operations: 100000 | Hits: 35666 | Misses: 64334 | Hit Rate: 0.356660 | Aborted: 0
Benchmarking completed successfully
-------------------------------------

Releases

Packages

Contributors

Languages