1

When running node js in production mode, this warning is logged :

Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.

Doing a brief research, i found that i should use other alternatives for session storage by passing express-session-mongo or express-session-redis.

My questions :

  • Are this solutions built for expressJs working with express.io ?
  • Is there a solution to solve the problem without using one of theese ? As you can see, using one of them will force me to install mongo or redis which is not good in my case.

Thank You !

khalil
  • 681
  • 1
  • 6
  • 22

2 Answers2

1

I resolved it by using the cookie-session library, i simply flowed the tutorial.
cookie-session on github

khalil
  • 681
  • 1
  • 6
  • 22
0

I would highly suggest backing your session's with a database. I would use Redis, CouchDB/Cloudant, memcached, or Mongo.

The reason express is giving that error is the in memory database is only available on the current node you are running and if you scale your application the session data will not be available on other nodes.

Check out http://passportjs.org/, there are some modules to help you store the session data into an external resource.

Jeff Sloyer
  • 4,899
  • 1
  • 24
  • 48
  • Using "cookie-session" library solved the problem, you can find the link in my awnser. Thanks ! – khalil Mar 10 '15 at 14:17