Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to handle app in multiple server instance. Urgent  RSS feed

Shankar sanjay
Ranch Hand
Posts: 117
  • 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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!