> -----Original Message-----
> From: Bill Miller [mailto:millebi.subscripti...@gmail.com]
> Sent: Monday, June 13, 2011 3:58 PM
> 
> >> Enlighten me: what is "the" reason that this is common practice?
...
> -Static image serving (much more economical because the HTTP server is much 
> lighter
> "weight" than a JVM/App server) -etc...

I've heard this claim before, but I'm not so sure I believe it.  Apache httpd 
is a web server implemented in C that runs directly on the OS.  Apache Tomcat 
is a web server written in Java that runs on a JVM.  I'd hope both are written 
near-optimally for their respective environments, and there's no good reason 
Java needs to be slow.

I just tried a trivial benchmark of a static file (187 bytes) that yielded 
3,223 req/sec from httpd, and 3,172 req/sec from Tomcat.  That's a difference 
under 2%.  A 2% performance difference isn't compelling enough to me to make an 
architectural decision one way or the other.  I haven't benchmarked larger 
files, but I can imagine that APR's sendfile support would give Tomcat an 
assist there.

On the other hand, there are other good reasons to use Java as a web server in 
favor of httpd.   Security, for one--I shouldn't need to worry about e.g. stack 
buffer overflow exploits when running a Java server.

My hope is that Tomcat and its ilk will slowly replace older web server 
technology for static and dynamic content alike.  That's not just for 
simplicity's sake, but that I also see the difference between "static" and 
"dynamic" requests starting to evaporate.  We serve a lot of cacheable requests 
from our application, all idempotent requests, and they are not normally backed 
by file system content.  They could just as well be a row in a database or 
search engine results.  The distinction of "static" content (i.e. content 
served by files on a file system) isn't useful to me because it's not very 
different than content served from other sources.  But, unlike Apache httpd, 
Tomcat is built on a technology that is very easy to extend for e.g. database 
access.

The architectural shift away from file content seems to be accelerated by 
adoption of distributed and (especially) cloud computing, in which a central 
read/write file system is not always convenient or available.  Distributed file 
systems exist but have not proven to be as effective as relational databases or 
any of the No-SQL technologies such as Hadoop.  Hence the traditional "static" 
vs. "dynamic" distinction is most likely becoming obsolete.

-Jeff

Reply via email to