[
https://issues.apache.org/jira/browse/OOZIE-2651?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Kanter updated OOZIE-2651:
---------------------------------
Description:
We noticed from some jstacks that Oozie was spending a lot of time looking for
XML related jars (we do a lot of XML parsing in Oozie and Hadoop code). For
instance, we'd see hundreds of threads blocked here
{noformat}
"pool-5-thread-57" prio=10 tid=0x00007f9579923000 nid=0x6b7f waiting for
monitor entry [0x00007f94225e3000]
java.lang.Thread.State: BLOCKED (on object monitor)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
- waiting to lock <0x0000000500026148> (a
org.apache.catalina.loader.WebappClassLoader)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at
javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:117)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:178)
at
javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:333)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:255)
at
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
at
org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2526)
at
org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2503)
at
org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2409)
- locked <0x00000007eac5ea28> (a org.apache.hadoop.conf.Configuration)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:1144)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:1116)
at org.apache.oozie.util.XConfiguration.copy(XConfiguration.java:206)
...
{noformat}
There's nothing we can do about the lock at the {{WebappClassLoader}}, but by
setting the {{javax.xml.parsers.DocumentBuilderFactory}} system property to
{{org.apache.xerces.jaxp.DocumentBuilderFactoryImpl}}, we can speed this up a
lot by getting rid of all of the searching that it's doing to find the
implementation.
See
https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance()
and
https://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/
In our testing, we had a metric around creating a new {{JobClient}}, which also
calls {{DocumentBuilderFactory.newInstance}}, and it dropped from ~3min max to
~2sec max (not an exact test of the savings here). And we also didn't see so
much blocking on this in the jstacks anymore.
was:
We noticed from some jstacks that Oozie was spending a lot of time looking for
XML related jars (we do a lot of XML parsing in Oozie and Hadoop code). For
instance, we'd see hundreds of threads blocked here
{noformat}
"pool-5-thread-57" prio=10 tid=0x00007f9579923000 nid=0x6b7f waiting for
monitor entry [0x00007f94225e3000]
java.lang.Thread.State: BLOCKED (on object monitor)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
- waiting to lock <0x0000000500026148> (a
org.apache.catalina.loader.WebappClassLoader)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at
javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:117)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:178)
at
javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:333)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:255)
at
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
at
org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2526)
at
org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2503)
at
org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2409)
- locked <0x00000007eac5ea28> (a org.apache.hadoop.conf.Configuration)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:1144)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:1116)
at org.apache.oozie.util.XConfiguration.copy(XConfiguration.java:206)
...
{noformat}
There's nothing we can do about the lock at the {{WebappClassLoader}}, but by
setting the {{javax.xml.parsers.DocumentBuilderFactory}} system property to
{{org.apache.xerces.jaxp.DocumentBuilderFactoryImpl}}, we can speed this up a
lot by getting rid of all of the searching that it's doing to find the
implementation.
See
https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance()
and
https://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/
In our testing, we had a metric around creating a new {{JobClient}}, which
eventually calls this code, and it dropped from ~3min max to ~2sec max.
> Set javax.xml.parsers.DocumentBuilderFactory sys prop to make XML handling
> faster
> ---------------------------------------------------------------------------------
>
> Key: OOZIE-2651
> URL: https://issues.apache.org/jira/browse/OOZIE-2651
> Project: Oozie
> Issue Type: Improvement
> Components: core
> Affects Versions: trunk
> Reporter: Robert Kanter
> Assignee: Robert Kanter
> Fix For: 4.3.0
>
>
> We noticed from some jstacks that Oozie was spending a lot of time looking
> for XML related jars (we do a lot of XML parsing in Oozie and Hadoop code).
> For instance, we'd see hundreds of threads blocked here
> {noformat}
> "pool-5-thread-57" prio=10 tid=0x00007f9579923000 nid=0x6b7f waiting for
> monitor entry [0x00007f94225e3000]
> java.lang.Thread.State: BLOCKED (on object monitor)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
> - waiting to lock <0x0000000500026148> (a
> org.apache.catalina.loader.WebappClassLoader)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
> at
> javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:117)
> at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:178)
> at
> javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:333)
> at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:255)
> at
> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
> at
> org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2526)
> at
> org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2503)
> at
> org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2409)
> - locked <0x00000007eac5ea28> (a org.apache.hadoop.conf.Configuration)
> at org.apache.hadoop.conf.Configuration.set(Configuration.java:1144)
> at org.apache.hadoop.conf.Configuration.set(Configuration.java:1116)
> at org.apache.oozie.util.XConfiguration.copy(XConfiguration.java:206)
> ...
> {noformat}
> There's nothing we can do about the lock at the {{WebappClassLoader}}, but by
> setting the {{javax.xml.parsers.DocumentBuilderFactory}} system property to
> {{org.apache.xerces.jaxp.DocumentBuilderFactoryImpl}}, we can speed this up a
> lot by getting rid of all of the searching that it's doing to find the
> implementation.
> See
> https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance()
>
> and
> https://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/
> In our testing, we had a metric around creating a new {{JobClient}}, which
> also calls {{DocumentBuilderFactory.newInstance}}, and it dropped from ~3min
> max to ~2sec max (not an exact test of the savings here). And we also didn't
> see so much blocking on this in the jstacks anymore.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)