⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configtuning-disk.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Tuning Disks</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Configuration and Tuning" href="config-tuning.html" /><link rel="PREVIOUS" title="Tuning with sysctl" href="configtuning-sysctl.html" /><link rel="NEXT" title="Tuning Kernel Limits" href="configtuning-kernel-limits.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="configtuning-sysctl.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 11 Configuration and Tuning</td><td width="10%" align="right" valign="bottom"><a href="configtuning-kernel-limits.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="CONFIGTUNING-DISK" name="CONFIGTUNING-DISK">11.12 TuningDisks</a></h1><div class="SECT2"><h2 class="SECT2"><a id="AEN16567" name="AEN16567">11.12.1 Sysctl Variables</a></h2><div class="SECT3"><h3 class="SECT3"><a id="AEN16569" name="AEN16569">11.12.1.1 <varclass="VARNAME">vfs.vmiodirenable</var></a></h3><p>The <var class="VARNAME">vfs.vmiodirenable</var> sysctl variable may be set to either0 (off) or 1 (on); it is 1 by default. This variable controls how directories are cachedby the system. Most directories are small, using just a single fragment (typically1&nbsp;K) in the file system and less (typically 512&nbsp;bytes) in the buffer cache.With this variable turned off (to 0), the buffer cache will only cache a fixed number ofdirectories even if you have a huge amount of memory. When turned on (to 1), this sysctlallows the buffer cache to use the VM Page Cache to cache the directories, making all thememory available for caching directories. However, the minimum in-core memory used tocache a directory is the physical page size (typically 4&nbsp;K) rather than 512&nbsp;bytes. We recommend keeping this option on if you are running any services whichmanipulate large numbers of files. Such services can include web caches, large mailsystems, and news systems. Keeping this option on will generally not reduce performanceeven with the wasted memory but you should experiment to find out.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16577" name="AEN16577">11.12.1.2 <varclass="VARNAME">vfs.write_behind</var></a></h3><p>The <var class="VARNAME">vfs.write_behind</var> sysctl variable defaults to <varclass="LITERAL">1</var> (on). This tells the file system to issue media writes as fullclusters are collected, which typically occurs when writing large sequential files. Theidea is to avoid saturating the buffer cache with dirty buffers when it would not benefitI/O performance. However, this may stall processes and under certain circumstances youmay wish to turn it off.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16586" name="AEN16586">11.12.1.3 <varclass="VARNAME">vfs.hirunningspace</var></a></h3><p>The <var class="VARNAME">vfs.hirunningspace</var> sysctl variable determines how muchoutstanding write I/O may be queued to disk controllers system-wide at any giveninstance. The default is usually sufficient but on machines with lots of disks you maywant to bump it up to four or five <span class="emphasis"><iclass="EMPHASIS">megabytes</i></span>. Note that setting too high a value (exceeding thebuffer cache's write threshold) can lead to extremely bad clustering performance. Do notset this value arbitrarily high! Higher write values may add latency to reads occurringat the same time.</p><p>There are various other buffer-cache and VM page cache related sysctls. We do notrecommend modifying these values. As of FreeBSD&nbsp;4.3, the VM system does an extremelygood job of automatically tuning itself.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16596" name="AEN16596">11.12.1.4 <varclass="VARNAME">vm.swap_idle_enabled</var></a></h3><p>The <var class="VARNAME">vm.swap_idle_enabled</var> sysctl variable is useful in largemulti-user systems where you have lots of users entering and leaving the system and lotsof idle processes. Such systems tend to generate a great deal of continuous pressure onfree memory reserves. Turning this feature on and tweaking the swapout hysteresis (inidle seconds) via <var class="VARNAME">vm.swap_idle_threshold1</var> and <varclass="VARNAME">vm.swap_idle_threshold2</var> allows you to depress the priority ofmemory pages associated with idle processes more quickly then the normal pageoutalgorithm. This gives a helping hand to the pageout daemon. Do not turn this option onunless you need it, because the tradeoff you are making is essentially pre-page memorysooner rather than later; thus eating more swap and disk bandwidth. In a small systemthis option will have a determinable effect but in a large system that is already doingmoderate paging this option allows the VM system to stage whole processes into and out ofmemory easily.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16606" name="AEN16606">11.12.1.5 <varclass="VARNAME">hw.ata.wc</var></a></h3><p>FreeBSD&nbsp;4.3 flirted with turning off IDE write caching. This reduced writebandwidth to IDE disks but was considered necessary due to serious data consistencyissues introduced by hard drive vendors. The problem is that IDE drives lie about when awrite completes. With IDE write caching turned on, IDE hard drives not only write data todisk out of order, but will sometimes delay writing some blocks indefinitely when underheavy disk loads. A crash or power failure may cause serious file system corruption.FreeBSD's default was changed to be safe. Unfortunately, the result was such a hugeperformance loss that we changed write caching back to on by default after the release.You should check the default on your system by observing the <varclass="VARNAME">hw.ata.wc</var> sysctl variable. If IDE write caching is turned off, youcan turn it back on by setting the kernel variable back to 1. This must be done from theboot loader at boot time. Attempting to do it after the kernel boots will have noeffect.</p><p>For more information, please see <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ata&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ata</span>(4)</span></a>.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16618" name="AEN16618">11.12.1.6 <varclass="LITERAL">SCSI_DELAY</var> (<varclass="VARNAME">kern.cam.scsi_delay</var>)</a></h3><p>The <var class="LITERAL">SCSI_DELAY</var> kernel config may be used to reduce systemboot times. The defaults are fairly high and can be responsible for <varclass="LITERAL">15</var> seconds of delay in the boot process. Reducing it to <varclass="LITERAL">5</var> seconds usually works (especially with modern drives). Newerversions of FreeBSD (5.0 and higher) should use the <varclass="VARNAME">kern.cam.scsi_delay</var> boot time tunable. The tunable, and kernelconfig option accept values in terms of <span class="emphasis"><iclass="EMPHASIS">milliseconds</i></span> and <span class="emphasis"><iclass="EMPHASIS">not</i></span> <span class="emphasis"><iclass="EMPHASIS">seconds</i></span>.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="SOFT-UPDATES" name="SOFT-UPDATES">11.12.2 Soft Updates</a></h2><p>The <a href="http://www.FreeBSD.org/cgi/man.cgi?query=tunefs&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">tunefs</span>(8)</span></a> program canbe used to fine-tune a file system. This program has many different options, but for nowwe are only concerned with toggling Soft Updates on and off, which is done by:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">tunefs -n enable /filesystem</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">tunefs -n disable /filesystem</kbd></pre><p>A filesystem cannot be modified with <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=tunefs&sektion=8"><span

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -