2016년 12월 11일 일요일

JBOSS - session config 관련 정리


Test Version - JBOSS EAP 6.4

progile 범위 ha, full-ha에서 세션 기본적으로 지원 

web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">

<distributable/>

</web-app>

WEB-INF/jboss-web.xml session 관련 파라미터
ex)
<jboss-web>
<replication-config>
    <cache-name>custom-session-cache</cache-name>
    <replication-trigger>SET</replication-trigger>
    <replication-granularity>ATTRIBUTE</replication-granularity>
    <replication-field-batch-mode>true</replication-field-batch-mode>
    <use-jk>false</use-jk>
    <max-unreplicated-interval>30</max-unreplicated-interval>
    <snapshot-mode>INSTANT</snapshot-mode>
    <snapshot-interval>1000</snapshot-interval>
    <session-notification-policy>com.example.CustomSessionNotificationPolicy</session-notification-policy>
</replication-config>

ex)
</jboss-web>
// <replication-field-batch-mode>true</replication-field-batch-mode> 설정시 오류         <replication-config>
     <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
     <replication-granularity>SESSION</replication-granularity>
     <replication-field-batch-mode>true</replication-field-batch-mode>
</replication-config>

ex)
<replication-config>
     <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
     <replication-granularity>SESSION</replication-granularity>
</replication-config>


<replication-trigger>
SET : 세션이 설정될때 복제
SET_AND_GET : 세션을 읽기만 해도 복제
SET_AND_NOT_PRIMITIVE_GET : 세션이 설정될 때와 java의 Primitive 타입이 아닌 타입은 읽을 때도 복제 (default)

WEB-INF/jboss-web.xml, web.xml  session time out 설정
        <session-config>
                <session-timeout>30</session-timeout>
        </session-config>

jvmRoute Name 설정 (console, host.xml)
host.xml
</system-properties>
<servers>
   <server name="testSrv01" group="test-group" auto-start="false">
       <system-properties>
            <property name="jvmRoute" value="testSrv01" boot-time="false"/>
//여기 jvmRoute 의 value 와 worker.properties 의 worker.node01 과 동일하여야 한다.
       </system-properties>
            <socket-bindings socket-binding-group="ha-sockets" port-offset="0"/>
    </server>
</servers>

domain.xml, standalone.xmlinstance-id="${jvmRoute}"
      <subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" instance-id="${jvmRoute}" native="false">
             <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
               <virtual-server name="default-host" enable-welcome-root="false">
                   <alias name="localhost"/>
                   <alias name="example.com"/>
               </virtual-server>
     </subsystem>


* UDP 설정에서 세션 클러스터링이 안될경우 TCP로 변경
domain.xml jgroups stack udp -> tcp 변경
<subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="tcp">

댓글 없음:

댓글 쓰기