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 02C25200C8C for ; Tue, 6 Jun 2017 22:34:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 01862160BC6; Tue, 6 Jun 2017 20:34:03 +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 475E2160BB7 for ; Tue, 6 Jun 2017 22:34:02 +0200 (CEST) Received: (qmail 17278 invoked by uid 500); 6 Jun 2017 20:34:01 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 17265 invoked by uid 99); 6 Jun 2017 20:34:01 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jun 2017 20:34:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C87931AFDD9 for ; Tue, 6 Jun 2017 20:34:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.363 X-Spam-Level: X-Spam-Status: No, score=0.363 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8aEfGT94Fox7 for ; Tue, 6 Jun 2017 20:33:59 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id C6CC65F254 for ; Tue, 6 Jun 2017 20:33:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id v56KXpmA029208; Tue, 6 Jun 2017 20:33:51 GMT Message-Id: <201706062033.v56KXpmA029208@ip-10-146-233-104.ec2.internal> Date: Tue, 6 Jun 2017 20:33:51 +0000 From: "Impala Public Jenkins (Code Review)" To: Matthew Jacobs , impala-cr@cloudera.com, reviews@impala.incubator.apache.org X-Gerrit-MessageType: merged Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-5357=3A_Fix_unixtime_to_UTC_TimestampValue_perf=0A?= X-Gerrit-Change-Id: I9d611d21310c7b4f93d8e0bc845eb85125abcac9 X-Gerrit-ChangeURL: X-Gerrit-Commit: dad4896693c99f6a59be5c25bed2297a1ed57c5f In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.7 archived-at: Tue, 06 Jun 2017 20:34:03 -0000 Impala Public Jenkins has submitted this change and it was merged. Change subject: IMPALA-5357: Fix unixtime to UTC TimestampValue perf ...................................................................... IMPALA-5357: Fix unixtime to UTC TimestampValue perf Fixes the severe perf issue when calling gmtime_r to convert a unix time because that libc function takes a global lock. Instead, use boost ptime::from_time_t when possible. Unfortunately only a range of input times are supported without overflowing the underlying time_duration struct (dates between 1677-2262), so those dates outside that range are handled with the slow path calling into gmtime_r. This requires using a patched build of boost which includes an upstream fix for the time_duration class, see: https://github.com/cloudera/native-toolchain/commit/6e726b4b8164d53814f75b78a681fcf6df4a887a Testing: * Ran an exhaustive test run successfully. * Wrote a test program to validate that all time_t values between 1677 and 2262 are converted to the same ptime when using the new code path and the old path. Doing so required running all night, so I'm not going to attempt to add this test. I think a single validation is acceptable. Perf impact: Microbenchmark of the new path (conversion using boost) and the old path (conversion using libc gmtime_r) resulted in the expected speedup from not using a global lock. Machine Info: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz Function 10%ile 50%ile 90%ile 10%ile 50%ile 90%ile iters/ms iters/ms iters/ms (relative) (relative) (relative) --------------------------------------------------------------------- libc-1 0.192 0.196 0.2 1X 1X 1X boost-1 0.333 0.34 0.34 1.73X 1.73X 1.7X libc-2 0.112 0.115 0.116 0.584X 0.586X 0.581X boost-2 0.627 0.654 0.667 3.26X 3.33X 3.33X libc-4 0.042 0.0478 0.0515 0.218X 0.244X 0.258X boost-4 0.863 1.27 1.3 4.49X 6.5X 6.5X libc-8 0.0326 0.0328 0.0329 0.169X 0.167X 0.164X boost-8 0.741 0.902 1.1 3.85X 4.6X 5.5X Change-Id: I9d611d21310c7b4f93d8e0bc845eb85125abcac9 Reviewed-on: http://gerrit.cloudera.org:8080/7082 Reviewed-by: Matthew Jacobs Tested-by: Impala Public Jenkins --- M be/src/runtime/timestamp-test.cc M be/src/runtime/timestamp-value.cc 2 files changed, 66 insertions(+), 13 deletions(-) Approvals: Impala Public Jenkins: Verified Matthew Jacobs: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/7082 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9d611d21310c7b4f93d8e0bc845eb85125abcac9 Gerrit-PatchSet: 4 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Matthew Jacobs Gerrit-Reviewer: Attila Jeges Gerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Lars Volker Gerrit-Reviewer: Marcel Kornacker Gerrit-Reviewer: Matthew Jacobs Gerrit-Reviewer: Thomas Tauber-Marshall