views:

30

answers:

2

I am making a Facebook application, I want to have a stateless server.The Facebook connect requests are from the server side. So when Facebook gives me a session which has to be maintained at the server this way my server won't be stateless.

When I'll load balance I can't have a simple load balancer instead it would need to know which users are on which server, something I don't want.

Any Ideas?

A: 

Assuming you can pass a token between web pages, one option is to store the state in a database using that token. That'll keep things independent of the webserver itself.

Thomas Rushton
+1  A: 

You can go with any of the following approaches depending upon your application usage:

  1. Use sticky sessions.
  2. Store session information in in-memory clustered cache. (e.g. solutions using Memcached)
  3. Persist session related information in Database.
Monis Iqbal
If I cache my facebook session or store it in a database. How long does a facebook session last? If a person is on my application and sends in a request for facebook after a while ?
Fahim Akhter
the exact timeout is not known and it depends upon FB.According to http://20bits.com/articles/5-facebook-application-gotchas/ it's 12 seconds but I'm not confirm on that.I don't think session timeout is a cause for concern. Only the authentication calls fall in that category and usually users don't wander off too much. Even if they do then you can handle timeout's by reintializing the process. Once you get the authentication token, it is long-lived.
Monis Iqbal

related questions