Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing web application: Session or session-less

I wanted others to explain to me, which approach is better: using a session or designing it sessionless. We are starting development of a new web application and have not yet decided on what path to follow.

Session-less design IMO is more preferable:

Pros:

  1. Scalability. We can have as many servers as we want without having to share a user session. Each of them can process requests (e.g. load balancing via round robin).
  2. Saves server resources. We do not need to allocate memory on the server side (again - scalability).
  3. No need to recover after a server restart.

Cons:

  1. Having to keep some user related information in cookies (not critical).
  2. Requires more coding (but not really much of coding).

Are there any topics we need to mind before taking the final decision?

like image 808
Eugene Retunsky Avatar asked Apr 10 '12 22:04

Eugene Retunsky


1 Answers

Today's apps can quickly grow extremely big (just have a look at all those "tiny, simple" tools like pastebin, jsfiddle etc !). And at some point a 16 core high end machine is not enough (some people might say "you have to recode your app in order to save cpu power bla-bla", but the http-connection-limit per server is also a problem). So, if you are planning to build a public application that might become more popular than expected, starting "sessionless" is the way to go! To be honest, this will only affect people who write really big things.

The killer pros for sessions are: much less traffic to the mySQL database and much easier coding. But you will have to rewrite your entire system when your app goes big.

like image 199
Sliq Avatar answered Sep 22 '22 15:09

Sliq