Author |
Message |
10/02/2013 02:36:32
|
os382
neo
Joined: 10/02/2013 02:16:17
Messages: 6
Offline
|
Hello,
I'm using ehcache 2.7.4 with hibernate 3.3.2.
I'd like to use tmc to monitor the cache.
I deploy tmc.war and succesfully connect to the cache.
I set "Polling Interval Seconds" to 1 second.
I perform some operations which use the cache (by inspecting logs I can tell that cache is hit and org.hibernate.SessionFactory.getStatistics().secondLevelCacheHitCount/queryCacheHitCount also prove this).
Tmc however displays information ("Hit Ratio", "Hit Rate", etc) about this fact only for a while, after which all values are set to 0.
Why does it act as described?
How can I change this behaviour to retain non-zero values?
Ehcache.xml (I previously used ehcache 1.2.3)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache updateCheck="false">
<diskStore path="java.io.tmpdir" />
<managementRESTService enabled="true" bind="0.0.0.0:9888" />
<defaultCache maxElementsInMemory="10000" eternal="false"
timeToLiveSeconds="120" overflowToDisk="false" diskPersistent="false"
diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" />
<cache name="model.Dictionary"
maxElementsInMemory="1300" eternal="false" timeToLiveSeconds="300"
overflowToDisk="true" diskPersistent="false"
memoryStoreEvictionPolicy="LRU" statistics="true" />
</ehcache>
Thanks
|
|
|
10/02/2013 06:29:06
|
adahanne
master
Joined: 03/20/2012 23:14:46
Messages: 95
Offline
|
Hello,
A few ideas :
* can you try to change the polling setting to 5 sec ? and check if the values are not null anymore ?
* can you try, in your browser, to refresh a few time this resource (the Ehcache Rest agent response) :
http://localhost:9888/tc-management-api/agents/cacheManagers/caches/statistics/samples
--> if hitratio or hit rate returning 0 and should not, please tell us and send us your project (or a similar one reproducing the issue if you can't)
Here is what I get locally : http://pastie.org/8372134
* can you try, in your browser to refresh a few time this resource (the TMC Rest Api aggregated response) :
http://localhost:9889/tmc/api/agents/cacheManagers/caches/statistics/samples
--> if hitratio or hit rate returning 0 and should not, please tell us and send us your project (or a similar one reproducing the issue if you can't)
Here is what I get locally : http://www.pastebin.ca/2461167
With those results, I'll be able to determine where your issue is : on the Ehcache Agent side or on the TMC side
Thank you
|
|
|
10/03/2013 00:52:36
|
os382
neo
Joined: 10/02/2013 02:16:17
Messages: 6
Offline
|
Hi,
Thanks for the answer.
1. Setting pooling to more than 1 sec causes only zeros to be shown (as opposite to 1 sec, where non-zero values were for a short moment)
2. http://localhost:9889/tc-management-api/agents/cacheManagers/caches/statistics/samples
http://pastebin.ca/2461544
[{"version":null,"agentId":"embedded","name":"org.hibernate.cache.StandardQueryCache","cacheManagerName":"__DEFAULT__","statName":"CacheHitRatio","statValueByTimeMillis":
{"1380785813952":0,"1380785814952":0,"1380785815952":0,"1380785816952":0,"1380785817952":0,"1380785818952":0,"1380785819952":0,"1380785820952":0,"1380785821952":0,"1380785822952":0,
"1380785823972":0,"1380785824952":0,"1380785825952":0,"1380785826952":0,"1380785827952":0,"1380785828952":0,"1380785829952":0,"1380785830952":0,"1380785831952":0,"1380785832952":0,
"1380785833952":0,"1380785834952":0,"1380785835952":0,"1380785836953":0,"1380785837953":0,"1380785838953":0,"1380785839953":0,"1380785840953":100,"1380785841953":0,"1380785842953":0}},{"version":null,"agentId":"embedded","name":"org.hibernate.cache.StandardQueryCache","cacheManagerName":"__DEFAULT__","statName":"CacheHit","statValueByTimeMillis":
{"1380785813952":0,"1380785814952":0,"1380785815952":0,"1380785816952":0,"1380785817952":0,"1380785818952":0,"1380785819952":0,"1380785820952":0,"1380785821952":0,"1380785822952":0,
"1380785823972":0,"1380785824952":0,"1380785825952":0,"1380785826952":0,"1380785827952":0,"1380785828952":0,"1380785829952":0,"1380785830952":0,"1380785831952":0,"1380785832952":0,
"1380785833952":0,"1380785834952":0,"1380785835952":0,"1380785836953":0,"1380785837953":0,"1380785838953":0,"1380785839953":0,"1380785840953":1,"1380785841953":0,"1380785842953":0}},
3. http://localhost:9889/tmc/api/agents/cacheManagers/caches/statistics/samples
http://pastebin.ca/2461547
Here I couldn't find anything
|
|
|
10/03/2013 12:16:44
|
adahanne
master
Joined: 03/20/2012 23:14:46
Messages: 95
Offline
|
Hello,
those responses you got indicate that there are few hits on the caches.
Did you make sure there is activity wrt the cache ? (frequent get/put)
I'm not talking about hibernate here, the agent will only give you cache activity.
If you're sure the agent did not report proper values, please share a sample project so that we can re run it ourselves and reproduce the issue.
thanks
|
|
|
10/03/2013 23:08:54
|
os382
neo
Joined: 10/02/2013 02:16:17
Messages: 6
Offline
|
adahanne wrote:
Hello,
Did you make sure there is activity wrt the cache ? (frequent get/put)
I'm not talking about hibernate here, the agent will only give you cache activity.
I'm not quite sure what do you mean?
adahanne wrote:
please share a sample project so that we can re run it ourselves and reproduce the issue.
Do you also want db schema with dataload script?
|
|
|
10/04/2013 06:27:05
|
adahanne
master
Joined: 03/20/2012 23:14:46
Messages: 95
Offline
|
hello,
what I mean is that I'd like to make sure that there are hits and misses on your caches before investigating why the ehcache rest agent reported almost no activity.
I think in your case everything's working normally : your app (through hibernate) does not seem to be hitting the caches.
For the reproducible example, I'd like the simplest reproducible test case; so that I'm sure to reproduce it.
thanks
|
|
|
10/04/2013 08:25:40
|
os382
neo
Joined: 10/02/2013 02:16:17
Messages: 6
Offline
|
I've written a very simple test where there are 4 items put into the cache and only 1 get, so it's not a frequent activity, but does it matter?
Perhaps I misunderstood how TMC works. I'd expect that this "1" would be displayed till the very end of ehcache running, am I wrong?
|
|
|
10/04/2013 09:37:48
|
adahanne
master
Joined: 03/20/2012 23:14:46
Messages: 95
Offline
|
hit ratio , hit rate are "live" /dynamic values
don't expect to see anything if nothing is going on
|
|
|
10/07/2013 07:41:07
|
os382
neo
Joined: 10/02/2013 02:16:17
Messages: 6
Offline
|
Then all is clear.
Please close the thread.
Thanks for help
|
|
|
|
|
|