Translation

The <varname>vfs.vmiodirenable</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable may be set to either <literal>0</literal> (off) or <literal>1</literal> (on). It is set to <literal>1</literal> by default. This variable controls how directories are cached by the system. Most directories are small, using just a single fragment (typically 1  K) in the file system and typically 512  bytes in the buffer cache. With this variable turned off, the buffer cache will only cache a fixed number of directories, even if the system has a huge amount of memory. When turned on, this <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> allows the buffer cache to use the <acronym>VM</acronym> page cache to cache the directories, making all the memory available for caching directories. However, the minimum in-core memory used to cache a directory is the physical page size (typically 4  K) rather than 512  bytes. Keeping this option enabled is recommended if the system is running any services which manipulate large numbers of files. Such services can include web caches, large mail systems, and news systems. Keeping this option on will generally not reduce performance, even with the wasted memory, but one should experiment to find out.
(itstool) path: sect3/para
The <varname>vfs.vmiodirenable</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable may be set to either <literal>0</literal> (off) or <literal>1</literal> (on). It is set to <literal>1</literal> by default. This variable controls how directories are cached by the system. Most directories are small, using just a single fragment (typically 1 K) in the file system and typically 512 bytes in the buffer cache. With this variable turned off, the buffer cache will only cache a fixed number of directories, even if the system has a huge amount of memory. When turned on, this <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> allows the buffer cache to use the <acronym>VM</acronym> page cache to cache the directories, making all the memory available for caching directories. However, the minimum in-core memory used to cache a directory is the physical page size (typically 4 K) rather than 512 bytes. Keeping this option enabled is recommended if the system is running any services which manipulate large numbers of files. Such services can include web caches, large mail systems, and news systems. Keeping this option on will generally not reduce performance, even with the wasted memory, but one should experiment to find out.
401/13270
Context English Chinese (Simplified) (zh_CN) State
<filename>sysctl.conf</filename>
<filename>sysctl.conf</filename>
<primary>sysctl.conf</primary>
<primary>sysctl.conf</primary>
The configuration file for <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, <filename>/etc/sysctl.conf</filename>, looks much like <filename>/etc/rc.conf</filename>. Values are set in a <literal>variable=value</literal> form. The specified values are set after the system goes into multi-user mode. Not all variables are settable in this mode.
<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>的配置文件于<filename>/etc/sysctl.conf</filename>,内容很像<filename>/etc/rc.conf</filename>,设定数值使用<literal>variable=value</literal>格式。指定的数值会在系统进入多使用者模式时设定,但并非所有变数皆可在此模式设定。
For example, to turn off logging of fatal signal exits and prevent users from seeing processes started by other users, the following tunables can be set in <filename>/etc/sysctl.conf</filename>:
例如,要关闭严重信号(Fatal signal)中止的记录并避免使用者看到其他使用者所执行的程序,可加入以下设定到<filename>/etc/sysctl.conf</filename>:
# Do not log fatal signal exits (e.g., sig 11)
kern.logsigexit=0

# Prevent users from seeing information about processes that
# are being run under another UID.
security.bsd.see_other_uids=0
# Do not log fatal signal exits (e.g., sig 11)
kern.logsigexit=0

# Prevent users from seeing information about processes that
# are being run under another UID.
security.bsd.see_other_uids=0
<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> Read-only
只读<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
In some cases it may be desirable to modify read-only <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> values, which will require a reboot of the system.
在有些情况可能会需要修改只读的<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>数值,而这会需要重新启动系统。
For instance, on some laptop models the <citerefentry><refentrytitle>cardbus</refentrytitle><manvolnum>4</manvolnum></citerefentry> device will not probe memory ranges and will fail with errors similar to:
例如,某些笔电型号的<citerefentry><refentrytitle>cardbus</refentrytitle><manvolnum>4</manvolnum></citerefentry>装置无法侦测到內存范围而且会失效并有类似以下的错误:
cbb0: Could not map register memory
device_probe_and_attach: cbb0 attach returned 12
cbb0: Could not map register memory
device_probe_and_attach: cbb0 attach returned 12
The fix requires the modification of a read-only <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> setting. Add <option>hw.pci.allow_unsupported_io_range=1</option> to <filename>/boot/loader.conf</filename> and reboot. Now <citerefentry><refentrytitle>cardbus</refentrytitle><manvolnum>4</manvolnum></citerefentry> should work properly.
这个修正需要修改只读的<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>设定。加入<option>hw.pci.allow_unsupported_io_range=1</option>到<filename>/boot/loader.conf</filename>然后重新启动。现在<citerefentry><refentrytitle>cardbus</refentrytitle><manvolnum>4</manvolnum></citerefentry>应可正常运作。
Tuning Disks
调校磁盘
The following section will discuss various tuning mechanisms and options which may be applied to disk devices. In many cases, disks with mechanical parts, such as <acronym>SCSI</acronym> drives, will be the bottleneck driving down the overall system performance. While a solution is to install a drive without mechanical parts, such as a solid state drive, mechanical drives are not going away anytime in the near future. When tuning disks, it is advisable to utilize the features of the <citerefentry><refentrytitle>iostat</refentrytitle><manvolnum>8</manvolnum></citerefentry> command to test various changes to the system. This command will allow the user to obtain valuable information on system <acronym>IO</acronym>.
接下来的章节会讨论在磁盘装置上各种可调校的机制与选项。在大多数案例中,有使用机械元件的硬盘,如<acronym>SCSI</acronym>磁碟机,会成为导致整体系统性能低下的瓶颈。虽然已经有不使用机械元件的磁碟机解决方案,如,固态硬盘,但使用机械元件的磁碟机短期内并不会消失。在调校磁盘时,建议可以利用<citerefentry><refentrytitle>iostat</refentrytitle><manvolnum>8</manvolnum></citerefentry>指令的功能来测试各种对系统的变更,这个指令可让使用者取得系统<acronym>IO</acronym>相关的有用信息。
Sysctl Variables
Sysctl 参数
<varname>vfs.vmiodirenable</varname>
<varname>vfs.vmiodirenable</varname>
<primary><varname>vfs.vmiodirenable</varname></primary>
<primary><varname>vfs.vmiodirenable</varname></primary>
The <varname>vfs.vmiodirenable</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable may be set to either <literal>0</literal> (off) or <literal>1</literal> (on). It is set to <literal>1</literal> by default. This variable controls how directories are cached by the system. Most directories are small, using just a single fragment (typically 1 K) in the file system and typically 512 bytes in the buffer cache. With this variable turned off, the buffer cache will only cache a fixed number of directories, even if the system has a huge amount of memory. When turned on, this <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> allows the buffer cache to use the <acronym>VM</acronym> page cache to cache the directories, making all the memory available for caching directories. However, the minimum in-core memory used to cache a directory is the physical page size (typically 4 K) rather than 512 bytes. Keeping this option enabled is recommended if the system is running any services which manipulate large numbers of files. Such services can include web caches, large mail systems, and news systems. Keeping this option on will generally not reduce performance, even with the wasted memory, but one should experiment to find out.
<varname>vfs.vmiodirenable</varname> sysctl 变量可以设置成0(关)或者1(开);默认是1。 这个变量控制目录是否被系统缓存。大多数目录是小的, 在系统中只使用单个片断(典型的是1K)并且在缓存中使用的更小 (典型的是512字节)。当这个变量设置为关闭 (<literal>0</literal>) 时, 缓存器仅仅缓存固定数量的目录,即使您有很大的内存。 而将其开启 (设置为1) 时, 则允许缓存器用 VM 页面缓存来缓存这些目录,让所有可用内存来缓存目录。 不利的是最小的用来缓存目录的核心内存是大于 512 字节的物理页面大小(通常是 4k)。 我们建议如果您在运行任何操作大量文件的程序时保持这个选项打开的默认值。 这些服务包括 web 缓存,大容量邮件系统和新闻系统。 尽管可能会浪费一些内存,但打开这个选项通常不会降低性能。 但还是应该检验一下。
<varname>vfs.write_behind</varname>
<varname>vfs.write_behind</varname>
<primary><varname>vfs.write_behind</varname></primary>
<primary><varname>vfs.write_behind</varname></primary>
The <varname>vfs.write_behind</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable defaults to <literal>1</literal> (on). This tells the file system to issue media writes as full clusters are collected, which typically occurs when writing large sequential files. This avoids saturating the buffer cache with dirty buffers when it would not benefit I/O performance. However, this may stall processes and under certain circumstances should be turned off.
<varname>vfs.write_behind</varname> sysctl 变量默认是 <literal>1</literal> (打开)。 它告诉文件系统簇被收集满的时候把内容写进介质, 典型的是在写入大的连续的文件时。 主要的想法是, 如果可能对 I/O 性能会产生负面影响时, 应尽量避免让缓冲缓存被未同步缓冲区充满。 然而它可能降低处理速度并且在某些情况下您可能想要关闭它。
<varname>vfs.hirunningspace</varname>
<varname>vfs.hirunningspace</varname>
<primary><varname>vfs.hirunningspace</varname></primary>
<primary><varname>vfs.hirunningspace</varname></primary>
The <varname>vfs.hirunningspace</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable determines how much outstanding write I/O may be queued to disk controllers system-wide at any given instance. The default is usually sufficient, but on machines with many disks, try bumping it up to four or five <emphasis>megabytes</emphasis>. Setting too high a value which exceeds the buffer cache's write threshold can lead to bad clustering performance. Do not set this value arbitrarily high as higher write values may add latency to reads occurring at the same time.
<varname>vfs.hirunningspace</varname> sysctl 变量决定了在任何给定情况下, 有多少写 I/O 被排进队列以给系统的磁盘控制器。 默认值一般是足够的,但是对有很多磁盘的机器来说您可能需要把它设置成 4M 或 5M。注意这个设置成很高的值(超过缓存器的写极限)会导致坏的性能。 不要盲目的把它设置太高!高的数值会导致同时发生的读操作的迟延。
There are various other buffer cache and <acronym>VM</acronym> page cache related <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> values. Modifying these values is not recommended as the <acronym>VM</acronym> system does a good job of automatically tuning itself.
<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> 中还有许多与 buffer cache 和 VM页面 cache 有关的值, 一般不推荐修改它们。 虚拟内存系统已经能够很好地进行自动调整了。
<varname>vm.swap_idle_enabled</varname>
<varname>vm.swap_idle_enabled</varname>
<primary><varname>vm.swap_idle_enabled</varname></primary>
<primary><varname>vm.swap_idle_enabled</varname></primary>
The <varname>vm.swap_idle_enabled</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable is useful in large multi-user systems with many active login users and lots of idle processes. Such systems tend to generate continuous pressure on free memory reserves. Turning this feature on and tweaking the swapout hysteresis (in idle seconds) via <varname>vm.swap_idle_threshold1</varname> and <varname>vm.swap_idle_threshold2</varname> depresses the priority of memory pages associated with idle processes more quickly then the normal pageout algorithm. This gives a helping hand to the pageout daemon. Only turn this option on if needed, because the tradeoff is essentially pre-page memory sooner rather than later which eats more swap and disk bandwidth. In a small system this option will have a determinable effect, but in a large system that is already doing moderate paging, this option allows the <acronym>VM</acronym> system to stage whole processes into and out of memory easily.
<varname>vm.swap_idle_enabled</varname> sysctl 变量在有很多用户进入、离开系统和有很多空闲进程的大的多用户系统中很有用。 这些系统注重在空闲的内存中间产生连续压力的处理。通过 <varname>vm.swap_idle_threshold1</varname> 和 <varname>vm.swap_idle_threshold2</varname> 打开这个特性并且调整交换滞后 (在空闲时)允许您降低内存页中空闲进程的优先权,从而比正常的出页 (pageout)算法更快。这给出页守护进程带来了帮助。 除非您需要否则不要把这个选项打开,因为您所权衡的是更快地进入内存, 因而它会吃掉更多的交换和磁盘带宽。在小的系统上它会有决定性的效果, 但是在大的系统上它已经做了合适的页面调度这个选项允许 VM 系统容易的让全部的进程进出内存。
<varname>hw.ata.wc</varname>
<varname>hw.ata.wc</varname>
<primary><varname>hw.ata.wc</varname></primary>
<primary><varname>hw.ata.wc</varname></primary>
Turning off <acronym>IDE</acronym> write caching reduces write bandwidth to <acronym>IDE</acronym> disks, but may sometimes be necessary due to data consistency issues introduced by hard drive vendors. The problem is that some <acronym>IDE</acronym> drives lie about when a write completes. With <acronym>IDE</acronym> write caching turned on, <acronym>IDE</acronym> hard drives write data to disk out of order and will sometimes delay writing some blocks indefinitely when under heavy disk load. A crash or power failure may cause serious file system corruption. Check the default on the system by observing the <varname>hw.ata.wc</varname> <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable. If <acronym>IDE</acronym> write caching is turned off, one can set this read-only variable to <literal>1</literal> in <filename>/boot/loader.conf</filename> in order to enable it at boot time.
FreeBSD 4.3 中默认将 IDE 的写缓存关掉了。 这会降低到 IDE 磁盘用于写入操作的带宽, 但我们认为这有助于避免硬盘厂商所引入的, 可能引致严重的数据不一致问题。 这类问题实际上是由于 IDE 硬盘就写操作完成这件事的不诚实导致的。 当启用了 IDE 写入缓存时, IDE 硬盘驱动器不但不会按顺序将数据写到盘上, 而且当磁盘承受重载时, 它甚至会自作主张地对推迟某些块的实际写操作。 这样一来, 在系统发生崩溃或掉电时, 就会导致严重的文件系统损坏。 基于这些考虑, 我们将 FreeBSD 的默认配置改成了更为安全的禁用 IDE 写入缓存。 然而不幸的是, 这样做导致了性能的大幅降低, 因此在后来的发行版中这个配置又改为默认启用了。 您可以通过观察 <varname>hw.ata.wc</varname> sysctl 变量, 来确认您的系统中所采用的默认值。 如果 IDE 写缓存被禁用, 您可以通过将内核变量设置为 1 来启用它。 这一操作必须在启动时通过 boot loader 来完成。 在内核启动之后尝试这么做是没有任何作用的。
For more information, refer to <citerefentry><refentrytitle>ata</refentrytitle><manvolnum>4</manvolnum></citerefentry>.
更多信息请参阅<citerefentry><refentrytitle>ata</refentrytitle><manvolnum>4</manvolnum></citerefentry>。
<literal>SCSI_DELAY</literal> (<varname>kern.cam.scsi_delay</varname>)
<literal>SCSI_DELAY</literal> (<varname>kern.cam.scsi_delay</varname>)

Loading…

No matching activity found.

Browse all component changes

Things to check

XML markup

XML tags in translation do not match source

Reset

Glossary

English Chinese (Simplified) (zh_CN)
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect3/para
Labels
No labels currently set.
Source string location
book.translate.xml:21577
Source string age
5 months ago
Translation file
books/zh_CN/handbook.po, string 3527