Version 6

    We are currently using jbosscache core 3.2.1.GA and currently push literally millions of records into it. We have asynchronous listeners processing the data as it is put into the cache.


    The problem is that the listeners cannot process the data quickly enough and this causes a backlog in the async queue size (which is set to a number in the millions). Increasing the Async pool size over 250 does not help either based on the various (but necessary) locks we have in place.


    In order to successfully manage the backlog, we needed to monitor the cache's Async Listener's Queue size to see when it grows too large. Unfortunately, we could not find a way to access these type of stats from the cache, so we downloaded the source code and exposed these stats ourselves.


    Code Modifications


    1. We created a new immutable VO called org.jboss.cache.notifications.NotifierRuntime which holds the various statistics relating to the async listener queue and pool
    2. In the org.jboss.cache.notifications.NotifierImpl class, keep a reference to the ThreadPoolExecutor which the BoundedExecutor assigns to the AsyncProcessor since this contains all the information you need to extract the queue size (along with other useful stats)
    3. Expose a method on the org.jboss.cache.notifications.Notifier interface and the org.jboss.cache.Cache interface to expose a method which returns this immutable object (org.jboss.cache.notifications.NotifierRuntime) which is populated with delicious data (Our object contains minimal info, but could easily be extended to expose a whole lot more data).


    These statistics have helped us manage the backlog and keep our application afloat.


    To access these stats, all you need to do is invoke the getNotifierRuntime() on the org.jboss.cache.Cache interface.


    I have attached the source code for anyone who has a similar requirement.




    I have updated the jbosscache-core source code for for 3.2.5.AG (please find the jar attached). I replicated the steps mentioned above and no additional steps were required.