You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Kevin Conaway (JIRA)" <ji...@apache.org> on 2009/07/15 20:52:14 UTC

[jira] Created: (CXF-2342) Performance issue in StaxInInterceptor

Performance issue in StaxInInterceptor
--------------------------------------

                 Key: CXF-2342
                 URL: https://issues.apache.org/jira/browse/CXF-2342
             Project: CXF
          Issue Type: Improvement
    Affects Versions: 2.2.2
            Reporter: Kevin Conaway


>From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:

In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).

Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-2342) Performance issue in StaxInInterceptor

Posted by "Kevin Conaway (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Conaway updated CXF-2342:
-------------------------------

    Attachment: CXF-2342.patch

Attaching patch that adds a pool of XmlInputFactory/XmlOutputFactory instances instead of reusing a single one.

I've also made StaxUtils.getXMLInputFactory and StaxUtils.getXMLOutputFactory() private so that callers are forced to use the convenience methods to create readers and writers.

I hard coded the pool size to be 10.  Perhaps someone from the project can make a more informed decision as to how this can be configured

> Performance issue in StaxInInterceptor
> --------------------------------------
>
>                 Key: CXF-2342
>                 URL: https://issues.apache.org/jira/browse/CXF-2342
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.2
>            Reporter: Kevin Conaway
>         Attachments: CXF-2342.patch
>
>
> From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:
> In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).
> Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2342) Performance issue in StaxInInterceptor

Posted by "Kevin Conaway (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732784#action_12732784 ] 

Kevin Conaway commented on CXF-2342:
------------------------------------

Thanks so much Dan.

The reason I made getXmlInput/OutputFactory private is to eliminate the chance of someone taking a factory from the pool but not returning it.  I'll leave that as a risk for you to mitigate though :)

> Performance issue in StaxInInterceptor
> --------------------------------------
>
>                 Key: CXF-2342
>                 URL: https://issues.apache.org/jira/browse/CXF-2342
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.2
>            Reporter: Kevin Conaway
>            Assignee: Daniel Kulp
>             Fix For: 2.1.6, 2.2.3
>
>         Attachments: CXF-2342.patch
>
>
> From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:
> In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).
> Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-2342) Performance issue in StaxInInterceptor

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-2342:
--------------------------------

    Assignee: Daniel Kulp

> Performance issue in StaxInInterceptor
> --------------------------------------
>
>                 Key: CXF-2342
>                 URL: https://issues.apache.org/jira/browse/CXF-2342
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.2
>            Reporter: Kevin Conaway
>            Assignee: Daniel Kulp
>         Attachments: CXF-2342.patch
>
>
> From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:
> In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).
> Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2342) Performance issue in StaxInInterceptor

Posted by "Sergey Pulyaev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745010#action_12745010 ] 

Sergey Pulyaev commented on CXF-2342:
-------------------------------------

I cannot access XMLOutputFactory because of this patch - so i cannot specify required flags - for example - AUTOMATIC_EMPTY_ELEMENTS.

I have done an interceptor that changes XML output factory properties - but it's not work now.

      XMLOutputFactory outputFactory = StaxOutInterceptor.getXMLOutputFactory(message);
      if(WstxOutputFactory.class.isAssignableFrom(outputFactory.getClass())){
           WstxOutputFactory of = (WstxOutputFactory)outputFactory;
          of.getConfig().setProperty(XMLOutputFactory2.P_AUTOMATIC_EMPTY_ELEMENTS, false);
       } 

Now StaxOutInterceptor.getXMLOutputFactory always returns NULL - so i have no way to specify this flag anymore.


> Performance issue in StaxInInterceptor
> --------------------------------------
>
>                 Key: CXF-2342
>                 URL: https://issues.apache.org/jira/browse/CXF-2342
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.2
>            Reporter: Kevin Conaway
>            Assignee: Daniel Kulp
>             Fix For: 2.1.6, 2.2.3
>
>         Attachments: CXF-2342.patch
>
>
> From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:
> In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).
> Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2342) Performance issue in StaxInInterceptor

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2342.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.3
                   2.1.6

> Performance issue in StaxInInterceptor
> --------------------------------------
>
>                 Key: CXF-2342
>                 URL: https://issues.apache.org/jira/browse/CXF-2342
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.2
>            Reporter: Kevin Conaway
>            Assignee: Daniel Kulp
>             Fix For: 2.1.6, 2.2.3
>
>         Attachments: CXF-2342.patch
>
>
> From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:
> In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).
> Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2342) Performance issue in StaxInInterceptor

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12731659#action_12731659 ] 

Daniel Kulp commented on CXF-2342:
----------------------------------


I've committed a slightly modified version of this to trunk (and soon to the other branches).

Basically, the changes to StaxIn/StaxOut wouldn't have worked.   We DO need to be able to specify a factory separate from the StaxUtils cached versions.   That is how things like JSON and FastInfoset support work.   They place a factory that is used instead.   I changed the methods to return null if they don't find one and then call StaxUtils if null.   Otherwise, sync on the factory and call the factory.    

I've also changed to using a LinkedBlockingQueue and NOT pre-populate anything.  If poll returns null, it will just create a new one.   Thus, on low-volume cases, the queue may stay small with just a couple instances.   On higher volume, it may grow.   Also, that could allow the call to getXmlInputFactory() to remain public.(although I didn't do that right now)   If they don't return it, it's not a HUGE deal as another would get created.  



> Performance issue in StaxInInterceptor
> --------------------------------------
>
>                 Key: CXF-2342
>                 URL: https://issues.apache.org/jira/browse/CXF-2342
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.2
>            Reporter: Kevin Conaway
>            Assignee: Daniel Kulp
>         Attachments: CXF-2342.patch
>
>
> From this mailing list thread [Performance issue in StaxInInterceptor|http://www.nabble.com/Performance-issue-in-StaxInInterceptor-td24499018.html]:
> In cxf-2.2.2, StaxInInterceptor#handleMessage() synchronizes on the XMLInputFactory before calling XMLInputFactory#createXMLStreamReader(InputStream, String).
> Profiling our application reveals this to be a pain point in high volume situations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.