Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suitable memory stores #256

Closed
parky128 opened this issue Jan 11, 2016 · 1 comment
Closed

Suitable memory stores #256

parky128 opened this issue Jan 11, 2016 · 1 comment
Assignees
Labels

Comments

@parky128
Copy link

So I see from the docs that the regular MemoryStore that express-session writes to is not practical for use in a production environment.

I would still like to be able to store the sessions in RAM and I have seen mentions about other more stable memory stores such as redis (im not sure this is a memory type store?) and memcache.

I'd like to avoid using a store such as mongoDB to reduce the overhead of setup and maintenance on the production server. Plus the team I am working in does not have any real noSQL db experience, so I want to simplify using express-session within our application as much as possible.

Can anyone provide me some advice on why we really ought to be using a non memory based stored, or can a memory store still provide decent functionality out of the box (cleanup sessions, setting expiry, etc)

@dougwilson dougwilson self-assigned this Jan 11, 2016
@dougwilson
Copy link
Contributor

Hi! The # 1 problem with using an in-memory store is you can never scale your application, not even using cluster. This is because if requests are load balanced, then you will keep getting lookup misses. The other reason is just one server crash and all your sessions are lost, as there is no persistence. For example, your server has a slight programming error, it crashing, your running restarts it, but now every user is logged out of your web site.

As for the MemoryStore that is part of this module, it's specifically designed for debugging purposes, which is why the sessions don't expire, etc. so you can use a debugging tool to examine the contents at any time.

A good store module can overcome these things, but I'm not aware of one someone has made. I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants