Re: Session or...?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello Lara,

Excellent question.
Typically you want to minimize the number of database trips, as well as minimize the amount of information you hold in memory. There are several ways of accomplishing this.

First, in a shopping cart environment what are the bits of info you need to track? User Credentials (are they logged in, what rights do they have, etc), Shopping Cart Contents, Misc Preferences.

User Credentials are easy.. ASP.NET has a rich authentication and authorization mechanism. This topic is too diverse to discuss thoroughly here, but you can find plenty of information on the sublect on the web and in books.

Shopping cart.. well.. we certainly do NOT want to store every bit of info about each item in the session. All we really need is the ProductID and Quantity. Armed with these two peices of info we can construct a checkout page with a single database call.
The session would be a good place to store the ID and Qty.

Misc Preferences is more difficult.. they can include anything from prefered web site display colors/fonts to rating preferences to all kinds of things. Each preference should be taken on a case by case basis and stored/accessed accordingly. Just remember to design to minimal system impact. Dont read the database more than you have to. Dont store information in the session that is only occasionally used.. etc.

-Boo

Hi all,

I have an assignment due (asp.net in c#) that requires us to think of
a large-scale online stores allowing for thousands of users at a time
to be logged in, creating accounts and so on. We have been told to
choose either sessions and / or databases to hold necessary
information but I'm a bit stuck (and very interested) in how it would
really work! Can anyone point me in the right direction here? A web
reference, a good example online or something please? I don't think
this course is very indepth, so forgive me for the silly questions...I
just don't see how using a session on one or even a few servers would
be the best thing to do, nor would calling and somehow storing
somewhere else (in the session too???) all the user's account
information when we're talking about thousands of users at a time -
wouldn't this clog up the memory, speed or whatever else of the web
server(s)? How is it really done (in asp.net and c# of course!)?

Many thanks in advance for any guidance :)
Lara


.



Relevant Pages

  • Re: PHP authentication for rookies
    ... >> username and password which you store however you will. ... >> using the php session functions. ... > Are there any advantages to using a database to store user credentials? ... Flat files don't scale or have the ability to do dynamic updates. ...
    (comp.lang.php)
  • Re: PHP MySQL object question
    ... In more complicated applications I layer a business object on top of the database objects. ... For instance, a business object may get information from several different tables, and when you update the data in the business object, it updates the underlying tables. ... Since I am only dealing with one composite record at a time I was planning to store the original field data for before and after comparison to determine when and where updates are needed. ... I could do it as separate session variables, but since each table record will have an associated object, why not just store them that way? ...
    (comp.lang.php)
  • Re: Caching often-used SQL queries
    ... The problem is that neither one of those are user (session) specific. ... need to enable sessions and store the data in the session context. ... Second - you'd be caching so much data that it would ... And if you tune your database server you'll spend much more time processing ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Session sharing between ASP and ASP.NET
    ... In my opinion, and though it may vary depending on the nature of your application, a database to store temporary information based on GUID or some other form of session key generated when the user hits the site and persists during the duration of their visit, would be easier than Yuen's example. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Hide GET Variables --> Pass values using Session
    ... >> Whether or not you store these preferences in a session or a database is ... I've been meaning to run some definitive speed tests to determine relative ...
    (comp.lang.php)