EHC ❯ Entry-count based caches still being sized
-
Bug
-
Status: Resolved
-
2 Major
-
Resolution: Fixed
-
ehcache-core
-
-
lorban
-
Reporter: gkeim
-
October 25, 2013
-
0
-
Watchers: 3
-
December 20, 2013
-
October 30, 2013
Description
Run the trunk EhcachePounder (https://svn.terracotta.org/repo/forge/projects/labs/EhcachePounder/trunk).
Case ‘standalone entries’
Import configurations/standalone-entries.xml.
- That configuration defines 3 non-clustered caches, each with maxEntriesLocalHeap and maxEntriesLocalDisk > 0. There are no pools defined at the CacheManager level.
Put a breakpoint on DefaultSizeOfEngine.sizeOf. Use the TMC to monitor this cluster. Go to the AppData|Charts page.
This stacktrace indicates sizeOf being used:
DefaultSizeOfEngine.sizeOf(Object, Object, Object) line: 192
OnHeapCachingTier<K,V>.getInMemorySizeInBytes() line: 257
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
StatisticsManager$MethodCallable<T>.call() line: 113
PassThroughStatistic<T>.value() line: 63
StatisticSampler$SamplingTask<T>.run() line: 105
Executors$RunnableAdapter<T>.call() line: 471
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>(FutureTask<V>).runAndReset() line: 304
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.access$301(ScheduledThreadPoolExecutor$ScheduledFutureTask) line: 178
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.run() line: 293
ScheduledThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1145
ThreadPoolExecutor$Worker.run() line: 615
Thread.run() line: 744
Case ‘clustered entries’
Import configurations/clustered-entries.xml.
- This configuration defaults 3 clustered caches, each specifying maxEntriesLocalHeap > 0 with no pools defined at the CacheManager level.
Browser to Charts panel again.
This stacktrace indicates sizing is occuring:
DefaultSizeOfEngine.sizeOf(Object, Object, Object) line: 192
MemoryStore.getInMemorySizeInBytes() line: 781
GeneratedMethodAccessor60.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
StatisticsManager$MethodCallable<T>.call() line: 113
PassThroughStatistic<T>.value() line: 63
SemiExpiringStatistic<T>(AbstractStatistic<T>).value() line: 57
SemiExpiringStatistic<T>.value() line: 33
StatisticsGateway.getLocalHeapSizeInBytes() line: 321
Cache.calculateInMemorySize() line: 2633
InternalClassLoaderAwareCache(ClassLoaderAwareCache).calculateInMemorySize() line: 300
OnlineEhcacheSMLocalStore.getOnHeapSizeInBytes() line: 130
EhcacheSMLocalStore.getOnHeapSizeInBytes() line: 177
L1ServerMapLocalCacheStoreImpl<K,V>.onHeapSizeInBytes() line: 82
ServerMapLocalCacheImpl.onHeapSizeInBytes() line: 702
TCObjectServerMapImpl<L>.getLocalOnHeapSizeInBytes() line: 1093
ExplicitLockingTCObjectServerMapImpl.getLocalOnHeapSizeInBytes() line: 375
ServerMap<K,V>.localOnHeapSizeInBytes() line: 1234
AggregateServerMap<K,V>.localOnHeapSizeInBytes() line: 800
ToolkitCacheImpl<K,V>.localOnHeapSizeInBytes() line: 495
GeneratedMethodAccessor59.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
NonStopInvocationHandler<T>.invokeMethod(Method, Object[], Object) line: 140
NonStopInvocationHandler<T>.invoke(Object, Method, Object[]) line: 41
$Proxy17.localOnHeapSizeInBytes() line: not available
EnterpriseClusteredStore(ClusteredStore).getInMemorySizeInBytes() line: 518
GeneratedMethodAccessor58.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
StatisticsManager$MethodCallable<T>.call() line: 113
PassThroughStatistic<T>.value() line: 63
StatisticSampler$SamplingTask<T>.run() line: 105
Executors$RunnableAdapter<T>.call() line: 471
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>(FutureTask<V>).runAndReset() line: 304
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.access$301(ScheduledThreadPoolExecutor$ScheduledFutureTask) line: 178
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.run() line: 293
ScheduledThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1145
ThreadPoolExecutor$Worker.run() line: 615
Thread.run() line: 744
Comments
Ludovic Orban 2013-10-30
Ludovic Orban 2013-10-30
Backported fix to ehcache 2.7.x branch, r8400.
This happens because cache attributes (/agents/cacheManagers/caches) do exclude on-heap size in bytes stats when a cache is configured count-based while cache statistics (/agents/cacheManagers/caches/statistics/samples) don’t.
I added some code to CacheStatisticSampleEntityBuilder to perform the same kind of exclusion as CacheEntityBuilder does, ie: no on-heap size in bytes stat for count-based caches.