-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Tracing
Cache tracing can be enabled to capture information on how well an application utilizes its caches. Typically caches are either too small due to statistics not being monitored, or too large due to over sizing to increase the hit rate. Running the simulator on traced data enables adjusting the cache size based on both the hit rate and active content ratio.
Tracing is captured automatically if tracing is enabled at the application level. The caches themselves do not require any special configuration. By default a cache instance's name is inferred by a best effort guess of the calling class's name. The name can be explicitly set using Caffeine.named(Supplier)
.
The tracing package is enabled if a Java ServiceLoader service is registered with the application in a resource file located at META-INF/services
in one of its jars. The system property caffeine.tracing.enabled
can be set to false
to ignore the discovered implementation.
compile 'com.github.ben-manes.caffeine:tracing-async:1.0.0'
AsyncTracer
is a lightweight implementation based on the LMAX Disruptor library that logs the events to a local file. It is configured using the following system properties:
-
caffeine.tracing.file:
The path to the tracing output file -
caffeine.tracing.format:
The format is eithertext
orbinary
-
caffeine.tracing.bufferSize
: The size of the disruptor's ringbuffer