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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:29:00+00:00 2026-05-13T21:29:00+00:00

I’m looking for some advice on whether or not I should use a separate

  • 0

I’m looking for some advice on whether or not I should use a separate database to handle my sessions.

We are writing a web app for multiple users to login and check/update their account specific information. We didn’t want to use the file storage method on the webserver for storing session information, so we decided to use a database (MySQL). It’s working fine, but I’m wondering about performance when this gets into production.

Currently, we have two databases (rst_sessions, and rst). The “RST” database is where all the tables are stored for the webapp…they are all MYSQL InnoDB using Referential Integrity/foreign keys to link the tables. The “RST_SESSIONS” database simply has one table and all the session information gets stored there.

Here’s one of my concerns. In the PHP code if I want to run a query against “RST” then I have to select that database as such inside php ( $db->select(“RST”) )…when I’m done with the query I have to re-select the “RST_SESSIONS” ( $db->select(“RST_SESSIONS”) ) or else the session specific information doesn’t get set. So, throught the webapp the code is doing a lot of selecting and reselecting of the two databases. Is this likely to cause performance issues with user base of say (10,000 – 15,000)? Would we be better off moving the RST_SESSIONS table into the RST database to avoid all the selecting?

One reason we initially set things up this way was to be able to store the sessions information on a separate database server so it didn’t interfere with the operations of the webapp database.

What are some of the pro’s and con’s of both methods and what would you suggest we do for performance? Thanks in advance.

  • 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-05-13T21:29:00+00:00Added an answer on May 13, 2026 at 9:29 pm

    If you’re worrying about performances, another alternate solution would be to not store your sessions in database, but to use something like memcached — the PHP library to dialog with memcached already provides a handler for sessions.

    A couple of advantages of using memcached :

    • No hit to the disk : everything is in RAM
      • Of course, this means sessions will be lost if your server crashes ; but if a crash happens, you’ll probably have other troubles than jsut losing sessions, and this is not likely to happen often
    • Used in production by many websites, and works well (I’m using it for a couple of websites)
    • Better scalability : if you need more RAM or more CPU-power for your memcached cluster, just add a couple of servers
    • And I would add : once you’ve started using memcached, you can also use it as a caching mecanism 😉

    Now, to answer to your specific questions :

    Instead of selecting the DB, I would use two distinct connections :

    • One for the DB that’s use for the application,
    • And one other for the DB that’s used for the sessions.

    Of course, this means a bit more load on the server (it doubles the number of opened connections), but it make sure that, the day it becomes needed, you’ll be able to move the “session” database to another server : you’ll just have to re-configure a connection string ; and as the application already uses two separate connections, it’ll still work fine.

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

Sidebar

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.