Announcement Announcement Module
No announcement yet.
Cluster wide singleton? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cluster wide singleton?

    I'm looking for suggestions how to approach to cluster wide singleton implementation. Feature that I'm most urgently need is "hot swappable stand by" mode of operation. Are there any plans to implement cluster wide singletons in Spring?


  • #2
    more info

    We need more information about your architecture to answer the question. Do you have, for example, serveral bean factories on different nodes that need to be able talk to a single bean at a time, or do you have serveral clients that make requests to the cluster and get a single response?

    Are you trying to create the same distributed nature of EJB without actually using a complete EJB container or are you trying to share an expensive resource amongst a few JVMs?


    • #3
      Thanks for your interest analogueboy.

      I have a need for cluster aware service which provides access to single resource which doesn’t have support for concurrent access (i.e. let's say this is a single file). In same time, invocation of this service should be the same for every client on every node in cluster (also configuration of each service should be same). So, services should elect between them self one master node and a number of slaves for failover. All slave services should proxy their request to master which really executes it. For failover support, if original master fails, between remaining nodes new master should be elected.

      AFAIK, there are some open source projects which can serve as a basis for implementing that, (cajo framework, ActiveCluster, JGroups) and there is similar implementation in JBoss (HASingletonController I think), but unfortunately I don't use JBoss and its implementation looks very much bundled in application server.

      I'm looking for recommendation which of above projects to use, and if anyone can share some suggestions or, even better, code about course of implementation.



      • #4
        Sounds more like a message based system or even P2P.


        • #5
          It seams that ActiveMQ team have a solution in forthcoming 4.x version. Basically, what they implementing under Exclusive Consumer and Message Groups features is what I thought under "Cluster wide singleton" term.

          One another open source project catches my eye. It seams that Hedera tries to introduce higher level of abstraction on top of lower level communication libraries. This may be another foundation for Cluster wide singleton implementation. Unfortunately, Hedera lacks almost any kind of documentation for now.

          Any thoughts?



          • #6
            Yup, just what I thought a message based system could do this. The ESB type of system may have a "pattern" for that.


            • #7
              You could try using a cluster-aware cache provider. What you need is no cache, but cache entries are singletons and clustering is built in. SwarmCache or JBoss TreeCache should do the trick.


              • #8

                If you're using WebSphere XD then you can use the partition facility. The partition facility allows an application to declare a named partition. The application then receives a load and unload callback in the server the WAS HAManager decides to host the partition/singleton in.

                The HAManager provides our group services support and also has support for hardware fencing in split brain scenarios etc. It also has a flexible layout manager in terms of managing which partitions run on what servers etc.

                The load/unload callbacks can then use a Spring Bean factory to fluff up the singleton POJOs and start em. I've done this myself so it works well.

                Billy (IBM)


                • #9
                  Hi Billy,

                  I there a way to do something similar under websphere 5.5.1? In fact i'd like to call all cluster server (initiated by a single server web interface for instance) to tell them to "resynchonize" a cache if a database table changes.



                  • #10
                    JBoss HA-Singleton + JMX

                    On the project I'm currently working on I deploy a JBoss HA-singleton to make it cluster singleton then use spring to register the required beans with the cluster's HA-JMX server. Access to the singleton is then through the HA-JMX server running inside the cluster.

                    This way any code requiring to connect to the cluster singleton goes through HA-JMX server to invoke methods on the spring beans. You can lookup the the HA-JMX server in jboss using the HA-JNDI. If you need an example drop me an email.

                    Doing a HA-JNDI lookup is pretty trivial you can discover the UDP address and port, etc without having to hard code anything. At least it is in JBoss 4.0.2.


                    • #11
                      Terracota has two products which provide advanced caching.


                      • #12
                        WebLogic support for Spring


                        by Andy Piper, Rod Johnson, Chris Wall and Nick Tran -- WebLogic Server 9.0 provides a platform for enhanced management, ease-of-use and scalability of Java applications. The Spring Framework enables a simpler, POJO based, approach to J2EE development without sacrificing the power of the platform. This article describes the synergy of these two systems, and introduces the Spring on WebLogic kit.

                        this gives a 'idea' on how to use spring in clustering via (RMI)