From owner-freebsd-performance@FreeBSD.ORG Tue Sep 26 18:05:40 2006 Return-Path: X-Original-To: freebsd-performance@freebsd.org Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4067916A412 for ; Tue, 26 Sep 2006 18:05:40 +0000 (UTC) (envelope-from mark@gaiahost.coop) Received: from biodiesel.gaiahost.coop (biodiesel.gaiahost.coop [64.95.78.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91DAA43D60 for ; Tue, 26 Sep 2006 18:05:36 +0000 (GMT) (envelope-from mark@gaiahost.coop) Received: from gaiahost.coop (host-64-65-195-19.spr.choiceone.net [::ffff:64.65.195.19]) (AUTH: LOGIN mark@hubcapconsulting.com) by biodiesel.gaiahost.coop with esmtp; Tue, 26 Sep 2006 14:05:34 -0400 id 007BC0F7.45196BEE.0000777D Received: by gaiahost.coop (sSMTP sendmail emulation); Tue, 26 Sep 2006 14:05:38 -0400 Date: Tue, 26 Sep 2006 14:05:38 -0400 From: Mark Bucciarelli To: Bill Moran Message-ID: <20060926180538.GH3064@rabbit> Mail-Followup-To: Bill Moran , freebsd-performance@freebsd.org References: <20060926154643.GA3064@rabbit> <20060926130300.3dc4b06a.wmoran@collaborativefusion.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <20060926130300.3dc4b06a.wmoran@collaborativefusion.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-performance@freebsd.org Subject: Re: Why are disk writes so slow? X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2006 18:05:40 -0000 On Tue, Sep 26, 2006 at 01:03:00PM -0400, Bill Moran wrote: > In response to Mark Bucciarelli : > > > Can someone explain to me why writing is five times as slow as > > writing? What's going on in the computer? > > I'm rather confused as to exactly what your question is ... > Heh, I'm just trying to understand how my computer works. I was surprised that writes were _so much_ slower than reads. I figured somebody here knew. > First off, writes are slower than reads if the data you're > reading is already cached in RAM. Unless you have _very_ > little RAM in your machine, then anything that takes .023s to > write is going to be able to fit entirely in the buffer cache, > thus repeated access doesn't require any real disk activity. I could try running the test immediately after rebooting. Although I have no idea if he did. I bet he didn't. And we both used the same size file: 1.5M. I wonder how much RAM he had. > Secondly, as to why Stevens saw less of a slowdown with O_SYNC > than you did -- I doubt there's one easy answer. Discs are > manufactured differently now than they were in 93, and there's > even a huge difference between different brands and different > types (i.e. SCSI/SATA) in addition to the differences in > hardware connecting the disks, and the drivers for that > hardware. There are dozens of places where the difference > could be occurring. I would guess that the drive itself does > write caching, and this heavily optimizes async writes, but > can't improve the performance of sync writes any. I see. Yeah, if you look at normal write compared to read speed that did improve between the two data points. So that supports your conjecture. So you think this data has no value? 1993 2006 ----- ---- (1) /dev/null write 0.3s .005s <-- read speed (2) normal write 2.3s .023s (3) O_SYNC 13.4s .364s (2) / (1) 7.6 4.6 1.5x faster (3) / (2) 5.8 15.8 2.75x slower relative to ASYNC (3) / (1) 44.6 72.8 1.5x slower relative to read It does makes me wonder how this test runs on Linux, since I think databases use O_SYNC. I guess I'd have to install Linux on my laptop and run the same test to have any useful information. And reboot between each test. And shut down network interface and all daemons. In any case, thanks for your reply. m