mfc
mfc

Reputation: 3026

What is the use of a session store?

I am using koa and passport therefore I am using the koa-generic-session middleware to handle my sessions.

Now unlike the expressjs session middleware there isn't a big disclaimer in the documentation like such : The default server-side session storage, MemoryStore, is purposely not designed for a production environment.

Assuming the MemoryStore for the koa-generic-session is ready for production use, why would I use a heavy duty session store such as mysql or mongodb for sessions that come and go all day long? What additional capabilities would using one give me that MemoryStore doesn't?

Upvotes: 2

Views: 862

Answers (1)

pspi
pspi

Reputation: 11947

In memory session store works perfectly for development but it has a couple of caviats for production use.

  • restarting the server causes all sessions to be invalidated, this is not nice for the users of your application
  • in memory store is not efficient handling production level loads where there are potentially huge amounts of sessions ongoing at the same time, therefore a more efficient storage is better that writes to disks, caches frequently used. a database would fulfill all these qualities

Upvotes: 2

Related Questions