Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7886001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:12:42+00:00 2026-06-03T05:12:42+00:00

For express applications, I’ve seen that there’s a connect-mongodb and connect-redis middleware for storing

  • 0

For express applications, I’ve seen that there’s a connect-mongodb and connect-redis middleware for storing sessions, but I don’t understand why that’s necessary – what’s wrong with the default in-memory session storage? Is it for large scale applications that need to sync sessions across multiple machines?

Also, can anyone offer any benchmarks/tips for the fastest session store? My guess is Redis due to its simpler key/value store.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:12:44+00:00Added an answer on June 3, 2026 at 5:12 am

    The only reason to store session data in a database (MongoDB, Redis, etc) is so that it is available across Node processes and is durable across failures. In scale out architectures, it is highly desirable to have stateless servers so that everything works regardless of which server a particular user connects to and servers can go up and down without losing any state.

    In other words, imagine you have 10 servers behind a load balancer handling incoming requests. User 1 makes a request that Server A handles and logs in. You need to store the fact that they’ve logged in so you store this in a session. The next request ends up getting routed to Server C since Server A is busy with another request. In order for Server C to know that the user has already logged in, it needs the session data. So how does it get access to the session data that was stored by Server A?

    One way is by storing the data in a cookie on the client side which is submitted with each request, but this isn’t very secure. Another way is to try and sync state across Node servers which can be done but tends to be costly and error prone. The easiest way is to store a session ID in a cookie and then store the actual session data in a database. Each node server then has access to the same database so they can look up the session data. This way you can easily scale in and out your Node servers and load balance them when servers fail without losing any data.

    In terms of performance, the in memory store will be the fastest (but has the drawbacks above). Redis will be the next fastest and MongoDB will be the slowest (generally about 4x slower than Redis). Keep in mind that either will be plenty fast enough for the vast majority of web sites.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I use Visual C# express to produce commercial applications? And are there any
I'm wondering if there are any applications, preferably freeware, that can take a database
Can I develop Silverlight applications in Visual Studio express? When I start up Visual
I'd like to know if the express editions allows you to make WCF applications
I have built an application that uses SQL Express 2005 and I want to
We have an application that installs SQL Server Express from the command line and
Taken from Exercise 1: Creating Windows Phone Applications with Microsoft Visual Studio 2010 Express
I would like to create some test web applications with Visual Studio 2010 Express
I've been using Visual Studio Express for a good while now, but after comparing
As far as I understand, due to license reqirements all web applications, which use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.