views:

23

answers:

2

This is how the system works:

I have a catalog of items. An guest user can choose to add an item from the catalog to what we call the inquiry bin. The system keeps track of the items added to the inquiry bin for that particular session. The user can delete items from the bin.

I was wondering what may be the most optimal way of storing these items. Database? Sessions? or Cookies?

Thanks in advance!

+1  A: 

Are these inquiry items required to be available to everyone? Or just the particular user that created them?

If they have to be globally available, then you'd have to stick them in the database, with appropriate flag fields to mark them as temporary and which session created them. If it's per user, then it's best to stick them in the session.

Cookies shouldn't be used for major data storage, even if it's just a few items. The less data the client has, the less chance there is to mess around with the innards of your system by feeding bad data via the cookie. If there's just a session ID, then there's essentially no chance of doing anything, other than guessing someone else's session ID.

Marc B
A: 

Client side cookies have best performance, No round trip to web server is a big win for performance. But Cookie has size limitation. see following link about limitation on IE, Other browser should have similar limitation. http://support.microsoft.com/kb/306070, cookies are used for small amount day storage, like session key.

Session normally means one of server process, if you use on a web farm, Session can not be shared across multiple web server. If you have a single web server, session should be best way to store information on the server side.

For database, it is most flexible solution, but it has performance hit. for high performance website, proper caching is key to go.

Russel Yang