4 Replies Latest reply on Oct 30, 2017 6:58 AM by pferraro

    No session failover for singelton

    darrenpimenta

      I am able to get a singleton service running on Wildfly 10.1.0 in Ubuntu. This is using the full-ha profile in domain.xml with a wildfly load blancer. If the wildfly instance that is running the singleton is stopped another instance deploys the war automatically and I am able to access this through the front end load balancer.  However I can see that a new session is created.

       

      If I use a non-singleton war in the same set up I can stop and start servers with the same session being maintained when accessing through the load balancer.  I have checked the current documentation and searched for any further information  but cannot find anything to indicate if this is an issue with my set up or if this is how a singleton should behave. Many thanks for any help/advice.

        • 1. Re: No session failover for singelton
          pferraro

          Can you elaborate on what you mean by "session"?  It is also unclear to me whether you are using the singleton service facility (i.e. a singleton MSC service) or the singleton deployment facility.

          Can you post some details of your deployment/configuration?

          • 2. Re: No session failover for singelton
            darrenpimenta

            Thanks Paul,

            Using the single deployment facility as per the documentation here HA Singleton Features - WildFly 10 - Project Documentation Editor.

            In the full-ha profile in domain.xml

                       

                        <subsystem xmlns="urn:jboss:domain:singleton:1.0">

                            <singleton-policies default="default">

                                <singleton-policy name="default" cache-container="server" quorum="3">

                                    <simple-election-policy/>

                                </singleton-policy>

                            </singleton-policies>

                        </subsystem>

            ...

                            <cache-container name="server" aliases="singleton cluster" default-cache="default" module="org.wildfly.clustering.server">

                                <transport lock-timeout="60000"/>

                                <replicated-cache name="default" mode="SYNC">

                                    <transaction mode="BATCH"/>

                                </replicated-cache>

                            </cache-container>

             

            Deployment is a test war that uses jaxrs, with a singleton-deployment.xml file in META-INF.

            Sets an attribute(long) on the session and then gets the attribute and increments it each time the resource is accessed.

            • 3. Re: No session failover for singelton
              lpeano

              You can not do this in sinhleton deployment service yoi must use sinbleton MSC seevice.

              • 4. Re: No session failover for singelton
                pferraro

                OK - I understand now.  Singleton web deployments are not designed to be used with traditional distributed web sessions (i.e. in-memory replication).  Since there is only one node running your application at a time, there is no node to which to replicate/distribute your sessions.  However, if you configured your web session cache as a local-cache using shared persistence (e.g. database, shared file system, etc.) then your web sessions will always be available, even when deployed as a singleton deployment.