Skip to content

Instantly share code, notes, and snippets.

View ben-manes's full-sized avatar

Ben Manes ben-manes

View GitHub Profile
@ben-manes
ben-manes / putremove_results_dragonwell_21.json
Last active April 20, 2025 17:12
Put/Remove JMH Results
[
{
"jmhVersion" : "1.37",
"benchmark" : "com.github.benmanes.caffeine.cache.PutRemoveBenchmark.group",
"mode" : "thrpt",
"threads" : 8,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-21-jdk-amd64/bin/java",
"jvmArgs" : [
"-Xmx4g"
@ben-manes
ben-manes / freq_results_dragonwell_21.json
Last active April 20, 2025 17:33
FrequencySketch JMH Results
[
{
"jmhVersion" : "1.37",
"benchmark" : "com.github.benmanes.caffeine.cache.FrequencySketchBenchmark.frequency",
"mode" : "thrpt",
"threads" : 1,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-21-jdk-amd64/bin/java",
"jvmArgs" : [
"-Xmx4g"
@ben-manes
ben-manes / timerwheel_results_dragonwell_21.json
Last active April 20, 2025 17:15
TimerWheel JMH Results
[
{
"jmhVersion" : "1.37",
"benchmark" : "com.github.benmanes.caffeine.cache.TimerWheelBenchmark.ascending",
"mode" : "thrpt",
"threads" : 1,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-21-jdk-amd64/bin/java",
"jvmArgs" : [
"-Xmx4g"
[
{
"jmhVersion" : "1.37",
"benchmark" : "com.github.benmanes.caffeine.cache.EvictionBenchmark.evict",
"mode" : "thrpt",
"threads" : 1,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-21-jdk-amd64/bin/java",
"jvmArgs" : [
"-Xmx4g"

All versions of Ehcache 3 suffer from entries clustering which can lead to severely degraded performance and is a potential attack vulnerability (denial of service).

Observation

The performance of the eviction policy reduces as the cache size increases due to the eviction implementation in their customized hash table. On an M3 Max laptop, Ehcache takes over 18 minutes in an IBM SQL database workload trace, whereas Guava and Caffeine take only 15 seconds and 7 seconds respectively. The runtime will be significantly worse on typical, virtualized cloud compute rather than a high performance laptop.

$ git clone https://github.com/ben-manes/caffeine.git
$ pushd caffeine ; git checkout 2fee4bdaff40a76c44cccbdfe954059ed6c3f2bc ; popd
$ wget https://github.com/moka-rs/cache-trace/raw/ef0a9de8cf0202a1f2fee186a0af497774b0f0a9/arc/DS1.lis.zst
$ ./caffeine/gradlew --project-dir caffeine simulator:run -q \