File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Design question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Design question" Watch "Design question" New topic

Design question

Amit Chandak

Joined: Sep 28, 2003
Posts: 9
I am working on an e-Commerce retail website. I have been asked to implement a functionality to keep a track of the last 5 products viewed by a shopper. A product is uniquely identified by two strings.
I wanted to know from the gurus as to where should this information be stored. It is obvisouly possible to store it in the session, but since it is a high traffic website i am concerned what performance impact it might have? Is it possible to implement it in any other way?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Well, if it's not in the session it has to be somewhere else. Some possibilities:
  • session
  • database
  • cookies
  • other wacked out places?
  • Since you have stated that it is only ten strings total for each session, it wouldn't be that much of a drain on resources. It is certainly quick to take things from the session and do stuff with them. The database routine eliminates the need to place that data in memory all the time, but it takes much longer to get the data in order to use it. Cookies eliminates both those problems, but putting things in cookies opens up a whole different bag of problems for you (like, what if they don't allow cookies).
    Before ruling out the session (which I would recommend), take a look at your memory requirements. How many sessions do you expect to have open all the time? How much memory will be used up by each session object? Is there enough, or not enough? If there is enough, then go for it. If not, then freak out and look for some other solution.

    Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
    I agree. Here's the link:
    subject: Design question
    It's not a secret anymore!