0 Replies Latest reply on Jun 18, 2013 9:03 AM by Dipankar Patro

    nginx load balancing and hot deployment

    Dipankar Patro Newbie

      Hi all,


      We are moving towards hot deployment for our server. For the purpose, we are thinking of having:

      - Two instances of JBOSS running at 8080 and 9080. Both in standalone mode.

      - Load balanced (with fail over) using nginx.


      We are currently facing two problems:


      1. We don't want to start deployment until the server instance has no active sessions. We tried to check for number of active sessions associated with a server, but couldn't find a simple commandline method.

      Is there any method we can find the number of active sessions, preferrably in jboss-cli?


      2. When we undeploy any war file from a server, instead of 502 we are getting 404 error. Is this the expected behaviour?



      The overall aim is as follows (hot deployment):

      - Wait for active connections to a server to finish.

      - Undeploy the war files, let nginx redirect the requests to other server in the mean time.

      - Update the war files and start deployment.



      Below is the nginx configuration for load balancing:


      upstream backend {









      location / {

                  root   /home/prancer/dev/LandingPage/;

                  index  index.html index.htm;


                  add_header 'Access-Control-Allow-Origin' '*';

                  try_files $uri $uri/index.html @api;



      location @api {

                  # Pass to JBOSS Application Server

                  proxy_pass http://backend;

                  proxy_set_header  X-Real-IP  $remote_addr;

                  proxy_set_header Host $http_host;

                  proxy_next_upstream     error  timeout  invalid_header  http_404;

                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                  proxy_read_timeout 700;