Version 9

    The purpose of this page is to detail how JBoss Cache is used in JBoss AS.


    Cache Manager

    HTTP Session Replication


    Default configuration


    EJB3 Session Replication


    Integration code is in svn here in the org.jboss.ejb3.cache.tree package.

    Testsuite is here via the clustered-tests target. The actual test code is in the org.jboss.ejb3.test.clusteredsession package.

    A new implementation is in the works which will better define the SPI for the jbc integration.


    Basic characteristics:


    Session-type use case. Sessions are only meant to be accessed on one node at a time, with that node remaining sticky. Replicating data via JBC is solely to provide HA in case of loss/shutdown of the owning node or some failure in session stickiness. Session stickiness makes this a good candidate for buddy replication.


    JBC features used:


    • Passivation
    • FileCacheLoader (default; users can configure their choice, but FCL is the logical choice for most environments)
    • Eviction
      • Programmatic registration of eviction regions
      • Custom eviction algorithm based on LRUAlgorithm
      • JBC-based eviction will be removed in future in favor of direct control of eviction by the integration code. Calls to evict() will still be used.
    • Partial state transfer. When a bean is deployed, region associated with bean type is activated and state transferred.
    • Region based marshalling.
    • BuddyReplication (disabled by default)
    • REPL_SYNC or REPL_ASYNC, with async as the default
    • No TransactionManager. In the future BatchModeTransactionManager will be used.
    • Cache accessed via CacheManager.


    Storage structure inside JBC



    +++ /uniquenameofdeploymentandbean

    ++++++ /bucket [0-99]

    +++++++++ /sessionid


    Session is stored as a single K/V pair, key is string "bean", value is the StatefulBeanContext

    TODO: convert the key to an enum.


    The region for region-based-marshalling and partial state transfer is /sfsb/uniquenameofdeploymentandbean.


    The "bucket [0-99] Fqn level above is a workaround to a FileCacheLoader issue wherein some filesystems limit the max number of child directories under /sfsb/uniquenameofdeploymentandbean to ~32K.  The addition of 100 bucket nodes in the tree allows passivation of up to 3.2 million beans.


    Default configuration


    See the sfsb-cache config in the standard JBoss AS cache manager config file.

    Entity Caching (Hibernate)


    Integration Code is in svn here

    Testsuite is contained in the same project as the main code.

    Extensive documentation is available here


    For now, I (Brian) am not going to comment much on this as the docs are good and the code is clear; learn from those while I focus on the others. :-)  I'll come back to this later.)

    Default configuration




    Default configuration




    AS Wishlist


    This is on a JBoss AS 5.x wishlist for JBoss Cache 3.x


    Testing JBoss Cache with JBoss AS

    A Testing JBoss Cache 3 in AS 5 Trunk was created detailing how this can be done, specific to JBoss AS 5.