...
This article serves to dive deeper into the internal architecture of two of the Geode session management modules - the Tomcat session module and TC Server session module. The third session state module is the generic AppServer session module, but the use cases of this module are dwindling as most can be addressed using Spring Session for Apache Geode. There is still enough demand for the Tomcat and TC Server session modules to justify documenting their internals. It is important to note that the Tomcat and TC session modules share the exact same jars, and the only difference between the two lies in additional/different configuration and scripting for TC serverthem is configuration and setup scripts. As such, for the remainder of this article, we will just refer to the Tomcat module, but all of this analysis also applies to TC Server module.
...
The SessionCache provides access to the Geode Cache and Region used to store the Session objects. This includes adding, removing, and "touching" sessions (resetting their TTL by performing a get on the region entry). This component abstracts away most of the actual interaction with the Geode specific components from the SessionManager (with the exception of session persistence to disk). Most of the logic for managing sessions is in the AbstractSessionCache base class, but depending on the chosen topology either a ClientServerSessionCache or a PeerToPeerSession class will be used. A summary of the differences between these two SessionCache implementations are outlined below:
...
- "Bootstraps" the servers with functions for creating the server session region, "touching" sessions (updating TTL), and retrieving the session region size
- Creates and validates the server session region (PARTITION_REDUNDANT) via server-side function execution
- Creates the local session region using ClientRegionFactory (CACHING_PROXY_HEAP_LRU)
- "Touches" sessions (performing a get on the region entry) to update TTL using onServers for replicated regions or onRegion for partitioned regions
...
- Registers functions for "touching" sessions (updating TTL)
- Creates and validates the server session region (REPLICATE)
- "Touches" sessions (performing a get on the region entry) to update TTL using onMembers for replicated regions or onRegion for partitioned regions
...