jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn Hendriks (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1112) CacheManager interval between recalculation of cache sizes should be configurable
Date Wed, 19 Sep 2007 09:57:43 GMT

    [ https://issues.apache.org/jira/browse/JCR-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528718
] 

Martijn Hendriks commented on JCR-1112:
---------------------------------------

Hi,

I think that there are some issues with the current CacheManager that could be improved:

- The MLRUItemStateCache.touch method triggers the CacheManager.cacheAccessed method, which
may call resizeAll. When the system is heavily loaded, many threads may unnecessarily be blocked
by the synchronized block in CacheManager.cacheAccessed. The chances for this increase as
SLEEP decreases and the time needed for resizeAll increases. This could easily be improved
.

- The resizeAll method is expensive (for MLRUItemStateCaches, which are used everywhere) because
it calls MLRUItemStateCache.getMemoryUsed, which recalculates the size of each entry in the
cache (linear complexity in the size of the cache...). Since the NodeState/PropertyState.calculateMemoryFootprint
seem to give approximate values anyway, wouldn't it be an idea to keep track of the approximate
cache size in the MLRUItemStateCache itself? Furthermore, getMemoryUsed even blocks read-access
to the cache. A large shared cache such as the one of the SharedItemStateManager suffers significantly
from this, I think.

The minimum time between rebalancing seems small but, as Thomas noted, there are certain use-cases
where this is needed. Isn't there a way to detect such extreme cache blowups in another way?
When, for instance, a MLRUItemStateCache keeps track of its own approximate size, the time
derivative of this size could be used to prevent blowups.

Best wishes,

Martijn

> CacheManager interval between recalculation of cache sizes should be configurable
> ---------------------------------------------------------------------------------
>
>                 Key: JCR-1112
>                 URL: https://issues.apache.org/jira/browse/JCR-1112
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: core
>            Reporter: Przemo Pakulski
>            Assignee: Thomas Mueller
>            Priority: Minor
>         Attachments: JCR-1112.txt
>
>
> Currently interval between recaluclation of cahce size is hard coded to 1000 ms. Resizing/recalculation
of cache size is quite expensive method (especially getMemoryUsed on MLRUItemStateCache is
time consuming)
> Depending on the configuration, we realized that under some load up to 10-15% percent
of CPU time (profiler metrics) could be spend doing such recalculations. It does not seem
to be needed to resize cache every second. Best this interval should be configurable in external
config. file with other cache settings (like memory sizes).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message