4 Replies Latest reply on Jun 27, 2006 1:08 PM by chwang

    How to cluster a web component (a servlet application)?

      Hi, Folks,

      I have a web report service application, which is a servlet application, accepting the requests from the other applications ( using UrlConnection.connect() ) to generate report.
      This web component has no EJB. I am going to cluster the servlet application. Because it can only handle 10 requests at the concurrent time.
      My question is
      1.) Do I need to set up Cache stuff?
      2.) After I set up cluster, the client still call use UrlConnection.connect() to call the servlets ? or I need to use JNDI to find the web component?

      Thank you very much.

      Chwang

        • 1. Re: How to cluster a web component (a servlet application)?
          brian.stansberry

          Whether you need the "cache stuff" depends on whether your 1) servlet application maintains session state between requests and 2) you care about failover, i.e. is it important that the session state be there if the client fails over.

          Re: UrlConnection.connect, if you cluster the servlet app, you need some kind of load balancer in front of it to distribute the requests. The URL the applications point to is the load balancer. UrlConnection.connect is fine; the issue is having the correct URL.

          • 2. Re: How to cluster a web component (a servlet application)?

            Hi, Brian,

            Thank you very mcuh for your replying.

            I think I don't need to maintain the seesion state. the client send a request to report servlet, the servet will generate a sessionID being save in a hastable, and send ID back to the client. then Every 15 seconds, the client will send a request with this ID to query the status of report (like how many the percentage is done).

            Could you tell me I need to care about fails over for this case?
            If there are 2 nodes, How to set up my every 15 seconds request will stick on the the first request node?

            Thank you again,

            Chwang


            • 3. Re: How to cluster a web component (a servlet application)?
              brian.stansberry

              Lets say the client sends the request and starts polling every 15 seconds. Then the server producing the report dies. What do you want to happen? Client connects to another server *which picks up the report creation where the first one left off*? Probably not possible, but if it is and you want it, then you need failover. I suspect that's not what you want/need.

              How to set up sticky sessions depends on what load balancer you use. Here is a wiki page with more on using Apache mod_jk as the load balancer:

              http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss

              • 4. Re: How to cluster a web component (a servlet application)?

                Hi, Brain,

                I see, Thank you very much.

                Best Regards,

                Chwang