View Cache Effectiveness and Manage Configuration
Terracotta comes with a console
that lets you inspect and dynamically change the runtime contents, statistics,
and configuration of the distributed cache.
To see it in action, start the console:
%> <terracotta>/bin/dev-console.sh
When the console starts, you will see a
splash screen prompting you to connect to the
Terracotta server. The Terracotta server
coordinates all of the statistics gathering
and configuration management of the cache
cluster.
Click the "Connect..." button to connect the
console to the cluster.

Once connected, open the Hibernate cache
statistics and configuration panel by clicking
on Hibernate in the tree-control menu:

The "Entities," "Collections," and "Queries"
panels in the Hibernate pane display basic
Hibernate statistics for the whole cluster as well as discrete statistics for
each individual application server.
To see the clustered cache statistics for Hibernate, click on the "Second-Level Cache" button:

Click reload on your browser a few times and you will see the meter in the console register a green bar indicating cache hits. The red bar indicates cache misses and the blue bar indicates cache puts:

Click on the "Statistics" tab in the console to see the runtime statistics graphs:

Click on the "Configuration" tab in the console to view and manage the cache configuration:

Try changing the "time to idle" parameter on the cache to 10 seconds to see the configuration change in real time:

You can see the effect of the configuration change by looking at the cache hit rate in the console. If you load an event into cache and then read it from the cache before the 10 second idle threshold, it will be loaded from cache. After 10 seconds of idleness, the cached event will be evicted from the cache. If you view the other application server, you'll see the cache entries have been evicted uniformly from all instances of the cache.
|