473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Shopping Cart - database vs session

Hi All,

I am developing a site that makes use of a standard shopping cart. Anyone
can add items to the cart, but only registered users can actually check out.
When a user tries to check out, if they are not logged in they will be
prompted to either login or register before they can proceed to the
checkout.

There is NO requirement to allow users to add items to a shopping cart, and
return at some time in the future and still have those items in the cart.

My question is this: what are the pros and cons of storing the contents of
the cart in the database versus storing the cart contents in a session
variable. The author of one of my reference books (on ADO.NET) provides an
example of each approach, but says his preference is for a database driven
cart. I'm not sure why this would be - any thoughts?

Thanks in advance,

Regards,

Paul Hobbs
Nov 18 '05 #1
2 2345
Session Variables:
Pro - Very fast access
Con - Server memory is limited and expensive, using too much hinders
performance for the entire machine

Database:
Pro - Hard drive memory is cheap and doesn't hinder performance
Con - Much slower access

The usage pattern of your application and performance requirements will
guide you through the tradeoffs here. If you plan to have 1,000,000
simultaneous users, and you aren't judicious with your session variables,
you can run into trouble. If you plan to have 10 simultaneous users, they
might appreciate the improved performance of using session variables.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Paul Hobbs" <ph****@blueprint.net> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
Hi All,

I am developing a site that makes use of a standard shopping cart. Anyone
can add items to the cart, but only registered users can actually check out. When a user tries to check out, if they are not logged in they will be
prompted to either login or register before they can proceed to the
checkout.

There is NO requirement to allow users to add items to a shopping cart, and return at some time in the future and still have those items in the cart.

My question is this: what are the pros and cons of storing the contents of the cart in the database versus storing the cart contents in a session
variable. The author of one of my reference books (on ADO.NET) provides an example of each approach, but says his preference is for a database driven
cart. I'm not sure why this would be - any thoughts?

Thanks in advance,

Regards,

Paul Hobbs

Nov 18 '05 #2
Session dont work well in a webfarm environment. This is the biggest
advantage to Database or StateServer Session implementation.
Cheers,
Greg Jackson
PDX, OR
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Erik | last post by:
Does anybody know of a free ASP shopping cart or some free ASP code to help someone get a shopping cart started. Or does anybody have any experience using a ASP shopping cart that is inexpensive...
2
by: Don Grover | last post by:
I am retrieving costs and product id's from a sql db. and need to build a shopping cart around it. How do I store the selected items and qty req so I can move into another catalog and total up as...
1
by: Jia Sun | last post by:
hello , everybody , i need a similar program , just like fancyimport.com if possible, pls contact me ,thank you very much . inchina@gmail.com
1
by: Adil Akram | last post by:
I have created a site shopping cart in ASP.net. I am using ASP session object's SessionID on non SSL connection to track session. While adding products to cart DB I insert product and SessionID...
2
by: Guadala Harry | last post by:
I'm looking to implement some *minimal* shopping cart. I've looked at a few 3rd party packages, and they're all way too involved for what I need. So, I'm thinking it might make sense to roll my...
2
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic...
7
by: isaac2004 | last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart page i am having trouble generating 3 numbers; a subtotal, a shipping total, and a final price. here is my code i would...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
3
by: Paulo | last post by:
Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart concept on my application? When the user clicks add item, it will be stored on some storage format, I dont know what is the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.