You are developing an online shopping store for an art gallery. The company aims to bring fine art to the masses and expects a huge volume of traffic through the site. The site allows customers to pay for goods and arrange delivery methods using credit cards. You have read through the requirements and have a rough design in your head. Which of the following is the most appropriate rough design for this site?
A: EntityBean for Customer, Servlet for user session, BMT for transaction B: EntityBean for Customer, Stateful SB for use session, BMT for transaction C: EntityBean for Customer, Servlet for user session, CMT for transaction D: EntityBean for Customer, Stateful SB for user session, CMT for transaction
Because of the "...huge volume of traffic" I voted for D since it seems more scalable. However, to my surprise the correct answer is C.
This is one of those that can probably be argued a number of ways depending upon the details of the implementation, but...
Here's my best guess of their "intentions/thought process"...
A SFSB is much heavier weight than an HTTPSession object. Give the high volume of users, they preferred the HTTPSession over the SFSB.
One item to watch out for here in terms of implementation is server affinity. Using an HTTPSession is fine, but you'll need to deal with the issue that the session is tied to the server the the session starts with unless you've got some kind of load balancing going on. Not sure what the options are either. Another approach is not to use the HTTPSession Object at all, but utilize a URL rewrite value to help you look up the session data in some persistent source like a database (...maybe with a check to make sure the request came from the same IP). With a little work you could set it up so that server affinity wouldn't be an issue because the "sesssion" memory would not be tied to a particular app server but in a database somewhere that could be shared by all. The SFSB handles this too, if it's remote and accessible by all servers, but at a cost of the overhead.
Both HTTP Session and SFSB are choices. HTTP Session is more popular. But if you want to have client agnostic design then SFSB is a better choice.
In a white paper published by BEA on WebLogic server (at BEA.com), the performance of maintaining state in HTTP Session and SFSB is comparable. In certain cases SFSB was outperforming the HTTP Session.
I am not recommending you to use SFSB. This is a debatable issue.
Suggest you should do a proof of concept with load tests on whatever you pick as final implementation
thanks for your advice. I hope in the Part I exam, the quetions are asked less ambiguous and that the questions make it clear whether to use HTTPSession or SFSBs. In the mock from above either one could be correct, so how will one decide if HTTPSession or SFSB is the better choice.
I hate to dash your hopes, but if the questions are anything like the ones I had they were a bit tricky. I'm not sure if they were ambiguous, but the way they are worded made me feel that they were trying to mislead you at times. Unless you are extremely confident with the material they are very challenging.