This topic explains how to change the default VMware Tanzu GemFire configuration in the Session Management extension.

By default, the Session Management extension runs Tanzu GemFire automatically with pre-configured settings. You can change these Tanzu GemFire settings.

Default settings:

  • Locators are used for member discovery.
  • The region name is set to gemfire_modules_sessions.
  • The cache region is replicated for peer-to-peer configurations and partitioned, with redundancy activated, for client/server configurations.
  • Tanzu GemFire clients have local caching activated. When the local cache needs to evict data, it will evict least-recently-used (LRU) data first.

Note: On the application server side, the default inactive interval for session expiration is set to 30 minutes. For information about changing this value, see Session Expiration in General Information about HTTP Session Management.

Changing Tanzu GemFire Distributed System Properties

Tanzu GemFire system properties must be set by adding properties to Tomcat’s server.xml file. When setting properties, use the following syntax:

<Listener 
  className="org.apache.geode.modules.session.catalina.xxxLifecycleListener"
  property-name="property-value"
  property-name="property-value"
  ...
/> 

Where:

  • property-name is the name of a property.
  • property-value is value of that property.

If the xxxLifecycleListener is a PeerToPeerCacheLifecycleListener, then a minimal addition to the server.xml file is the following:

<Listener 
  className="org.apache.geode.modules.session.catalina.
    PeerToPeerCacheLifecycleListener"
  cache-xml-file="cache-peer.xml"
  locators="localhost[10334]"
/> 

The list of Tomcat’s configurable server.xml system properties includes any of the properties that can be specified in Tanzu GemFire’s gemfire.properties file. The following list contains some of the properties that can be configured.

Property Description Default
cache-xml-file Name of the cache configuration file. cache-peer.xml for peer-to-peer, cache-client.xml for client/server
locators (only for peer-to-peer topology) Required: List of locators in (host[port]) format used by Tanzu GemFire members. If a single locator listens on its default port, set this value to "localhost[10334]". Empty string
log-file Name of the Tanzu GemFire log file. gemfire_modules.log
statistic-archive-file Name of the Tanzu GemFire statistics file. gemfire_modules.gfs
statistic-sampling-enabled Whether Tanzu GemFire statistics sampling is enabled. false

For a full list of properties and more information, see VMware GemFire Reference.

In addition to the standard Tanzu GemFire system properties, the following cache-specific properties can also be configured with the LifecycleListener.

Property Description Default
criticalHeapPercentage Percentage of heap at which updates to the cache are refused 0 (deactivated)
evictionHeapPercentage Percentage of heap at which session eviction begins 80.0
rebalance Whether a rebalance of the cache should be done when the application server instance is started false

Although these properties are not part of the standard Tanzu GemFire system properties, they apply to the entire JVM instance and are handled by the LifecycleListener. For more information about managing the heap, see Controlling Heap Use with the Resource Manager in Managing Heap Memory.

Changing Cache Configuration Properties

To edit Tanzu GemFire cache properties, such as the name and the characteristics of the cache region, add these properties to Tomcat’s context.xml file. When adding properties, unless otherwise specified, use the following syntax:

<Manager 
  className="org.apache.geode.modules.session.catalina.Tomcat9DeltaSessionManager"
  property-name="property-value"
  property-name="property-value"
  ...
/> 

Where:

  • property-name is the name of a property.
  • property-value is the value of that property.

For example, the following entry creates a partitioned region with the name my_region.

<Manager className="org.apache.geode.modules.session.catalina.
    Tomcat9DeltaSessionManager"
  regionAttributesId="PARTITION_REDUNDANT"
  regionName="my_region"
/> 

The following parameters are the cache configuration parameters that can be added to Tomcat’s context.xml file.


CommitSessionValve
Whether to wait until the end of the HTTP request to save all session attribute changes to the Tanzu GemFire cache. If the configuration line is present in the application's context.xml file, then only one put will be performed into the cache for the session per HTTP request. If the configuration line is not included, then the session is saved each time the setAttribute or removeAttribute method is invoked. As a consequence, multiple puts are performed into the cache during a single session. This configuration setting is recommended for any applications that modify the session frequently during a single HTTP request.

Default: Set

To deactivate this configuration, remove or comment out the following line from Tomcat’s context.xml file.

<Valve className="org.apache.geode.modules.session.catalina.CommitSessionValve"/>

enableDebugListener
Whether to enable a debug listener in the session region. If this parameter is set to true, info-level messages are logged to the GemFire log when sessions are created, updated, invalidated. or expired.

Default: false

The Tanzu GemFire API equivalent to setting this parameter:

// Create factory
AttributesFactory factory = ...; <or> RegionFactory factory = ...;
// Add cache listener
factory.addCacheListener(new DebugCacheListener());

enableLocalCache
Whether a local cache is enabled. If this parameter is set to true, the app server load balancer should be configured for sticky session mode.

Default: true for client/server. enableLocalCache is only useful with a client/server topology.

The Tanzu GemFire API equivalent to setting this parameter:

ClientCache.createClientRegionFactory(CACHING_PROXY_HEAP_LRU);

regionAttributesId
Specifies the region shortcut. For more information, see Region Shortcuts and Custom Named Region Attributes. When using a partitioned region attribute, VMware recommends that you use PARTITION_REDUNDANT instead of PARTITION to ensure that the failure of a server does not result in lost session data.

Default: REPLICATE for peer-to-peer, PARTITION_REDUNDANT for client/server

The Tanzu GemFire API equivalent to setting this parameter:

// Creates a region factory for the specified region shortcut
Cache.createRegionFactory(regionAttributesId);

regionName
Name of the region.

Default: gemfire_modules_sessions

The Tanzu GemFire API equivalent to setting this parameter:

// Creates a region with the specified name
RegionFactory.create(regionName); 
check-circle-line exclamation-circle-line close-line
Scroll to top icon