From owner-freebsd-performance@FreeBSD.ORG Sat Dec 25 11:12:41 2010 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 107171065673 for ; Sat, 25 Dec 2010 11:12:41 +0000 (UTC) (envelope-from ingom-list@freenet.de) Received: from mout7.freenet.de (mout7.freenet.de [IPv6:2001:748:100:40::2:9]) by mx1.freebsd.org (Postfix) with ESMTP id A18F78FC15 for ; Sat, 25 Dec 2010 11:12:40 +0000 (UTC) Received: from [195.4.92.12] (helo=2.mx.freenet.de) by mout7.freenet.de with esmtpa (ID ingom-list@freenet.de) (port 25) (Exim 4.72 #3) id 1PWS3C-0003Tt-U6 for freebsd-performance@freebsd.org; Sat, 25 Dec 2010 12:12:38 +0100 Received: from p508036c2.dip.t-dialin.net ([80.128.54.194]:1968 helo=medion-8800) by 2.mx.freenet.de with esmtpa (ID ingom-list@freenet.de) (port 25) (Exim 4.72 #3) id 1PWS3C-0003qm-Ix for freebsd-performance@freebsd.org; Sat, 25 Dec 2010 12:12:38 +0100 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes In-Reply-To: <20060926154643.GA3064@rabbit> References: <20060926154643.GA3064@rabbit> To: freebsd-performance@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ingo Date: Sat, 25 Dec 2010 12:12:35 +0100 Message-ID: User-Agent: Opera Mail/11.00 (Win32) X-Mailman-Approved-At: Sat, 25 Dec 2010 12:29:40 +0000 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: Sat, 25 Dec 2010 11:12:41 -0000 On 09/26/06 10:46, Mark Bucciarelli wrote: > I am reading Richard Stevens' "Advanced Programming in the UNIX > Environment," a most excellent book. > Out of curiosity, I tried his I/O efficiency program on my IBM > A30 Thinkpad, running 6.0-RELEASE with default tuning parameters. > The test program reads file on stdin and writes to stdout, and > you modify bufsize to watch how time changes. > As in his example (with a bufsize of 8192), time ./a.out < > 1.5M-testfile > /dev/null > runs five times faster than (clock time) > time ./a.out < 1.5M-testfile > /a.out.out > Can someone explain to me why writing is five times as slow as > writing? What's going on in the computer? The file is not O_SYNC, so it > can't be validating the data on the > disk. > Later in the same chapter, he shows the impact of O_SYNC flag. I > re-ran this experiment too, and while everything is two orders of > magnitude faster than his times in the book, the relative speed > of writing with O_SYNC is three times slower. > 1993 2006 > ----- ---- > normal write 2.3s .023s > O_SYNC 13.4s .364s > slowdow factor 5.8 15.8 > Is this all b/c disks are so much larger? It's probably because of caching on the disk. The normal write goes in/out of the on-disk cache, the O_SYNC may be forced to go to the platters. Also, if you didn't already, you should run the test many times, umounting/mounting the filesystem in question in between each test. Also, I recommend using a block device, instead of a file on a filesystem, since the filesystem could allocate blocks for the file differently each time, causing varying results. Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------ _______________________________________________ freebsd-performance@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-performance To unsubscribe, send any mail to "freebsd-performance-unsubscribe@freebsd.org" From owner-freebsd-performance@FreeBSD.ORG Sat Dec 25 11:12:43 2010 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BB2B1065674 for ; Sat, 25 Dec 2010 11:12:43 +0000 (UTC) (envelope-from ingom-list@freenet.de) Received: from mout4.freenet.de (mout4.freenet.de [IPv6:2001:748:100:40::2:6]) by mx1.freebsd.org (Postfix) with ESMTP id 01D758FC18 for ; Sat, 25 Dec 2010 11:12:43 +0000 (UTC) Received: from [195.4.92.12] (helo=2.mx.freenet.de) by mout4.freenet.de with esmtpa (ID ingom-list@freenet.de) (port 25) (Exim 4.72 #3) id 1PWS3F-0005FR-Rh for freebsd-performance@freebsd.org; Sat, 25 Dec 2010 12:12:41 +0100 Received: from p508036c2.dip.t-dialin.net ([80.128.54.194]:1968 helo=medion-8800) by 2.mx.freenet.de with esmtpa (ID ingom-list@freenet.de) (port 25) (Exim 4.72 #3) id 1PWS3F-0003qm-F1 for freebsd-performance@freebsd.org; Sat, 25 Dec 2010 12:12:41 +0100 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes In-Reply-To: <20060926154643.GA3064@rabbit> References: <20060926154643.GA3064@rabbit> To: freebsd-performance@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ingo Date: Sat, 25 Dec 2010 12:12:38 +0100 Message-ID: User-Agent: Opera Mail/11.00 (Win32) X-Mailman-Approved-At: Sat, 25 Dec 2010 12:29:52 +0000 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: Sat, 25 Dec 2010 11:12:43 -0000 On 09/26/06 10:46, Mark Bucciarelli wrote: > I am reading Richard Stevens' "Advanced Programming in the UNIX > Environment," a most excellent book. > Out of curiosity, I tried his I/O efficiency program on my IBM > A30 Thinkpad, running 6.0-RELEASE with default tuning parameters. > The test program reads file on stdin and writes to stdout, and > you modify bufsize to watch how time changes. > As in his example (with a bufsize of 8192), time ./a.out < > 1.5M-testfile > /dev/null > runs five times faster than (clock time) > time ./a.out < 1.5M-testfile > /a.out.out > Can someone explain to me why writing is five times as slow as > writing? What's going on in the computer? The file is not O_SYNC, so it > can't be validating the data on the > disk. > Later in the same chapter, he shows the impact of O_SYNC flag. I > re-ran this experiment too, and while everything is two orders of > magnitude faster than his times in the book, the relative speed > of writing with O_SYNC is three times slower. > 1993 2006 > ----- ---- > normal write 2.3s .023s > O_SYNC 13.4s .364s > slowdow factor 5.8 15.8 > Is this all b/c disks are so much larger? It's probably because of caching on the disk. The normal write goes in/out of the on-disk cache, the O_SYNC may be forced to go to the platters. Also, if you didn't already, you should run the test many times, umounting/mounting the filesystem in question in between each test. Also, I recommend using a block device, instead of a file on a filesystem, since the filesystem could allocate blocks for the file differently each time, causing varying results. Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------ _______________________________________________ freebsd-performance@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-performance To unsubscribe, send any mail to "freebsd-performance-unsubscribe@freebsd.org"