Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 68E0B9BF4 for ; Wed, 14 Dec 2011 11:04:07 +0000 (UTC) Received: (qmail 67122 invoked by uid 500); 14 Dec 2011 11:04:03 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 66977 invoked by uid 500); 14 Dec 2011 11:04:03 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 66535 invoked by uid 99); 14 Dec 2011 11:04:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Dec 2011 11:04:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Dec 2011 11:04:02 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id F13654EFFC; Wed, 14 Dec 2011 11:03:40 +0000 (UTC) From: bugzilla@apache.org To: dev@tomcat.apache.org Subject: DO NOT REPLY [Bug 52328] New: Massive garbage production observed when using the response writer Date: Wed, 14 Dec 2011 11:03:38 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Tomcat 7 X-Bugzilla-Component: Catalina X-Bugzilla-Keywords: X-Bugzilla-Severity: regression X-Bugzilla-Who: diakula@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@tomcat.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 https://issues.apache.org/bugzilla/show_bug.cgi?id=52328 Bug #: 52328 Summary: Massive garbage production observed when using the response writer Product: Tomcat 7 Version: 7.0.23 Platform: PC Status: NEW Severity: regression Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: diakula@gmail.com Classification: Unclassified In our application we used to use Tomcat 5, by writing our content directly to the response writer in our servlet: Writer w = response.getWriter(); w.append(...) We have regularly measured performance of our application under stress with multiple simultaneous requests per second. We recently upgraded to Tomcat 7, and immediately observed a performance degradation of 10% on the request roundtrip on the same machine and the same tests, compared to our application deployed on Tomcat 5. Profiling with JProfiler showed that we got massive amount of transient objects {{java.nio.HeapCharBuffer}} produced - 400Mb+ within a few minutes. The way we are writing the response is by multiple statements of {{append}} of small strings or single chars, which used to work properly. For experiment, we wrapped the response writer with a {{BufferedWriter}} with a buffer of 64k. This brought our application's performance back to normal. We see this as either a: - anti-pattern usage since Tomcat 6/7, in which case please provide some documentation about that. - bug in the C2BConverter that is applied per every call to the CoyoteWriter write methods, which generates the garbage buffers per every call. We know that the response stream has a 8k buffer by default. Nevertheless, this buffer comes after the encoding step and as such it is too late to help with the garbage. Perhaps Tomcat can buffer before it encodes? Still, so much transient objects for just a pattern of eligible use of the servlet API seems a bug to me. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org