[ 
https://issues.apache.org/jira/browse/CXF-7641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18127903#comment-18127903
 ] 

Colm O hEigeartaigh commented on CXF-7641:
------------------------------------------

Adding a patch to buffer the response like we do for requests to solve this 
problem. It's enough of a breaking change to warrant only going in CXF 4.3.0.

When CXF has to buffer an outbound message (for example, when schema validation 
of responses is enabled), {{CachingXmlEventWriter}} used to create a new 
namespace context and map for every XML element, even though almost no elements 
declare namespaces. The patch creates one only when an element actually 
declares a namespace, which cuts total allocation by about 19% for large 
messages and reduces garbage-collection work. Namespace scoping is unchanged, 
and a test covers it.

This is only a partial improvement for this issue. The buffered message is 
still stored in memory as one object per XML node, so very large or concurrent 
responses can still exhaust the heap. A complete fix would buffer the response 
as bytes (spilling to disk) instead. Until then, the workaround is to disable 
schema validation of responses and make sure 
{{org.apache.cxf.output.buffering}} is not enabled.

> BareOutInterceptor seems to be taking lot of time 
> --------------------------------------------------
>
>                 Key: CXF-7641
>                 URL: https://issues.apache.org/jira/browse/CXF-7641
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.7.6
>            Reporter: ANURAG SHRIVASTAVA
>            Assignee: Colm O hEigeartaigh
>            Priority: Major
>             Fix For: 4.3.0
>
>         Attachments: CXF-7641-buffer-bytes-for-validation.patch
>
>
> Team,
>  
> we are using Apache CXF 2.7.6 and we are seeing when SOAP Payload is big then 
> BareOutInterceptor is taking almost 5 seconds.
>  
> Line 71870: *09:56:33.131* [http-bio-8110-exec-1] DEBUG 
> o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor 
> org.apache.cxf.interceptor.*BareOutInterceptor*@658b9781
> Line 71873: *09:56:38.532* [http-bio-8110-exec-1] DEBUG 
> o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor 
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor@9dde9a4
> Line 71874: 09:56:38.532 [http-bio-8110-exec-1] DEBUG 
> o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor 
> org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor@73543007
> Line 71875: 09:56:39.954 [http-bio-8110-exec-1] DEBUG 
> o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor 
> org.apache.cxf.interceptor.StaxOutEndingInterceptor@43b91daa
> Line 71876: 09:56:39.954 [http-bio-8110-exec-1] DEBUG 
> o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor 
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@3ac8c8db
>  
>  
>  
> Please suggest can which scenario it can take this much of time 
>  
> Anurag



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to