[Yanel-dev] Unnecessary LOCKING at Resource instantiation

basZero baszero at gmail.com
Wed Apr 29 03:38:36 EDT 2020


Hi,

today I noticed the following bottleneck in Yanel's implementation:

for each request, the resource gets instantiated. and for each request, the
resource config XML gets parsed. During this parsing, obviously something
requires a Java System Property to be read, and this access obviously gets
synchronized, which is VERY bad for concurrency.

We have about 90 requests per second at peak time, and this is now our next
bottleneck (many others have been eliminated in the past).

Here is the stack trace. Any idea, what exactly gets parsed here and why?
I will optimize this code in my own Yanel branch and get rid of it (e.g.
permanent caching of resource config would help a lot).

"http-bio-443-exec-6766" #10541 daemon prio=5 os_prio=0
tid=0x00007f970d2bb800 nid=0x6ccf waiting for monitor entry
[0x00007f9590c4c000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.util.Hashtable.get(Hashtable.java:362)
	- waiting to lock <0x00000001806b31b0> (a java.util.Properties)
	at java.util.Properties.getProperty(Properties.java:969)
	at java.lang.System.getProperty(System.java:720)
	at org.apache.xerces.parsers.SecuritySupport$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.xerces.parsers.SecuritySupport.getSystemProperty(Unknown Source)
	at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
	at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown
Source)
	at org.wyona.yanel.core.util.ConfigurationUtil.getCustomConfiguration(ConfigurationUtil.java:170)
	at org.wyona.yanel.core.ResourceConfiguration.load(ResourceConfiguration.java:194)
	at org.wyona.yanel.core.ResourceConfiguration.<init>(ResourceConfiguration.java:69)
	at org.wyona.yanel.core.ResourceTypeMatcherV1ImplV2.getResourceConfiguration(ResourceTypeMatcherV1ImplV2.java:66)
	at org.wyona.yanel.core.ResourceManager.getResource(ResourceManager.java:138)
	at org.wyona.yanel.servlet.YanelServlet.getResource(YanelServlet.java:1108)
	at org.wyona.yanel.servlet.YanelServlet.getContent(YanelServlet.java:608)
	at org.wyona.yanel.servlet.YanelServlet.doGet(YanelServlet.java:530)
	at org.wyona.yanel.servlet.YanelServlet.service(YanelServlet.java:414)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mx2.wyona.com/pipermail/yanel-development/attachments/20200429/380d9811/attachment.html>


More information about the Yanel-development mailing list