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

  • Home
  • SEARCH
  • 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 8140485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:10:57+00:00 2026-06-06T12:10:57+00:00

I am making a somewhat large rails app where users fill out a number

  • 0

I am making a somewhat large rails app where users fill out a number of forms and in return are quoted for car insurance. The quoting engines are all external, as well as an external DB.

I have no need to store a session in a mysql, or similar, DB long-term.

What would be the best way to store these sessions.

CookieStore is insecure as well as too limited ( <4kb cookie ).

Memchached is a possibility except I do not like the idea of key => value pairs, I would like more associative arrays where possible.

Any DB related session store is redundant for these needs(?)

Some sort of file store system may be the way to go?

Please could someone advise on the best way to store the sessions?

  • 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-06T12:10:58+00:00Added an answer on June 6, 2026 at 12:10 pm

    Memcache or a database store are the way to go. In both cases, as your site scales, your many servers will be able to get/set session data.

    I’ve used both in the past, and there are a few things you should know:

    1) Both can store arbitrary data

    A Rails session is treated like a Hash, and the value that gets stored is a serialized version of that Hash. In Memcache, the key => value pair are the session_id => session_contents. In a database store, you have two columns, one for the id and one for the contents.

    2) Memcache is a little bit faster

    Every little bit of speed helps; for this purpose, Memcache will be a smidge faster than a database.

    3) Memcache has a tendency to drop keys when it gets full

    If your Memcache instance starts running out of memory, it starts to drop keys. It does that by dropping the oldest ones first. Since sessions are actively used, you can mitigate this by tickling the session data on every request; that keeps them at the top of the pile. But if your instance gets really full, it’s possible that you’ll start dropping sessions on the floor and logging users out. This is typically only a problem in a situation of very rapid growth, like if you get slashdotted. Otherwise it’s easy enough to keep an eye on your Memcache server and ensure that you’re not running out of storage.

    4) A database table will rapidly fill up with expired sessions
    Memcache automatically drops old stuff. When a user doesn’t log out but simply abandons the session, you have to do the cleanup manually in the database. Typically this is best done with a daily cron job. If not, you end up with a bazillion stale records that slows down querying to that table.

    Which is best for you? I don’t know. It depends on your situation, and the kinds of risk you’re willing to take on. I’ve never had the dropped sessions problem with memcache, but that really depends on what else you’re using memcache for. If you use it a lot, a second memcache instance just for sessions might be the way to go. Then there’s no risk of dropping ’em.

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

Sidebar

Related Questions

I love making named scopes for rails. however, I ran into somewhat of a
I'm making a gallery, somewhat similar to Facebook's. I want users to be able
I'm somewhat new to OOP programming so it's very likely I'm making some stupid
Im making a login/logout class that logs users in, sets cookies based on user's
I've inherited a rather large and somewhat messy codebase, and have been tasked with
I have thought a bit about making a somewhat lightweight consistent-hashing-like PHP function to
I have a somewhat simple game that I'm making and now that I'm testing
In the near future, I will be inheriting a somewhat large project. I've been
I am making a simple web-app which requires login for the admin page. I
When I am making methods with return values, I usually try and set things

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.