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 8735899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:10:33+00:00 2026-06-13T10:10:33+00:00

I’m using Node’s Express w/ Connect middleware. Connect’s memory session store isn’t fit for

  • 0

I’m using Node’s Express w/ Connect middleware. Connect’s memory session store isn’t fit for production:

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

For larger deployments, mongo or redis makes sense.

But what is a good solution for a single-host app in production?

  • 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-13T10:10:35+00:00Added an answer on June 13, 2026 at 10:10 am

    Spent the day looking into this. Here are the options I’ve discovered. Requests/second are performed via ab -n 100000 -c 1 http://127.0.0.1:9778/ on my local machine.

    • no sessions – fast (438 req/sec)
    • cookieSession: requires no external service, minor speed impact (311 req/sec) – fastest, sessions will expire with the cookie (customised by maxAge)
    • connect-redis: requires redis server, large speed impact (4 req/sec with redis2go and redisgreen) – faster than mongo, sessions will be deleted after a while (customised by ttl)
    • connect-mongo – requires mongodb server, large speed impact (2 req/sec with mongohq) – slower than redis, requires manual clear_interval to be set to cleanup sessions

    Here is the coffeescript I used for cookieSession:

    server.use express.cookieSession({
        secret: appConfig.site.salt
        cookie: maxAge: 1000*60*60
    })
    

    Here is the coffeescript I use for redis:

    RedisSessionStore ?= require('connect-redis')(express)
    redisSessionStore ?= new RedisSessionStore(
        host: appConfig.databaseRedis.host
        port: appConfig.databaseRedis.port
        db: appConfig.databaseRedis.username
        pass: appConfig.databaseRedis.password
        no_ready_check: true
        ttl: 60*60  # hour
    )
    server.use express.session({
        secret: appConfig.site.salt
        cookie: maxAge: 1000*60*60
        store: redisSessionStore
    })
    

    Here is my coffeescript for mongo:

    server.use express.session({
        secret: appConfig.site.salt
        cookie:
            maxAge: 100*60*60
        store: new MongoSessionStore({
            db: appConfig.database.name
            host: appConfig.database.host
            port: appConfig.database.port
            username: appConfig.database.username
            password: appConfig.database.password
            auto_reconnect: appConfig.database.serverOptions.auto_reconnect
            clear_interval: 60*60  # hour
        })
    })
    

    Now of course, the remote redis and mongo databases will be slower than their local equivalents. I just couldn’t get the local equivalents working, especially considering the installation and maintenance time for me was far more than what I was willing to invest when compared with hosted remote alternatives, something I feel is true for others too hence why these hosted remote database services exist in the first place!

    For local database benhmarks, see @Mustafa’s answer.

    Happy for someone to edit this answer to add their local database benchmarks to the mix.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to

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.