From: Stef E. <st...@ep...> - 2009-10-28 12:33:06
|
Hi, very useful work. On Wed, Oct 28, 2009 at 07:40:22AM -0400, Solomon Duskis wrote: > > I started with a profiler (Eclipse TPTP), but that seemed to get false > results. I moved on to targeted testing with System.currentTimeInMillis > testing. the 50-times test ended up taking 1.3 seconds on my machine, which > comes out to 65 ms per call. That's pretty good, but I wanted to figure out > what part of that was RESTEasy code. Sorry to sound harsh but 15 calls per second is terrible performance. Especially if your method is doing nothing (no DB in particular). In our benchmarks, we were able to get 30 calls per second to JBoss + RESTEasy (via Seam and thus several filters) with a few JPA/Hibernate calls, JAXB unmarshalling and Hibernate Validation active. That was without any optimisation, and we considered that very bad performance. > Removing TJWS + Apache HttpClient > I started by stripping out TJWS and HttpClient. I created an > "InMemoryClientExecutor" which essentially creates a SynchronousDispatcher > and uses an in-memory process to translate a ClientRequest to a > MockRequest/Response and calls dispatcher.invoke(mockRequest, > mockResponse). > The results were amazing. Without TJWS and HttpClient, the results for the > 50-times test were completed ~360 ms, or about 1.8 ms/call. 550 calls per second is already an order of magnitude better, but these results are biased, not because you removed the client cost (this is OK) but because you removed the server costs of dispatching the HTTP call to the RESTEasy servlet and the RESTEasy servlet costs. The best way to test that is probably to time the servlet container during the whole dispatch, and compare it with other servlet containers. This way we can then substract the cost you calculated of the RESTEasy dispatcher to know how much the servlet container and RESTEasy servlet are costing. > JAXB vs. RESTEasy execution > Out of that 360 ms, JAXB took 296 ms. That means that JAXB was 82% of the > execution time, and RESTEasy (both client and server) were18%. In an > average call RESTEasy + Resource with Map store took .32 ms.. I now expect no less of you than to tell us how to optimize JAXB ;) Maybe we need to do some caching of the JAXB structures/analyis? I cannot believe parsing XML is that expensive, so I suspect that we might be paying the cost of JAXB analysing the JAXB classes with reflection every time. I could be wrong of course. -- Stéphane Epardaud |