이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 32. Externalize Sessions


32.1. Externalize HTTP Session from JBoss EAP 6.4 and later to JBoss Data Grid

Red Hat JBoss Data Grid can be used as an external cache container for application specific data in JBoss Enterprise Application Platform (EAP), such as HTTP Sessions. This allows scaling of the data layer independent of the application, and enables different EAP clusters, that may reside in various domains, to access data from the same JBoss Data Grid cluster. Additionally, other applications can interface with the caches presented by Red Hat JBoss Data Grid.

Note

The following procedures have been tested and confirmed to function on JBoss EAP 6.4 and JBoss Data Grid 6.5. Externalizing HTTP Sessions should only be used on these, or later, versions of each product.
The below procedure applies for both standalone and domain mode of EAP; however, in domain mode each server group requires a unique remote cache configured. While multiple server groups can utilize the same Red Hat JBoss Data Grid cluster the respective remote caches will be unique to the EAP server group.

Note

For each distributable application, an entirely new cache must be created. It can be created in an existing cache container, for example, web.

Procedure 32.1. Externalize HTTP Sessions

  1. Ensure the remote cache containers are defined in EAP's infinispan subsystem; in the example below the cache attribute in the remote-store element defines the cache name on the remote JBoss Data Grid server:
    <subsystem xmlns="urn:jboss:domain:infinispan:1.5">
      [...]
      <cache-container name="cacheContainer" default-cache="default-cache" module="org.jboss.as.clustering.web.infinispan" statistics-enabled="true">
        <transport lock-timeout="60000"/>
        <replicated-cache name="default-cache" mode="SYNC" batching="true">
          <remote-store cache="default" socket-timeout="60000" preload="true" passivation="false" purge="false" shared="true">
            <remote-server outbound-socket-binding="remote-jdg-server1"/>
            <remote-server outbound-socket-binding="remote-jdg-server2"/>
          </remote-store>
        </replicated-cache>
      </cache-container>
    </subsystem>
    Copy to Clipboard Toggle word wrap
  2. Define the location of the remote Red Hat JBoss Data Grid server by adding the networking information to the socket-binding-group:
    <socket-binding-group ...>
      <outbound-socket-binding name="remote-jdg-server1">
        <remote-destination host="JDGHostName1" port="11222"/>
      </outbound-socket-binding>
      <outbound-socket-binding name="remote-jdg-server2">
        <remote-destination host="JDGHostName2" port="11222"/>
      </outbound-socket-binding>
    </socket-binding-group>
    Copy to Clipboard Toggle word wrap
  3. Repeat the above steps for each cache-container and each Red Hat JBoss Data Grid server. Each server defined must have a separate <outbound-socket-binding> element defined.
  4. Add passivation and cache information into the application's jboss-web.xml. In the following example cacheContainer is the name of the cache container, and default-cache is the name of the default cache located in this container. An example file is shown below:
    <?xml version="1.0" encoding="UTF-8"?>
     
    <jboss-web version="6.0"
               xmlns="http://www.jboss.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd">
     
        <replication-config>
            <replication-trigger>SET</replication-trigger>   
            <replication-granularity>SESSION</replication-granularity>
            <cache-name>cacheContainer.default-cache</cache-name>
        </replication-config>
        
        <passivation-config>
            <use-session-passivation>true</use-session-passivation>
            <passivation-min-idle-time>900</passivation-min-idle-time>
            <passivation-max-idle-time>1800</passivation-max-idle-time>
        </passivation-config>
        
    </jboss-web>
    Copy to Clipboard Toggle word wrap

    Note

    The passivation timeouts above are provided assuming that a typical session is abandoned within 15 minutes and uses the default HTTP session timeout in JBoss EAP of 30 minutes. These values may need to be adjusted based on each application's workload.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat