Return-Path: X-Original-To: apmail-cxf-users-archive@www.apache.org Delivered-To: apmail-cxf-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC186F9B3 for ; Fri, 22 Mar 2013 16:44:12 +0000 (UTC) Received: (qmail 35167 invoked by uid 500); 22 Mar 2013 16:43:33 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 35100 invoked by uid 500); 22 Mar 2013 16:43:33 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 35065 invoked by uid 99); 22 Mar 2013 16:43:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 16:43:33 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sberyozkin@gmail.com designates 209.85.215.180 as permitted sender) Received: from [209.85.215.180] (HELO mail-ea0-f180.google.com) (209.85.215.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 16:43:28 +0000 Received: by mail-ea0-f180.google.com with SMTP id m14so306642eaj.25 for ; Fri, 22 Mar 2013 09:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=KtNM/3IAPpwqAT0ZXKvln29XDxXWtJXIoJeQsJfD8zI=; b=qRUpxZFpsjS4kvRNkv4TbKFfybffd9i+kDj5fgoPBCbvOHQmUD9ntM3s9f1T5FHE1V JkyqEcuIVXmm5ArrP83Q/mk2gfK3Od2nqqPD+7kFX09O1YD9c5VZL1QsGUqDG7njI318 i4GfO4NxxJ2pJ6Yt3OCCfwGAaRGbC5p/QUrIQvcy0HLcpYmwZUi0+KyHTHWFDddXBJ15 4AUwlhHdV7ZxFgqLUjztk9mKL5d5reUqA27D2lxnpqsAG8dsYzOzlshif12lBMdkieUo cEDggHd0oKsc+L8CzOvY4ZX18Q6E5rjxqyAajGG0gAawSG1RZMWGHC/NhoRRt+CVYwRf VMPQ== X-Received: by 10.15.43.132 with SMTP id x4mr6782200eev.31.1363970587393; Fri, 22 Mar 2013 09:43:07 -0700 (PDT) Received: from [192.168.2.5] ([89.100.141.151]) by mx.google.com with ESMTPS id q42sm3983794eem.14.2013.03.22.09.43.05 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Mar 2013 09:43:06 -0700 (PDT) Message-ID: <514C8A0B.7080707@gmail.com> Date: Fri, 22 Mar 2013 16:42:51 +0000 From: Sergey Beryozkin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: users@cxf.apache.org Subject: Re: Performance Issue with JAXRS and Many HTTP Headers References: <53CF299802A281409CB89D5E3DDC4AF70A6525587A@DUBEXCH01.openet-dublin> <514B6E08.2010802@gmail.com> In-Reply-To: <514B6E08.2010802@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi On 21/03/13 20:31, Sergey Beryozkin wrote: > Hi > On 21/03/13 14:23, Gary Madden wrote: >> Hello, >> >> I've noticed a problem with CXF when using a large amount of HTTP >> headers. If I keep the total head size at just under 6k and start >> increasing the number of headers, performance starts to decrease >> dramatically when the header count goes above 10. >> >> The problem area is in different parts of the code that create a new >> instance of org.apache.cxf.jaxrs.impl.HttpHeadersImpl to retrieve just >> one header value. An example of this is the getProtocolHeader method >> in org.apache.cxf.jaxrs.utils.HttpUtils. >> >> HttpHeadersImpl's constructor creates a new MetadataMap for the >> headers. This copies all the headers into a new map. > > The representation of the headers on the CXF Message can not be used as > a response from HttpHeaders, > >> Then in getRequestHeaders of HttpHeadersImpl, the header values are >> again copied into a new map and this new map is then returned. Was >> this done for a particular reason? The reason I can think of is to >> prevent the original HTTP headers from being overwritten elsewhere in >> the code. >> > Quite possibly, I'll have to review >> Has anyone else come across performance issues in relation to HTTP >> headers and JAXRS? >> > The original HttpHeardesImpl code is old enough - thanks for reporting > the issue - I'll deal with it. JAX-RS implementation in CXF 2.8.0 in > particular has 'seen' quote a few performance related updates already, a > number of related changes are due too, now including the HttpHeadersImpl > enhancements. > > I'll update you on this thread I've done some work to optimize it a bit, see [1] & [2]. Effectively, in most cases, the original message headers will be copied only once but without coying the individual list values of the individual headers. This 'partial' copy can be avoided in principle too, but we have to check if header values are not null. Can you please retry in the few days ? FYI, the update was not merged to 2.5.x only, let me know if you need it there. Also, if you can see the opportunity to optimize it even further - let me know please too Cheers, Sergey [1] https://issues.apache.org/jira/browse/CXF-4915 [2] http://svn.apache.org/r1459855 > > Cheers, Sergey > >> Thanks, >> >> Gary >> >> ........................................................................... >> >> Gary Madden >> Senior Software Engineer >> ........................................................................... >> >> Email: gary.madden@openet.com >> Skype: gmadden.openet >> Openet, 6 Beckett Way, Park West Business Park, Dublin 12, Ireland >> >> >> ________________________________ >> This email and any files transmitted with it are confidential and >> intended solely for the use of the individual or entity to whom they >> are addressed. If you are not the intended recipient, please note that >> any review, dissemination, disclosure, alteration, printing, >> circulation, retention or transmission of this e-mail and/or any file >> or attachment transmitted with it, is prohibited and may be unlawful. >> If you have received this e-mail or any file or attachment transmitted >> with it in error please notify postmaster@openet.com. Although Openet >> has taken reasonable precautions to ensure no viruses are present in >> this email, we cannot accept responsibility for any loss or damage >> arising from the use of this email or attachments. >> > >