Search code examples
javadatabaseservlet-listeners

How do I maintain the user credentials when each request can hit multiple servers


Say I have logged into amazon.com. there are say 5 servers present to handle the traffic. Every request from my end hits say Amazon's server 1. Now there are many users coming to picture and my every request can go to server 2 or server 3. How do you make sure that servers two and three communicate communicate with one for my login details?? Which would be the best way to handle it in Java?


Solution

  • I would suggest the following:

    • Go for a Standalone Authentication and Authorization server.
    • Any incoming request should first be validated by Authentication server and then processed.
    • Authentication and authorization mechanism will probably be Token Based using OAUth.
    • To keep things like user preferences etc which expire with the session, you will probably need a seperate In-memory DB server.