This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Java Products and Servers and the fly likes J2EE - web container in a web server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "J2EE - web container in a web server" Watch "J2EE - web container in a web server" New topic
Author

J2EE - web container in a web server

Sub swamy
Ranch Hand

Joined: Oct 02, 2002
Posts: 121
In a typical J2EE application - would the web server have a web container or have a means for plugging in a web container? If so, the JSP/Servlets, presentation tier can be deployed on the web server and the business logic in the app server. This could also reduce the network round trips for static files.

Also would like to know if there is there any J2EE standard on this ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41149
    
  45
I don't know that there is a "typical J2EE application". Web server, servlet container (a much more common phrase than "web container") and app server could be 3 processes on 3 machines, or 3 processes on a single machine, or just a single process on a single machine, or anything in between.

Whether it makes sense to serve static resources from the web server or the servlet container really depends on the application. There might be performance reasons for keeping them on the web server, but there might also be other considerations that makes keeping them on the servlet container preferable. Plus, it used to be that servlet containers such as Tomcat weren't particularly good at serving static content, but those days are long gone.


Ping & DNS - my free Android networking tools app
Sub swamy
Ranch Hand

Joined: Oct 02, 2002
Posts: 121
It was the other factors that i wanted to know about.

To be specific, would having a web server(web container) + app server be a better combination than having a web server that routes all requests to the app server(web container + ejb container) ?

I thought the former approach having web container in the web server was better in the sense that the requests that do not need much business processing (ejb), need not be sent to the business tier in the app server and can be handled by the web server itself. Also, if this is the case, why do deployments of J2EE apps happen through a single ear in the app server ?

In anycase, i do agree that the static files could be served by the web server itself.

Would appreciate a response for this.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41149
    
  45
There are no general answers. Both separating web server and servlet container, and keeping them together, has advantages and disadvantages. It really depends on the network setup and the rest of the environment.

E.g., it's quite common to front a group of servlet containers with an Apache web server which handles clustering, failover and SSL termination.

Load issues also play a role - will more app servers than servlet containers be needed, or less, or just as many? That influences decisions about what to colocate on the same server.
Sub swamy
Ranch Hand

Joined: Oct 02, 2002
Posts: 121
Thanks for the response.

I also got an explanation from Mastering EJB - Ed Roman. Chapter 19 on Clustering. It talks about distributed and co-located architectures.
Jaffer Sadiq
Greenhorn

Joined: May 19, 2008
Posts: 24
Hi Dittmer,
You can manage all application deployment in one system it self or .....
Static pages are into Web Server, Business logic into App Server and so on.... Depends on your business ... But the thing is Keeping mind for performance they are placing separate.... If I have high end server I can have all it one ...

Thanks,
Jaffer
 
 
subject: J2EE - web container in a web server
 
Similar Threads
what is the need for a webserver to support servlet api
Difference between Application Server and Web Server
Integrating Tomcat 4.0.3 as a plugin within the regular Apache Web server.
What is difference between J2EE and Tomcat?
Difference Between Application Serve and Web server