How can I identify "Hot Keys" in my Partitioned Cache?

Partitioned caches which contain a small set of very hot keys have the potential to unevenly balance cluster traffic. The attached agent shows how to check for such keys. To use this agent, include the HotKeyAgent.jar (source) file in the classpath of each cache server, and ensure that the servers are running either the Management or Invocation Service. To check for hot keys run the jar, supplying the name of the cache you wish to check. Additionally you may specify the number of keys per server to return, and the Invocation Service which should be used to perform the check.

This example assumes a cluster containing four cache servers and 10000 keys, where key 1000 is very hot. In this example only the top 3 keys from each server are requested.

$ java -jar HotKeyAgent.jar myCache 3

CacheServer Member(Id=1, Timestamp=2007-02-16 10:48:17.328, Address=192.168.0.204:8088, MachineId=26828) handled 12.8% of total cache access
Key '306' accounted for 0.39% of cache access for server
Key '556' accounted for 0.39% of cache access for server
Key '192' accounted for 0.39% of cache access for server

CacheServer Member(Id=3, Timestamp=2007-02-16 10:48:20.203, Address=192.168.0.204:8089, MachineId=26828) handled 12.6% of total cache access
Key '953' accounted for 0.39% of cache access for server
Key '791' accounted for 0.39% of cache access for server
Key '47' accounted for 0.39% of cache access for server

CacheServer Member(Id=5, Timestamp=2007-02-16 10:50:10.5, Address=192.168.0.204:8091, MachineId=26828) handled 12.45% of total cache access
Key '120' accounted for 0.4% of cache access for server
Key '246' accounted for 0.4% of cache access for server
Key '549' accounted for 0.4% of cache access for server

CacheServer Member(Id=2, Timestamp=2007-02-16 10:48:20.14, Address=192.168.0.204:8090, MachineId=26828) handled 62.15% of total cache access
Key '1000' accounted for 80.45% of cache access for server
Key '175' accounted for 0.08% of cache access for server
Key '171' accounted for 0.08% of cache access for server


Attachments:
HotKeyAgent.jar (application/octet-stream)
HotKeyAgent.java (text/plain)