Project

Profile

Help

Bug #3289

closed

Performance bottleneck in SystemFunctionLibrary

Added by William McCusker almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Sprint/Milestone:
-
Start date:
2017-06-19
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.7
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

When an application attempts to create many new paths in parallel they get blocked by SystemFunctionLibrary.getSystemFunctionLibrary which is synchronized. Even after the cache in "THE_INSTANCES" is built threads creating new paths still get bottlenecked by the synchronization.

One option would be to remove the synchronization and use a concurrent map to ensure all callers use the same objects. Attached is such a potential change to SystemFunctionLibrary


Files

SystemFunctionLibrary.java (9.8 KB) SystemFunctionLibrary.java Class using concurrent map William McCusker, 2017-06-19 20:30
Actions #1

Updated by William McCusker almost 7 years ago

Example of call hierarchy that is hitting the synchronized block.

net.sf.saxon.functions.SystemFunctionLibrary.getSystemFunctionLibrary(int, Configuration)

net.sf.saxon.sxpath.AbstractStaticContext.setDefaultFunctionLibrary()

net.sf.saxon.xpath.JAXPXPathStaticContext.(Configuration)

net.sf.saxon.xpath.XPathEvaluator.(Configuration)

net.sf.saxon.xpath.XPathFactoryImpl.newXPath()

Actions #2

Updated by Michael Kay almost 7 years ago

The SystemFunctionLibrary has been completely redesigned for 9.8 and I think this particular contention spot should disappear. But we should probably look top-down at the performance of a workload that's doing a large number of XPath compile-and-go operations.

I suspect you might get better throughput if you run at lower concurrency?

And I wonder if you would get better performance if you used the s9api interface rather than JAXP? Unlike the JAXP XPath object, the s9api XPathCompiler is thread-safe once configured, and I suspect it has a significantly lower initialisation cost.

(Actually, Saxon's implementation of the JAXP XPath interface is thread-safe once configured, even though the API says it doesn't have to be.)

Actions #3

Updated by William McCusker almost 7 years ago

Thanks! I'll have to try the next release of 9.8 and I'll experiment with the s9api.

Actions #4

Updated by Michael Kay almost 7 years ago

  • Category set to Performance
  • Status changed from New to Closed
  • Assignee set to Michael Kay

I'm closing this with no action. Feel free to reopen if new evidence comes to light.

Please register to edit this issue

Also available in: Atom PDF