2 Replies Latest reply on Apr 7, 2016 7:32 AM by Mudiaga Obada

    Efficient way to clear TreeCache?

    Mudiaga Obada Newbie

      Hello everyone,

       

      we had a situation where network issues caused Infinispan TreeCache to become unacceptably slow.

      The scenario was one where a replicated cache needed to be initialize from external storage.

       

      Analysis of the problem showed that treeCache.getRoot().removeChildren() was particularly slow

      (even with IGNORE_RETURN_VALUES and SKIP_LOCKING flags).

       

      Question: Is there a more efficient way to clear a TreeCache?

       

      Notes:

        *) We are using Infinispan 5.2.15 on JBoss EAP 6.4

        *) The cache in obtained from the JBoss infinispan subsystem so recreating the underlying Cache and TreeCache is not desirable.

        *) I tried the following hack that exploits Cache.clear() and the internal implementation details of TreeCacheFactory and TreeCacheImpl (up till 8.0):

       

             treeCache.getCache().clear(); // Empty the cache with ClearCommand

             (void) TreeCacheFactory.createTreeCache(treeCache); // Recreate the root nodes

       

           It gave the kind of performance that would be desirable when a TreeCache needs to be cleared.

       

      I would appreciate your advice.

       

      Thanks.