During load and soak testing several cached endpoints among the services that I've been running I've come across several instances of what is often referred to as cache stampede. Three issues in this repository were closed: #95, #107, #233. I've raised similar issues in the ASP.NET Core repo (mitigations are in as of most recent version 7), in the Play2 repo (no mitigations) and in the Quarkus repo (mitigated via lock).
Consider a simple microservice at localhost:8080 that only sanitizes HTML data from a given resource.
or against any other source of HTML data specified in the address query param, spawns 100 concurrent inbound connections.
Expectations:
Now on an initial run I expect them all to result in a cache miss but the cache be populated only once, not over 300 times. For some reason the methods are evaluated multiple times.
JVM should not crash (64m max heap results in thread starvation and OutOfMemory when all invocations begin populating the cache).
Cache should expire as defined in application.yml.
HTTP Cache-Control headers should be set automatically and correspond to the actual values.
The performance of the cache should be on par with Akka HTTP using Caffeine.
Baseline Akka HTTP latencies and throughput (-Xmx64m):
Expected Behavior
During load and soak testing several cached endpoints among the services that I've been running I've come across several instances of what is often referred to as cache stampede. Three issues in this repository were closed: #95, #107, #233. I've raised similar issues in the ASP.NET Core repo (mitigations are in as of most recent version 7), in the Play2 repo (no mitigations) and in the Quarkus repo (mitigated via lock).
Consider a simple microservice at
localhost:8080
that only sanitizes HTML data from a given resource.Running
or against any other source of HTML data specified in the
address
query param, spawns 100 concurrent inbound connections.Expectations:
application.yml
.Baseline Akka HTTP latencies and throughput (
-Xmx64m
):For more info just see my remarks in the other repos.
Actual Behaviour
application.yml
).Cache-Control
headers are set automatically.Micronaut with
-Xmx128m
(64m just crashes due to stampede), slightly better figures without boundsSteps To Reproduce
Controller
application.yml
HttpClientService
WebsiteSanitizerService
Environment Information
macOS 12.6 OpenJDK 19.0.1
Example Application
No response
Version
3.6.2