Jump to content

How would you handle this Query vs Sessions vs Cookies


dprichard

Recommended Posts

Okay, I have a web app I wrote a while back and it has a bunch of information I use on every page.

 

Username, First Name, Last Name, Status, etc.

 

I have a query in an include at the top of the page so essentially it is querying this information every page as the user goes from page to page. This has worked well for the few small companies we have on it, but now we have the potential for a company to start using it with 10k plus people. I am trying to limit the amount of queries made on the database, but I have like 10 different items I would have to save in sessions. Is it common practice to have 10 session variables saved off and just call them from page to page. I am trying to figure out how to do this with the least amount of load on the server.

 

I really appreciate any thoughts or input on this.

clearly, saving the information into the session is far less intensive than querying for that information on every single page for every single user. you would be wise to do this to save the database a great deal of strain.  if you think about it, the more frequently you use the information, the more reason there is for storing the information.

well they are stored on the hard disk, which means they can be directly accessed rather than having to go through a db server intermediary.  the way i understand it, sessions are cleared from the disk on timeout, so they don't accumulate over time (i don't think).  that's something a bit of googling on your server of choice might answer for you.

 

i can say for certain that sessions will cause less of a strain over time than querying the db on every page for every user.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.