File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to handle app in multiple server instance. Urgent

Shankar sanjay
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

We have RestFul web application, where we are using GlobalApplicationSession HASHMAP from singleton class(SessionSingleTon) to maintain user's session.

Example, whenever users send first request, we will store userObjects(its an instance with xyz properties) in GlobalApplicationSession map


The same users send a request(2nd, 3rd time) again, we will check GlobalApplicationSession map whether the userid exists, if it exists then we will get some details (from the previous session) and process the curent request.

exmaple to get previous session details.


The question is, how can we handle if the application deployed in more than one server(tomcat) using clustered and loadbalancer.


first time, user1 sends request1 and load balancer direct the request to server1. The userObjects(its an instance with xyz properties) will be stored in GlobalApplicationSession hashmap which is available in server1

2nd time, user1 sends request2 and LOAD BALANCER DIRECT THE REQUEST TO SERVER2, now GlobalApplicationSession (in server2) will not have any userObjects.

How to handle this? can anyone explain?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic