[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[higgins-dev] Bottleneck points in PDS service

Markus,

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.

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.

Thanks,
Sergey Lyakhov
Execution Statistics - unknown at lyakhov [ PID: 18005 ]
Package <Base Time (seconds) Average Base Time (seconds) Cumulative Time (seconds) Calls
[-] org.eclipse.higgins.xdi4j.xri3.impl.parser 2.750492 0.000097 2.750492 28389
    [-] Parser 2.413481 0.000101 2.750492 23846
            decode_StringValue(java.lang.String) org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$StringValue 0.447630 0.000153 0.717258 2930
            pop(java.lang.String, boolean, int) void 0.363105 0.000046 0.363105 7878
            decode_NumericValue(java.lang.String, java.lang.String, int) org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$NumericValue 0.282829 0.000198 0.444954 1426
            decode_iunreserved() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$iunreserved 0.146287 0.000347 1.146472 421
            push(java.lang.String) void 0.143105 0.000041 0.143105 3530
            push(java.lang.String, java.lang.String) void 0.124827 0.000043 0.124827 2930
            decode_ALPHA() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$ALPHA 0.118466 0.000281 0.527425 421
            decode_xri_pchar() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$xri_pchar 0.108411 0.000258 1.668247 421
            decode_gcs_char() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$gcs_char 0.064499 0.000403 0.268826 160
            push(java.lang.String, java.lang.String, java.lang.String) void 0.056941 0.000040 0.056941 1426
    [+] Rule 0.079069 0.000048 0.079069 1637
    [+] Parser$ALPHA 0.058602 0.000107 0.078298 548
    [+] Parser$xri_pchar 0.047259 0.000086 0.063165 548
    [+] Parser$iunreserved 0.044059 0.000080 0.054450 548
    [+] Parser$NumericValue 0.023890 0.000087 0.036128 274
    [+] Parser$subseg 0.015814 0.000101 0.018772 156
    [+] Parser$gcs_char 0.015168 0.000082 0.018669 186
    [+] Parser$global_subseg 0.015012 0.000082 0.018644 184
    [+] Parser$literal 0.011734 0.000080 0.014612 146
[+] org.eclipse.higgins.xdi4j.io 1.072608 0.002530 2.660948 424
[+] org.eclipse.higgins.idas.cp.rdf2.impl 0.986696 0.082225 0.986734 12
[+] org.eclipse.higgins.xdi4j.xri3.impl 0.755928 0.000333 3.483660 2272
[+] org.eclipse.higgins.xdi4j.impl.memory 0.431276 0.000687 0.499036 628
[+] org.eclipse.higgins.xdi4j.messaging 0.212099 0.000371 0.913515 571
[+] org.eclipse.higgins.xdi4j.messaging.server 0.179809 0.012843 6.656804 14
[+] org.eclipse.higgins.xdi4j.impl 0.066009 0.000446 0.075236 148
[+] org.eclipse.higgins.idas.proxy 0.056609 0.004717 2.102434 12
[+] org.eclipse.higgins.xdi4j.messaging.server.impl 0.030162 0.001160 2.734758 26
Execution Statistics - unknown at lyakhov [ PID: 18167 ]
Package <Base Time (seconds) Average Base Time (seconds) Cumulative Time (seconds) Calls
[-] org.eclipse.higgins.xdi4j.xri3.impl.parser 29.136240 0.000299 29.136240 97488
    [+] Parser 25.457523 0.000311 29.136240 81910
    [+] Rule 0.722059 0.000129 0.722059 5608
    [+] Parser$ALPHA 0.600648 0.000327 0.713200 1836
    [+] Parser$iunreserved 0.514586 0.000280 0.659610 1836
    [+] Parser$xri_pchar 0.510353 0.000278 0.617685 1836
    [+] Parser$NumericValue 0.249927 0.000272 0.363276 918
    [+] Parser$gcs_char 0.179973 0.000282 0.208933 638
    [+] Parser$global_subseg 0.179423 0.000282 0.232805 636
    [+] Parser$subseg 0.125755 0.000271 0.157500 464
    [+] Parser$literal 0.116042 0.000265 0.145595 438
[-] org.eclipse.higgins.xdi4j.messaging.server 16.503250 0.211580 66.269191 78
    [-] EndpointServlet 16.468306 0.279124 66.269191 59
            readFromBody(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) org.eclipse.higgins.xdi4j.messaging.MessageEnvelope 14.774707 1.477471 26.502365 10
            sendResult(org.eclipse.higgins.xdi4j.messaging.MessageResult, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void 1.570270 0.174474 2.054770 9
            execute(org.eclipse.higgins.xdi4j.messaging.MessageEnvelope, org.eclipse.higgins.xdi4j.messaging.server.MessagingTarget, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) org.eclipse.higgins.xdi4j.messaging.MessageResult 0.081696 0.008170 37.665725 10
            findMessagingTarget(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) org.eclipse.higgins.xdi4j.messaging.server.MessagingTarget 0.021808 0.002181 0.025341 10
            processPostRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void 0.011499 0.001150 66.260865 10
            doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void 0.008326 0.000833 66.269191 10
    [+] EndpointRegistry 0.034944 0.001839 0.034944 19
[+] org.eclipse.higgins.idas.cp.rdf2.impl 7.154126 0.077762 7.154480 92
[+] org.eclipse.higgins.xdi4j.xri3.impl 3.163009 0.000315 32.269896 10057
[+] org.eclipse.higgins.idas.proxy 2.750889 0.036196 23.926678 76
[+] org.eclipse.higgins.xdi4j.messaging 2.412885 0.000848 5.599597 2845
[+] org.eclipse.higgins.xdi4j.impl.memory 1.474631 0.000431 2.227595 3421
[+] org.eclipse.higgins.xdi4j.io 0.796342 0.000488 8.772104 1632
[+] org.eclipse.higgins.xdi4j.impl 0.749180 0.000797 0.969203 940
[+] org.eclipse.higgins.as 0.634668 0.009473 0.787123 67
Execution Statistics - unknown at lyakhov [ PID: 18376 ]
Package <Base Time (seconds) Average Base Time (seconds) Cumulative Time (seconds) Calls
[-] org.eclipse.higgins.xdi4j.messaging.server 57.058745 0.633986 138.950985 90
    [-] EndpointServlet 57.007592 0.950127 138.950227 60
            readFromBody(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) org.eclipse.higgins.xdi4j.messaging.MessageEnvelope 48.335809 4.833581 65.046512 10
            sendResult(org.eclipse.higgins.xdi4j.messaging.MessageResult, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void 8.517519 0.851752 10.077293 10
            doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void 0.076527 0.007653 138.950227 10
            execute(org.eclipse.higgins.xdi4j.messaging.MessageEnvelope, org.eclipse.higgins.xdi4j.messaging.server.MessagingTarget, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) org.eclipse.higgins.xdi4j.messaging.MessageResult 0.048369 0.004837 63.717306 10
            findMessagingTarget(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) org.eclipse.higgins.xdi4j.messaging.server.MessagingTarget 0.020433 0.002043 0.021076 10
            processPostRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void 0.008935 0.000893 138.873701 10
    [+] EndpointRegistry 0.051153 0.001705 0.051153 30
[-] org.eclipse.higgins.xdi4j.xri3.impl.parser 46.601419 0.000468 46.601419 99513
    [-] Parser 40.901421 0.000489 46.601419 83587
            decode_StringValue(java.lang.String) org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$StringValue 7.727352 0.000747 12.541608 10347
            pop(java.lang.String, boolean, int) void 6.069264 0.000220 6.069264 27624
            decode_NumericValue(java.lang.String, java.lang.String, int) org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$NumericValue 4.061131 0.000840 7.042438 4834
            push(java.lang.String) void 2.772412 0.000223 2.772412 12443
            push(java.lang.String, java.lang.String) void 2.403805 0.000232 2.403805 10347
            decode_iunreserved() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$iunreserved 2.341118 0.001636 18.268974 1431
            decode_ALPHA() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$ALPHA 1.923859 0.001344 7.956026 1431
            decode_xri_pchar() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$xri_pchar 1.849527 0.001292 26.834277 1431
            push(java.lang.String, java.lang.String, java.lang.String) void 1.161920 0.000240 1.161920 4834
            decode_gcs_char() org.eclipse.higgins.xdi4j.xri3.impl.parser.Parser$gcs_char 1.126510 0.001932 4.505486 583
    [+] Rule 1.290699 0.000225 1.290699 5733
    [+] Parser$iunreserved 0.855441 0.000456 1.046797 1876
    [+] Parser$ALPHA 0.827930 0.000441 1.042043 1876
    [+] Parser$xri_pchar 0.809764 0.000432 1.021660 1876
    [+] Parser$NumericValue 0.409141 0.000436 0.624630 938
    [+] Parser$gcs_char 0.281124 0.000432 0.361617 650
    [+] Parser$global_subseg 0.258846 0.000398 0.322397 650
    [+] Parser$subseg 0.155374 0.000331 0.190034 470
    [+] Parser$literal 0.151399 0.000339 0.196707 446
[+] org.eclipse.higgins.idas.cp.rdf2.impl 14.002660 0.072931 14.005165 192
[+] org.eclipse.higgins.xdi4j.xri3.impl 4.882577 0.000478 51.215716 10212
[+] org.eclipse.higgins.idas.proxy 3.492929 0.043123 39.765002 81
[+] org.eclipse.higgins.as 3.390204 0.018627 3.969223 182
[+] org.eclipse.higgins.xdi4j.messaging 3.225453 0.001133 7.037514 2848
[+] org.eclipse.higgins.xdi4j.impl.memory 1.969135 0.000563 2.776412 3495
[+] org.eclipse.higgins.xdi4j.io 1.222081 0.000745 13.996577 1640
[+] org.eclipse.higgins.xdi4j.util.iterators 0.851448 0.000402 6.807340 2120