wood burning stoves 2.0*
The moose likes Servlets and the fly likes Front Controller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Front Controller" Watch "Front Controller" New topic
Author

Front Controller

Shaiju scientia
Greenhorn

Joined: Jan 17, 2006
Posts: 15
Hi,
I am new to the design patterns.I came across the front controller pattern,which is a servlet handling all the request coming from the client.
But its confusing me.Becasue if a single resource handles all the request wont it be a petformnace bottle neck?I guess it will hit the performance and the load the controller servelt.if there are 1000 simultaneaous request there wil be 1000 thread spawn for the controller servlet.Please correct me if I am wrong.Can anybody give me some information how this works out to be?

Regards
Shaiju
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

I guess it will hit the performance and the load the controller servelt.


It's always better to load the controller servlet at the starting of the server, using <load-on-startup> element in DD. Struts implements Front Controller. ActionServlet is the controller servlet there which handles everything for you and the good thing about it is you don't have to write any implementation code for it. Struts provides the implementation and you can use struts-config.xml file to declaratively control the invocation sequence of model and view components.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

pravegam ck,
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
You can neglect dispatching overhead. You have much worse overhead in Apache-Tomcat connectors. You can expect also that not every servlet container will spawn 1000 threads, requests are usually queued. Actually a selector in Java 5 allows to handle hundred thousands requests just by one thread.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Front Controller
 
Similar Threads
Patterns question
Diff btw Front Controller and MVC?
FrontController to swing client
About the Design pattern
Exact Front Controller In Realtime