From dev-return-4407-apmail-tika-dev-archive=tika.apache.org@tika.apache.org Mon Nov 08 00:42:00 2010 Return-Path: Delivered-To: apmail-tika-dev-archive@www.apache.org Received: (qmail 81437 invoked from network); 8 Nov 2010 00:42:00 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Nov 2010 00:42:00 -0000 Received: (qmail 50524 invoked by uid 500); 8 Nov 2010 00:42:31 -0000 Delivered-To: apmail-tika-dev-archive@tika.apache.org Received: (qmail 50501 invoked by uid 500); 8 Nov 2010 00:42:31 -0000 Mailing-List: contact dev-help@tika.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tika.apache.org Delivered-To: mailing list dev@tika.apache.org Received: (qmail 50493 invoked by uid 99); 8 Nov 2010 00:42:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 00:42:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 00:42:30 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oA80gA5c012772 for ; Mon, 8 Nov 2010 00:42:10 GMT Message-ID: <13763281.66641289176930602.JavaMail.jira@thor> Date: Sun, 7 Nov 2010 19:42:10 -0500 (EST) From: "Chris A. Mattmann (JIRA)" To: dev@tika.apache.org Subject: [jira] Updated: (TIKA-471) Avoid Charset name bottleneck when multiple threads are using HtmlParser In-Reply-To: <16314323.563481279935410872.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/TIKA-471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chris A. Mattmann updated TIKA-471: ----------------------------------- Component/s: parser - classify > Avoid Charset name bottleneck when multiple threads are using HtmlParser > ------------------------------------------------------------------------ > > Key: TIKA-471 > URL: https://issues.apache.org/jira/browse/TIKA-471 > Project: Tika > Issue Type: Improvement > Components: parser > Reporter: Ken Krugler > Assignee: Ken Krugler > Priority: Minor > > As reported by a user on the Nutch list, if there are lots of threads all parsing HTML documents, there's a lock contention issue caused by a JVM-wide lock used when resolving charset names: > {quote} > Apparently this is a known issue with Java, and a couple articles are > written about it: > http://paul.vox.com/library/post/the-mysteries-of-java-character-set-perform > ance.html > http://halfbottle.blogspot.com/2009/07/charset-continued-i-wrote-about.html > There is also a note in java bug database about scaling issues with the > class... > Please also note that the current implementation of > sun.nio.cs.FastCharsetProvider.charsetForName() uses a JVM-wide lock and is > called very often (e.g. by new String(byte[] data,String encoding)). This > JVM-wide lock means that Java applications do not scale beyond 4 CPU cores. > I noted in the case of my stack at this particular point in time. The > BLOCKED calls to charsetForName were generated by: > at org.apache.tika.parser.html.HtmlParser.getEncoding(HtmlParser.java:84) 378 > at org.apache.tika.parser.html.HtmlParser.getEncoding(HtmlParser.java:99) 61 > at org.apache.tika.parser.html.HtmlParser.getEncoding(HtmlParser.java:133) 19 > at org.apache.nutch.parse.html.HtmlParser.sniffCharacterEncoding(HtmlParser.java:86) 238 > ... > {quote} > We now have a CharsetUtils class in Tika, and we could add a cache for validated names in the isSupported() method. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.