Announcement Announcement Module
Collapse
No announcement yet.
Distributed architecture using Spring remoting Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Distributed architecture using Spring remoting

    Hi all,

    I want to implement a distributed architecture, in which clients invoke any of several servers, depending on their availability. The clients are not browsers, so web-server (e.g. Tocmat) clustering is not relevant here. It's a cluster of servers, each capable of providing the same functionality, but clients should be able to "find" the less loaded one and invoke it. Now, with EJB's I believe this is provided out-of-the-box, but what about using Spring remoting? For example - RMI. How do two processes find each other via RMI, and is it possible to put a load-balancer in the middle? Or is Spring HTTP-invoker a better option for this?

    Thanks,

  • #2
    You could implement this architecture using JGroups.

    You could imagine that the servers register themselves with some kind of monitor node. The servers expose some services (via Spring remoting for example). The monitor could poll the servers (or the servers could report to the monitor) every *whatever* lapse of time.

    Then the clients would connect to the monitor and get a URL (or list of URLs) to try to invoke the services. The list is based on the load info that the monitor has obtained previously.

    Maybe this article can give you more ideas: http://www.javaworld.com/cgi-bin/mailto/x_java.cgi. The author uses JBoss cache and Spring to implement remote service failover.
    Last edited by Manuel Palacio; May 14th, 2007, 07:53 AM.

    Comment


    • #3
      Thanks, but...

      Yes, but this is not exactly "transparent" on my part... I was trying to figure out how I can use Spring remoting (more specifically RMI) and have my components find each other across the cluster. I think this is the closest equivalent of what EJB will give me, and I am trying to find the Spring alternative to EJBs (with respect to distribution, not persistence).

      Comment


      • #4
        AFAIK there's no Spring alternative to EJB with respect to distribution. Spring is just a framework not a container...
        Last edited by Manuel Palacio; May 14th, 2007, 09:35 AM.

        Comment


        • #5
          That's not good to hear

          Here's what I had in mind: using Spring remoting I can export a POJO service using RMI or HTTP invoker. Now, let's say there are several machines that export that same service.

          If I use HTTP - then I thought I may be able to direct the clients to a load-balancer, that will redirect them to one of the nodes. Is this possible with Spring http-invoker?

          If I use RMI - is it possible to do something similar (i.e. some kind of RMI load-balancer)?

          This is not a hypothetical question! We are in the process of choosing our architecture, and so far we have been able to meet every requirement using Spring/Hibernate/Tomcat, and it has now come down to this (distribution), as this is the only thing we don't know how to do without an EJB container.

          Comment


          • #6
            Load balancing using HTTP in a round-robin fashion or similar should be no problem of course.

            But for everything else (load-balancing for non-HTTP clients, load balancing based on actual load on a node) you're pretty much going to have to do it yourself using the frameworks of your choice (i.e. JGroups). The EJB container (client stubs) will help your non-HTTP clients when it's time to fail over but nothing more AFAIK.

            Comment


            • #7
              I think what you are looking for is here http://www.terracotta.org/confluence...g+Architecture

              I hope that solves your problem.

              Imran

              Comment


              • #8
                I thought that Terracotta only took care of state replication but it actually can do failover and you can use it to implement the master worker pattern.

                The Master/Worker pattern consists of three logical entities: a Master, a Shared Space and one or more instances of a Worker. The Master initiates the computation by creating a set of tasks, puts them in some shared space and then waits for the tasks to be picked up and completed by the Workers. The shared space is usually some sort of Shared Queue, but it can also be implemented as a Tuple Space (for example in Linda programming environments, such as JavaSpaces, where the pattern is used extensively). One of the advantages of using this pattern is that the algorithm automatically balances the load. This is possible due to the simple fact that, the work set is shared, and the workers continue to pull work from the set until there is no more work to be done
                http://jonasboner.com/2007/01/29/how...en-terracotta/

                Looks like Terracotta meets yr requirements for distribution

                Comment


                • #9
                  Spring Framework itself does not provide anything except POJO wrappers.
                  Have a look at http://www.zeroc.com and their product called ICE.

                  Comment


                  • #10
                    Thanks

                    Thanks for the tip. I keep hearing about Terracotta lately... I guess it's time I roll up my sleeves and take a serious look at it

                    Just out of curiosity though - is it possible to use RMI for a clustered architecture? More specifically - how does RMI locate the machine that can process a remote call?

                    Comment


                    • #11
                      There's nothing in RMI that will help you locate processes that will handle the remote call. This is functionality that is added by app server vendors when you create a cluster configuration i.e. JBoss adds a kind of interceptor in the client stub (obtained from JNDI) that knows how to route the method invocation to specific nodes

                      Comment


                      • #12
                        I see

                        Thanks, Manuel. That's one piece I was missing.

                        In fact, one other way this could have been achieved is via JMS, and I think there's also a library out there that provides Spring remoting via JMS (Lingo, is it not?).

                        Comment


                        • #13
                          Originally posted by nlif View Post
                          I think there's also a library out there that provides Spring remoting via JMS (Lingo, is it not?).
                          Yes Lingo is kool

                          From there site: http://lingo.codehaus.org/Clustering
                          Lingo is an ideal technology to cluster your POJO services to achieve load balancing across many servers and automatic failover. Lingo is high performance and works great in server centric environments as it can work with JCA to cleanly integrate with thread, connection and session pooling as well as handing of transactions, retry and exception handling.



                          You can use Lingo to cluster your POJO services across a number of different JVMs. Lingo will then provide
                          • load balancing across each server
                          • High Availability; if a server fails for whatever reason the pending requests are automatically dispatched to another server.
                          • loose coupling between clients and services in terms of location and time
                            • you can send one-way requests which can be persisted until the back end services are available
                          • traffic shaping - you can use JMS wildcards and selectors to shape the traffic
                            • e.g. have a rack of servers which only process gold customers using a JMS selector to filter them out
                          I think you should consider this as a solution, I hope it'll work for you

                          Imran

                          Comment


                          • #14
                            Jms

                            Truth is we knew this could be done with JMS, and personally, I thought it's a good approach, but others opposed it, because they felt it's too complicated. More specifically, they argue that since we don't need asynchronous use-cases it's an over-complication (we need RPC style invocations, but across a cluster). That's how we got to RMI (and also, because EJBs provide distribution, and they do it through RMI so we thought we could too).

                            Comment


                            • #15
                              Re: Distributed Architecture using Spring Remoting

                              hey nlif (?),

                              I found your discussion on spring forum. We have implemented similar remoting and *might* be facing problems.

                              We're using RMI (not http-invoker, but more than happy to move to it) and have a cluster of machines exposing remote services behind a high performance load balancer.

                              Now the problem is while testing failure modes, we're facing problems like, even though we break client access to load balancer we see they can still communicate, giving me the feeling they are communicating directly with app servers. And if we block app server access (with load balancer access given) clients start failing.

                              I'm not sure whats going on. I was hoping it would simply work with only lb access since the lb ip address is the only thing clients should be concerned with??

                              Comment

                              Working...
                              X