From owner-freebsd-current@FreeBSD.ORG Wed May 10 01:38:48 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9F48716A406; Wed, 10 May 2006 01:38:48 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5989243D6A; Wed, 10 May 2006 01:38:44 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.14] (imini.samsco.home [192.168.254.14]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k4A1cdOH096135; Tue, 9 May 2006 19:38:39 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <4461441E.60304@samsco.org> Date: Tue, 09 May 2006 19:38:38 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050416 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sven Petai References: <20060506150622.C17611@fledge.watson.org> <200605091818.12676.hadara@bsd.ee> <4460D2CA.5090808@elischer.org> <200605100418.54475.hadara@bsd.ee> In-Reply-To: <200605100418.54475.hadara@bsd.ee> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: Julian Elischer , freebsd-performance@freebsd.org, current@freebsd.org, David Xu , Kris Kennaway Subject: Re: Fine-grained locking for POSIX local sockets (UNIX domain sockets ) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 May 2006 01:38:48 -0000 Sven Petai wrote: > On Tuesday 09 May 2006 20:35, Julian Elischer wrote: > >>Sven Petai wrote: >> >>are there any patches that take the gettimeofday() calls and replace >>them with something that is cheap >>such as only doing every 10th one and just returning the last value ++ 1 >>uSec for the other ones.. >> >>a ktrace of Mysql shows a LOT of gettimeofday() calls. >> > > > well I have actually done that although in a very hackish way that > is suitable *only* for benchmarking, but my goal really was > just to find out if gettimeofday really is the bottleneck. > > Basically I just preloaded my version of "buffering" time() over libc's. > That function asked kernel for time only after every 5000 invocations. > I could get away with that for benchmarking since > about 99,99% of gettimeofday() calls from mysqld really come through > time() which has anyway only 1 second resolution and mysqld seems to use > the value for purposes that are not really all that critical, like > stats and safeguard timers. > It's also called far more than 5000 times in a second while benchmark is > running so it should return correct values too. > > Anyway, the results really astonished me, what I got for reducing > gettimeofday() calls by ~96% was performance *decrease* of about 4-5%. > I thought something was wrong with my measurement techniques, so I > wrote the buffering time() function that used TSC directly into mysqld, > replaced all the time() calls with that, so that number of gettimeofday() > syscalls ktrace reported was down to only the initial one, but still got the > same 5% decrease. > > I just can't explain it, but can't find any mistakes in methods too. > > The library I used is available @ > http://bsd.ee/~hadara/debug/mysql4/time_lib_hack.c Were you testing on SMP, and if so, was Hyperthreading enabled? Scott