XPATH Library performance

I am working on a project which requires invoking multiple JBI endpoints based on routing requirements and type of input message. It is developed using heavy xpath expressions to choose the right path in the routing logic.

I started with default XPath library which is part of the JDK 1.6. To avoid the performance problem, I pre-compiled all the xpath expressions at startup time.

When I ran performance test on this router application, I was getting around 670 TPS (transactions per second) with 20% CPU idle (it's a 8 core machine) which is much slower than what I expected.

So I started looking for alternate XPATH libraries and I found VDT-XML benchmark where you can see VDT-XML outperforms jaxen and default jkd xpath implementation.

VDT-XML seem to be much faster (based on benchmark results :) )but due to it's license, I decided not to use for my project so I only option left was to try jaxen xpath library.

When I replaced default xpath library with jaxen, performance numbers changes drastically. Now I get 800 TPS with 70% CPU idle. In-fact I couldn't drive more CPU usage with my jmeter running on one machine.

So I would recommend jaxen library to anyone who is looking high performance, open source/free xpath library.

2 comments:

dontcare said...

You may want to look at vtd-xml to get the best possible XPath performance

http://vtd-xml.sf.net

Rohit Joshi said...

As I mentioned in my blog, I did look at VTD-XML but due to its license, I couldn't use in my project.