Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shopping carts - big deal?

Status
Not open for further replies.

GIGN

Programmer
Oct 6, 2000
1,082
NZ

I can't see what the big deal is with shopping carts. Is there any problem with storing references in Session, and just recalling from the database the appropriate stuff?

Seems extremely straight forward to me? What am I missing?
 
It depends on alot of things. The implementation of using session variables like that is very straightforward. The problem comes with site traffic. If you have ALOT of it, the performance of the server will suffer if you use them. But this also depends on how much memory your server has.

If shopping carts have two items in them and you have 100 visitors on your site, and your server has 1Gb of memory, then you aren't going to see any problems -- your server can easily handle it -- assuming it isn't bogged down doing something else (db work, for example).

A good rule of thumb is never to store "objects" in session. They hog much more memory, and will degrade the performance of your server much faster. You might want to store a connection string rather than the connection, itself.

Like I say, though... it all depends on your server's resources and the amount of traffic you expect on your site. If traffic goes up and performance starts to suffer, add more memory. Session variables are definitely the easiest way to go.

Hope that makes some sense. :)
Paul Prewett
penny.gif
penny.gif
 
Actually, yes I would only store a reference to the db record - I can't see the value in storing objects either.

I will restrict the Session to holding strings.

So you think this is the right way to go about a shopping basket, it makes sense to me?

Bj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top