Confusion in designing the Web layer in a J2EE application

Hi All,

Here is my doubt regarding optimum design for the web layer in a J2EE architecture.

I'm following the mediator pattern (as it is in J2ee blue print - Pet Store application), i,e,. I'm having a mediator servlet which degates the requests to appropriate Controller classes (which are dynamically invoked using a Controller Factory). In my entire application this is the single servlet - Mediator Servlet. There is a single controller class for each subsytem of the application. All the requests get mapped to one of these controller classes.

Now people also have another thought in this regard. They think that those controller classes should be actually a set of servlets. In that case, they feel, the performance will be better as the servlets will be better managed by the servlet engine. They will take at least less time for getting loaded memory than the ordinary java classes.

Can anybody tell me which one would be the better approach or what are the relative advantages/disadvantages for both the approaches ?

Thanks in advance,

Sourav

[1109 byte] By [souravm00] at [2007-9-26 6:45:56]
# 1
Can anyone please reply this mail ?
souravm00 at 2007-7-1 16:09:30 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Unless you are using SingleThreaded servlets and/or you synchronize anywhere in the servlet to shared objects (which is generally a stop-gap solution to a poor design), each invocation of the servlet spawns another thread to do it's work anyway...so I don't really see this as a potential performance problem with the mediator pattern...When the same servlet is called n times, there are essentially n threads created to handle the work, which to me is about the same as having n servlets called to do the work...As far as I can tell, the servlet spec doesn't indicate anything about concurrency or threading issues in this context to be a concern.

I'd like to see if somebody has some specific critieria for asserting that this approach is slower, maybe some specific application servers might have a problem with this?

dshaddo at 2007-7-1 16:09:30 > top of Java-index,Other Topics,Patterns & OO Design...