i'm working on a java web application which will sends and receives JSON strings. The JSON is generated through jersey and maps to a jaxb anotated pojo.
The application itself isn't very complex but needs to work under heavy traffic. I tried two approaches. First servlet based with jetty as container and second as console application with oracles HttpServer class (using jetty through "HttpServerFactory.create(..)").
I tested both versions with apaches ab tool. Doing 10,000 request on a concurrency level of 100. To my surprise console application needed significantly less time to response and had a higher transfer rate. I expected the opposite result.
Is a plain console app realy a better solution in therms of performance for small applications? Thanks.
Without more information it's almost impossible to tell why your console application performed faster than the Jetty server.
I would expect that an embedded Jetty instance could perform a little faster than a Jetty servlet as the embedded Jetty instance would be able to strip away parts of the servlet API that aren't needed (in that application) and thereby reduce overheads. I would not expect the difference to be significant.
But: in a small benchmark like the one you performed, I'd be much more likely to suspect that a configuration issue (in either the server or the benchmark) is producing the difference in results.