Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3BFDA200D16 for ; Tue, 10 Oct 2017 16:42:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3A6311609E5; Tue, 10 Oct 2017 14:42:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7F855160BE0 for ; Tue, 10 Oct 2017 16:42:06 +0200 (CEST) Received: (qmail 13313 invoked by uid 500); 10 Oct 2017 14:42:05 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 13302 invoked by uid 99); 10 Oct 2017 14:42:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Oct 2017 14:42:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B3C2C193708 for ; Tue, 10 Oct 2017 14:42:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id HS_K7TQixZco for ; Tue, 10 Oct 2017 14:42:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C08165FB4E for ; Tue, 10 Oct 2017 14:42:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E1329E0F07 for ; Tue, 10 Oct 2017 14:42:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 30AC724392 for ; Tue, 10 Oct 2017 14:42:00 +0000 (UTC) Date: Tue, 10 Oct 2017 14:42:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1355) TimeZone.getTimeZone() in FastDateParser causes resource contention MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 10 Oct 2017 14:42:07 -0000 [ https://issues.apache.org/jira/browse/LANG-1355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16198750#comment-16198750 ] ASF GitHub Bot commented on LANG-1355: -------------------------------------- Github user chonton commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/296#discussion_r143748954 --- Diff: src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java --- @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.lang3.time; + +import java.util.Date; +import java.util.TimeZone; + +/** + * Custom timezone that contains offset from GMT. + * + * @since 3.7 + */ +class GmtTimeZone extends TimeZone { --- End diff -- great catch! done > TimeZone.getTimeZone() in FastDateParser causes resource contention > ------------------------------------------------------------------- > > Key: LANG-1355 > URL: https://issues.apache.org/jira/browse/LANG-1355 > Project: Commons Lang > Issue Type: Bug > Components: lang.time.* > Affects Versions: 3.6 > Environment: Windows > Reporter: Keith Boone > Assignee: Charles Honton > Original Estimate: 48h > Remaining Estimate: 48h > > Under heavy load we are seeing contention in FastDateParser.parse() on calls to TimeZone.getTimeZone(). TimeZone.getTimeZone() is a synchronized static in the Oracle JVM. > Our proposed solution is to add a class TimeZoneCache containing a single method getTimeZone() which gets the requested time zone from a ConcurrentMap, and if not present, looks it up via TimeZone.getTimeZone() and caches it before returning it. > Then replace calls to TimeZone.getTimeZone() in FastDateParser ( and whereever else) to calls to TimeZoneCache.getTimeZone(). > The reason to add a separate class is because it can also be used by other applications which heavily parse or format or do other things where TimeZone is repeatedly needed. > Under extreme load we have seen an 50:1 improvement in calls to FastDateParser.parse(). This saves about a ms/call in our test environment, and reduces contention. -- This message was sent by Atlassian JIRA (v6.4.14#64029)