[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[higgins-dev] Re: Bottleneck points in PDS service
- From: Markus Sabadello <markus.sabadello@xxxxxxxxx>
- Date: Tue, 8 Jun 2010 18:59:15 +0200
- Delivered-to: firstname.lastname@example.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=zfCqgdSix24PTPKFx7SLx0Pc/5BgnHBg5+28M2wEk0A=; b=TEn6E69osqnyU8rgbUox9rcxxMGfAzRr75lf2aGjE+JEN/SwLWVk1VQfJsduGLWEJq 4ZVft0+gZEpCeYLCRDWDmAhFvMfKSMlyRgeNUUnL7Cajh8zTYVUmgLKN/5w53JtBtR6R hMf7d64Io7msL6OzXyMtR5IRBK7tn8FyAHFLw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=NSsiy+zgIIJTL7rCeVRs0kRoNbQqLpCxEHpZUqXgnIwbFA1kq7xKNFottl7SBfO/fO RxP3puKHnd0WXWklZt3MMNhAztKCQzJ/5+qQE1apxtLWWsbYjZgTRsLe719a9157uBPt hHvlxiUpOEp7lWoHswM/qlBQ/LBAZiZhkJj8I=
I have checked in changes to return fresh XDIReader and XDIWriter instances instead of singletons.
On Fri, May 21, 2010 at 7:44 PM, Markus Sabadello <msabadello@xxxxxxxxx>
On Fri, May 21, 2010 at 4:13 PM, Sergey Lyakhov <slyakhov@xxxxxxxxxxxxxx>
I've profiled/debugged PDS service and found two bottlenecks in XDI4J:
1. The most part of processing time takes xdi4j.xri3.impl.parser.Parser, see attached 1_thread.html.
However this is a class generated from ABNF, and I am not sure there is a way to significantly increase its performance.
Yes I agree this is probably not possible..
The only option here would be to use String instead of XRI3Segment, but this would have big implications on the entire library, because in some places the functionality of XRI3Segment is really needed.
2. XDI has multithreading problems. The time of processing for parallel threads increases linearly
the number of threads (see attached 5_threads.html and 10_threads.html).
This occurs because XDIReaderRegistry contains singleton readers, which, in turn, are not thread-safe and
contain synchronized method read(). So, all threads in EndpointServlet.readFromBody() method get the same singleton
instance of XDIReader from XDIReaderRegistry and wait on its read() method. We can try to fix that by changing
XDIReaderRegistry to return a new instance of reader instead of singleton.
The reason why I used singletons was that I thought it's better to re-use the reader objects instead of creating/destroying them all the time. But yes, maybe I was wrong and its better to return new instances for every read operation.
Another thing to make sure is that the client sets the header Content-Type: text/xdi+x3, so that the XDI server uses the X3StandardReader instead of the AutoReader, but I think this is happening already.
Out of curiosity, what software did you use for profiling?