Database vs Session Variables

Results 1 to 2 of 2

Thread: Database vs Session Variables

  1. #1
    Join Date
    Dec 1969

    Default Database vs Session Variables

    I&#039m working with a field-level application security for a payroll web site.<BR><BR>Current Implementation:<BR>Each ASP page calls an Oracle stored procedure that returns a listing of all FieldIDs and AccessCodes for the page, based on a FormID and UID. The result set is stored in a hash I&#039m faking so that only 1 database call is used to obtain security info. I then can pull the AccessCode for any FieldID using the hash. The database call takes less than 1 second and is almost instant.<BR><BR>Problem:<BR>The boss is worried about performance when a large number a users hit the site (say 5000 at a given point in time). She thinks that it&#039s better to store all of the security info for every ASP page in huge Session variables. This way, only 1 large database call is made during the user&#039s initial log-in instead of a smaller call on each ASP page. She&#039s concerned about the stored procedure calls killing performance. I&#039m concerned that the Session variables will kill performance.<BR><BR>Question: What&#039s better, make a stored procedure call on each page that returns a small result set, or use large Session variables to fake a hash that is populated by a single large database call?<BR><BR>You guys are the experts!

  2. #2
    Join Date
    Dec 1969

    Default RE: Database vs Session Variables

    If you&#039re going for scalability then avoid Session variables like the proverbial plague - that&#039s the advice from everyone I&#039ve spoken too. You&#039ve got a better chance of being able to optimise your database than you have of being able to optimise you Session vars, plus you can scale by just throwing more hardware at the problem. Using Session vars means you can&#039t scale past a single webserver, since they can&#039t be shared across multiple servers.<BR><BR>Every example I&#039ve seen that&#039s gone for high scalability has stored user state in a DB backend, not Session vars.<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts