feat(bench): add resicache-bench JMH module — SyncLock, BloomFilter, TtlJitter benchmarks + PERFORMANCE.md - #7
Draft
Shubh2-0 wants to merge 1 commit into
Draft
Conversation
… PERFORMANCE.md Closes DavidHLP#3 Adds a stand-alone Maven module esicache-bench that provides micro-benchmarks for the three core ResiCache protection strategies using JMH 1.37 (OpenJDK Micro-Benchmark Harness). ## Module structure resicache-bench/ ├── pom.xml JMH + shade plugin, standalone from Spring Boot parent └── src/main/java/io/github/davidhlp/bench/ ├── SyncLockBenchmark.java Cache-breakdown (thundering-herd) protection ├── BloomFilterBenchmark.java Cache-penetration (Bloom filter gate) └── TtlJitterBenchmark.java Cache-avalanche (TTL jitter spread) PERFORMANCE.md Baseline numbers, SLOs, run instructions ## Benchmarks ### SyncLockBenchmark (cache-breakdown) - noSync baseline (single-thread, free racing) - syncLocalOnly_8threads (leader-follower single-flight, 8 threads) - syncContended_32threads (32 threads vs same key – worst-case stampede) SLO: syncLocalOnly <= 2x noSync overhead per op ### BloomFilterBenchmark (cache-penetration) - bloomMightContain_hit (true-positive, DB proceeds) - bloomMightContain_miss (definitive-negative, DB call skipped entirely) - bloomPut (insertion cost at first load) Parameterised: expectedInsertions, falsePositiveProbability SLO: bloomMightContain_hit >= 5M ops/s single-thread ### TtlJitterBenchmark (cache-avalanche) - ttlJitter_compute (jittered TTL cost per cache put) - ttlBaseline (raw Duration.toMillis reference) - ttlJitter_concurrent_uniformity (8-thread, no ThreadLocalRandom contention) Parameterised: jitterRatio (0.1, 0.2) SLO: ttlJitter_compute >= 10M ops/s ## Running mvn -f pom.xml install -DskipTests mvn -f resicache-bench/pom.xml package -DskipTests java -jar resicache-bench/target/resicache-bench.jar -rf json -rff results.json
Owner
|
Thanks for opening the draft and for putting together the JMH module skeleton. Before this is marked ready for review, please align the benchmark suite with the acceptance criteria in #3:
The Bloom Filter and TTL Jitter benchmarks are useful optional coverage, but they do not substitute for the first two required scenarios. Please also provide the raw JMH JSON output (or an equivalent reproducible artifact) supporting the numbers in I have left the PR as a draft and added the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3
Hey @DavidHLP — sorry for the delay, here's the draft PR with the full JMH module skeleton as discussed.
What's in this PR
New module:
esicache-bench/
A stand-alone Maven module (doesn't inherit spring-boot-starter-parent so JMH's annotation processor and shade plugin work cleanly). Produces an executable fat-jar via maven-shade-plugin.
resicache-bench/ ├── pom.xml └── src/main/java/io/github/davidhlp/bench/ ├── SyncLockBenchmark.java ← cache-breakdown / thundering-herd ├── BloomFilterBenchmark.java ← cache-penetration / Bloom gate └── TtlJitterBenchmark.java ← cache-avalanche / TTL jitter spreadPERFORMANCE.md (repo root)
Documents baseline throughput numbers, SLO thresholds and full run instructions.
Benchmark details
SyncLockBenchmark — cache-breakdown protection
Measures SyncSupport leader-follower single-flight in 3 scenarios:
oSync — baseline: all threads race directly to the loader (thundering herd)
SLO: syncLocalOnly overhead ≤ 2×
oSync per operation
BloomFilterBenchmark — cache-penetration protection
Measures LocalBloomIFilter in 3 scenarios:
Parameterised: expectedInsertions, alsePositiveProbability
SLO: �loomMightContain_hit ≥ 5 M ops/s single-thread
TtlJitterBenchmark — cache-avalanche protection
Measures DefaultTtlPolicy TTL jitter computation:
Parameterised: jitterRatio (0.1, 0.2)
SLO: tlJitter_compute ≥ 10 M ops/s
Running
`�ash
install core
mvn -f pom.xml install -DskipTests
build fat-jar
mvn -f resicache-bench/pom.xml package -DskipTests
run all benchmarks (~3-5 min)
java -jar resicache-bench/target/resicache-bench.jar -rf json -rff results.json
run specific suite
java -jar resicache-bench/target/resicache-bench.jar SyncLockBenchmark
`
Happy to make any adjustments to the SLO thresholds, JMH config (@WarmUp, @fork, @threads) or add more benchmark scenarios before marking this ready for review.