From owner-freebsd-performance@FreeBSD.ORG Wed Apr 16 05:07:08 2008 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 C02541065675 for ; Wed, 16 Apr 2008 05:07:08 +0000 (UTC) (envelope-from swmspam@swmoore.net) Received: from smtpauth01.prod.mesa1.secureserver.net (smtpauth01.prod.mesa1.secureserver.net [64.202.165.181]) by mx1.freebsd.org (Postfix) with SMTP id 9B3C38FC2C for ; Wed, 16 Apr 2008 05:07:08 +0000 (UTC) (envelope-from swmspam@swmoore.net) Received: (qmail 29650 invoked from network); 16 Apr 2008 04:40:26 -0000 Received: from unknown (208.46.203.195) by smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) with ESMTP; 16 Apr 2008 04:40:24 -0000 From: "Stephen Moore" To: Date: Wed, 16 Apr 2008 00:40:20 -0400 Message-ID: <001101c89f7b$fc626600$c3cb2ed0@d400> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 11 Thread-index: Acife/mRoaT2wSeHTla/KLeOFlflCA== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Tweaking Disk Cache/Buffers and fsync 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: Wed, 16 Apr 2008 05:07:08 -0000 There's a lot of discussion on the sysctl settings for vfs disk cache/buffers, but very little consolidated or comprehensive explanations. I have a NAS box with 1GB of memory, but rarely see over ~40MB of utilization during file transfers. When writing a large file to the NAS, I see the transfer rate throttle and pause in regular intervals. This indicates to me the dirty buffers are flushing and writing to the disk, and the file transfer is interrupted during the disk write process. Therefore, I would like to (1) increase the memory utilization, so that a large file write (500MB) will buffer entirely to memory for fastest transfer speeds, and (2) then take as long as needed to write the dirty buffers to the disk, after the transfer is concluded. For part (1), I looked at the following sysctl settings, but I don't fully understand the interactions: vfs.maxbufspace vfs.lobufspace vfs.hibufspace vfs.hidirtybuffers vfs.hirunningspace also /boot/loader.conf kern.nbuf I understand some rules: hirunningspace should be between 1MB to 4MB. lobufspace should be 25% to 75% of hibufspace. What I don't understand is the relationship between maxbufspace and hibufspace, and what are good values. I also don't understand hidirtybuffers. For part (2), I need to slow down the occurrence of sync() or fsync(). Ideally, a sync would not occur for 300 seconds, which is about 10 times as long as (apparently) the default setting. (obviously, if the buffer space is full, a sync would need to occur to make more room.) I've seen references of a daemon to periodically run a sync, or is it controlled by init? Yes, this increases vulnerability when the data is in buffer before committed to disk, but in my application, this is reasonable.