Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Front Controller

 
Shaiju scientia
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic