Does a servlet-based stack have significant overheads?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-06-05T18:50:57Z Indexed on 2010/06/05 19:22 UTC
Read the original article Hit count: 168

I don't know if it's simply because page-loads take a little time, or the way servlets have an abstraction framework above the 'bare metal' of HTTP, or just because of the "Enterprise" in Jave-EE, but in my head I have the notion that a servlet-based app is inherently adding overhead compared to a Java app which simply deals with sockets directly.

Forget web-pages, imagine instead a Java server app where you send it a question over an HTTP request and it looks up an answer from memory and returns the answer in the response. You can easily write a Java socket-based app which does this, you can also do a servlet approach and get away from the "bare metal" of sockets.

Is there any measurable performance impact to be expected implementing the same approach using Servlets rather than a custom socket-based HTTP listening app?

And yes, I am hazy on the exact data sent in HTTP requests and I know it's a vague question. It's really about whether servlet implementations have lots of layers of indirection or anything else that would add up to a significant overhead per call, where by significant I mean maybe an additional 0.1s or more.

© Stack Overflow or respective owner

Related posts about java

Related posts about Performance