File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Front Controller" Watch "Front Controller" New topic

Front Controller

Shaiju scientia

Joined: Jan 17, 2006
Posts: 15
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?

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

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="" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="" target="_blank" rel="nofollow">Check it here.</a><br /><a href="" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
I agree. Here's the link:
subject: Front Controller
It's not a secret anymore!