Hello!

I want to have some idea about a performance issue that i am having  
on my application.


Basically, what the application do, is a sort of webserver, used to  
parse POST xml request.

For that reason i have a NIO http ws, based on grizzly library, and  
for xml handling i use dom4j

the parsing is done via
req = DocumentHelper.parseText(post).getRootElement();


The design is more or less the follow
---SELECTOR THREAD (NIO)---
    ---READ THREAD1---
    --READ THREAD2---
(this 2 reader thread will increase the performance under heavy load)
then, there is an executor thread pool, that have a MIN and MAX  
worker thread.
When a selector is readed, and is ready to be executed, it will be  
passed to a "worker" thread, and the worker thread
will do the rest.

Basically all the parsing logic is on worker threads, the rest is  
just NIO stuff and HTTP protocol stuff, to worker thread, there is a  
REQUEST and RESPONSE
object, ready for use.

While profiling the code, to make sure that everything is ok, i  
noticed that 90% of the time is spent by
Element req = DocumentHelper.parseText(post).getRootElement();

which is actually pretty high :S

Also, seems that there is some locking around the code, because two  
different WORKER thread have a lock
on req = DocumentHelper.parseText(post).getRootElement();

Can you please give to me some advice to increase the performance of  
parsing?

Maybe i can create something in the workerthread to avoid locking?

When i get the Element req, processing it is blazing fast, using some  
"setattribute, getattribute" or even some iteration.

The string size, is normally very very small, never more than 1k,  
often less than 100 char

best regards!

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to