]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man7/tuning.7
Upgrade Unbound to 1.6.0. More to follow.
[FreeBSD/FreeBSD.git] / share / man / man7 / tuning.7
1 .\" Copyright (C) 2001 Matthew Dillon. All rights reserved.
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\"
12 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 .\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
16 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 .\" SUCH DAMAGE.
23 .\"
24 .\" $FreeBSD$
25 .\"
26 .Dd October 30, 2017
27 .Dt TUNING 7
28 .Os
29 .Sh NAME
30 .Nm tuning
31 .Nd performance tuning under FreeBSD
32 .Sh SYSTEM SETUP - DISKLABEL, NEWFS, TUNEFS, SWAP
33 The swap partition should typically be approximately 2x the size of
34 main memory
35 for systems with less than 4GB of RAM, or approximately equal to
36 the size of main memory
37 if you have more.
38 Keep in mind future memory
39 expansion when sizing the swap partition.
40 Configuring too little swap can lead
41 to inefficiencies in the VM page scanning code as well as create issues
42 later on if you add more memory to your machine.
43 On larger systems
44 with multiple disks, configure swap on each drive.
45 The swap partitions on the drives should be approximately the same size.
46 The kernel can handle arbitrary sizes but
47 internal data structures scale to 4 times the largest swap partition.
48 Keeping
49 the swap partitions near the same size will allow the kernel to optimally
50 stripe swap space across the N disks.
51 Do not worry about overdoing it a
52 little, swap space is the saving grace of
53 .Ux
54 and even if you do not normally use much swap, it can give you more time to
55 recover from a runaway program before being forced to reboot.
56 .Pp
57 It is not a good idea to make one large partition.
58 First,
59 each partition has different operational characteristics and separating them
60 allows the file system to tune itself to those characteristics.
61 For example,
62 the root and
63 .Pa /usr
64 partitions are read-mostly, with very little writing, while
65 a lot of reading and writing could occur in
66 .Pa /var/tmp .
67 By properly
68 partitioning your system fragmentation introduced in the smaller more
69 heavily write-loaded partitions will not bleed over into the mostly-read
70 partitions.
71 .Pp
72 Properly partitioning your system also allows you to tune
73 .Xr newfs 8 ,
74 and
75 .Xr tunefs 8
76 parameters.
77 The only
78 .Xr tunefs 8
79 option worthwhile turning on is
80 .Em softupdates
81 with
82 .Dq Li "tunefs -n enable /filesystem" .
83 Softupdates drastically improves meta-data performance, mainly file
84 creation and deletion.
85 We recommend enabling softupdates on most file systems; however, there
86 are two limitations to softupdates that you should be aware of when
87 determining whether to use it on a file system.
88 First, softupdates guarantees file system consistency in the
89 case of a crash but could very easily be several seconds (even a minute!\&)
90 behind on pending write to the physical disk.
91 If you crash you may lose more work
92 than otherwise.
93 Secondly, softupdates delays the freeing of file system
94 blocks.
95 If you have a file system (such as the root file system) which is
96 close to full, doing a major update of it, e.g.,\&
97 .Dq Li "make installworld" ,
98 can run it out of space and cause the update to fail.
99 For this reason, softupdates will not be enabled on the root file system
100 during a typical install.
101 There is no loss of performance since the root
102 file system is rarely written to.
103 .Pp
104 A number of run-time
105 .Xr mount 8
106 options exist that can help you tune the system.
107 The most obvious and most dangerous one is
108 .Cm async .
109 Only use this option in conjunction with
110 .Xr gjournal 8 ,
111 as it is far too dangerous on a normal file system.
112 A less dangerous and more
113 useful
114 .Xr mount 8
115 option is called
116 .Cm noatime .
117 .Ux
118 file systems normally update the last-accessed time of a file or
119 directory whenever it is accessed.
120 This operation is handled in
121 .Fx
122 with a delayed write and normally does not create a burden on the system.
123 However, if your system is accessing a huge number of files on a continuing
124 basis the buffer cache can wind up getting polluted with atime updates,
125 creating a burden on the system.
126 For example, if you are running a heavily
127 loaded web site, or a news server with lots of readers, you might want to
128 consider turning off atime updates on your larger partitions with this
129 .Xr mount 8
130 option.
131 However, you should not gratuitously turn off atime
132 updates everywhere.
133 For example, the
134 .Pa /var
135 file system customarily
136 holds mailboxes, and atime (in combination with mtime) is used to
137 determine whether a mailbox has new mail.
138 You might as well leave
139 atime turned on for mostly read-only partitions such as
140 .Pa /
141 and
142 .Pa /usr
143 as well.
144 This is especially useful for
145 .Pa /
146 since some system utilities
147 use the atime field for reporting.
148 .Sh STRIPING DISKS
149 In larger systems you can stripe partitions from several drives together
150 to create a much larger overall partition.
151 Striping can also improve
152 the performance of a file system by splitting I/O operations across two
153 or more disks.
154 The
155 .Xr gstripe 8 ,
156 .Xr gvinum 8 ,
157 and
158 .Xr ccdconfig 8
159 utilities may be used to create simple striped file systems.
160 Generally
161 speaking, striping smaller partitions such as the root and
162 .Pa /var/tmp ,
163 or essentially read-only partitions such as
164 .Pa /usr
165 is a complete waste of time.
166 You should only stripe partitions that require serious I/O performance,
167 typically
168 .Pa /var , /home ,
169 or custom partitions used to hold databases and web pages.
170 Choosing the proper stripe size is also
171 important.
172 File systems tend to store meta-data on power-of-2 boundaries
173 and you usually want to reduce seeking rather than increase seeking.
174 This
175 means you want to use a large off-center stripe size such as 1152 sectors
176 so sequential I/O does not seek both disks and so meta-data is distributed
177 across both disks rather than concentrated on a single disk.
178 .Sh SYSCTL TUNING
179 .Xr sysctl 8
180 variables permit system behavior to be monitored and controlled at
181 run-time.
182 Some sysctls simply report on the behavior of the system; others allow
183 the system behavior to be modified;
184 some may be set at boot time using
185 .Xr rc.conf 5 ,
186 but most will be set via
187 .Xr sysctl.conf 5 .
188 There are several hundred sysctls in the system, including many that appear
189 to be candidates for tuning but actually are not.
190 In this document we will only cover the ones that have the greatest effect
191 on the system.
192 .Pp
193 The
194 .Va vm.overcommit
195 sysctl defines the overcommit behaviour of the vm subsystem.
196 The virtual memory system always does accounting of the swap space
197 reservation, both total for system and per-user.
198 Corresponding values
199 are available through sysctl
200 .Va vm.swap_total ,
201 that gives the total bytes available for swapping, and
202 .Va vm.swap_reserved ,
203 that gives number of bytes that may be needed to back all currently
204 allocated anonymous memory.
205 .Pp
206 Setting bit 0 of the
207 .Va vm.overcommit
208 sysctl causes the virtual memory system to return failure
209 to the process when allocation of memory causes
210 .Va vm.swap_reserved
211 to exceed
212 .Va vm.swap_total .
213 Bit 1 of the sysctl enforces
214 .Dv RLIMIT_SWAP
215 limit
216 (see
217 .Xr getrlimit 2 ) .
218 Root is exempt from this limit.
219 Bit 2 allows to count most of the physical
220 memory as allocatable, except wired and free reserved pages
221 (accounted by
222 .Va vm.stats.vm.v_free_target
223 and
224 .Va vm.stats.vm.v_wire_count
225 sysctls, respectively).
226 .Pp
227 The
228 .Va kern.ipc.maxpipekva
229 loader tunable is used to set a hard limit on the
230 amount of kernel address space allocated to mapping of pipe buffers.
231 Use of the mapping allows the kernel to eliminate a copy of the
232 data from writer address space into the kernel, directly copying
233 the content of mapped buffer to the reader.
234 Increasing this value to a higher setting, such as `25165824' might
235 improve performance on systems where space for mapping pipe buffers
236 is quickly exhausted.
237 This exhaustion is not fatal; however, and it will only cause pipes
238 to fall back to using double-copy.
239 .Pp
240 The
241 .Va kern.ipc.shm_use_phys
242 sysctl defaults to 0 (off) and may be set to 0 (off) or 1 (on).
243 Setting
244 this parameter to 1 will cause all System V shared memory segments to be
245 mapped to unpageable physical RAM.
246 This feature only has an effect if you
247 are either (A) mapping small amounts of shared memory across many (hundreds)
248 of processes, or (B) mapping large amounts of shared memory across any
249 number of processes.
250 This feature allows the kernel to remove a great deal
251 of internal memory management page-tracking overhead at the cost of wiring
252 the shared memory into core, making it unswappable.
253 .Pp
254 The
255 .Va vfs.vmiodirenable
256 sysctl defaults to 1 (on).
257 This parameter controls how directories are cached
258 by the system.
259 Most directories are small and use but a single fragment
260 (typically 2K) in the file system and even less (typically 512 bytes) in
261 the buffer cache.
262 However, when operating in the default mode the buffer
263 cache will only cache a fixed number of directories even if you have a huge
264 amount of memory.
265 Turning on this sysctl allows the buffer cache to use
266 the VM Page Cache to cache the directories.
267 The advantage is that all of
268 memory is now available for caching directories.
269 The disadvantage is that
270 the minimum in-core memory used to cache a directory is the physical page
271 size (typically 4K) rather than 512 bytes.
272 We recommend turning this option off in memory-constrained environments;
273 however, when on, it will substantially improve the performance of services
274 that manipulate a large number of files.
275 Such services can include web caches, large mail systems, and news systems.
276 Turning on this option will generally not reduce performance even with the
277 wasted memory but you should experiment to find out.
278 .Pp
279 The
280 .Va vfs.write_behind
281 sysctl defaults to 1 (on).
282 This tells the file system to issue media
283 writes as full clusters are collected, which typically occurs when writing
284 large sequential files.
285 The idea is to avoid saturating the buffer
286 cache with dirty buffers when it would not benefit I/O performance.
287 However,
288 this may stall processes and under certain circumstances you may wish to turn
289 it off.
290 .Pp
291 The
292 .Va vfs.hirunningspace
293 sysctl determines how much outstanding write I/O may be queued to
294 disk controllers system-wide at any given time.
295 It is used by the UFS file system.
296 The default is self-tuned and
297 usually sufficient but on machines with advanced controllers and lots
298 of disks this may be tuned up to match what the controllers buffer.
299 Configuring this setting to match tagged queuing capabilities of
300 controllers or drives with average IO size used in production works
301 best (for example: 16 MiB will use 128 tags with IO requests of 128 KiB).
302 Note that setting too high a value
303 (exceeding the buffer cache's write threshold) can lead to extremely
304 bad clustering performance.
305 Do not set this value arbitrarily high!
306 Higher write queuing values may also add latency to reads occurring at
307 the same time.
308 .Pp
309 The
310 .Va vfs.read_max
311 sysctl governs VFS read-ahead and is expressed as the number of blocks
312 to pre-read if the heuristics algorithm decides that the reads are
313 issued sequentially.
314 It is used by the UFS, ext2fs and msdosfs file systems.
315 With the default UFS block size of 32 KiB, a setting of 64 will allow
316 speculatively reading up to 2 MiB.
317 This setting may be increased to get around disk I/O latencies, especially
318 where these latencies are large such as in virtual machine emulated
319 environments.
320 It may be tuned down in specific cases where the I/O load is such that
321 read-ahead adversely affects performance or where system memory is really
322 low.
323 .Pp
324 The
325 .Va vfs.ncsizefactor
326 sysctl defines how large VFS namecache may grow.
327 The number of currently allocated entries in namecache is provided by
328 .Va debug.numcache
329 sysctl and the condition
330 debug.numcache < kern.maxvnodes * vfs.ncsizefactor
331 is adhered to.
332 .Pp
333 The
334 .Va vfs.ncnegfactor
335 sysctl defines how many negative entries VFS namecache is allowed to create.
336 The number of currently allocated negative entries is provided by
337 .Va debug.numneg
338 sysctl and the condition
339 vfs.ncnegfactor * debug.numneg < debug.numcache
340 is adhered to.
341 .Pp
342 There are various other buffer-cache and VM page cache related sysctls.
343 We do not recommend modifying these values.
344 .Pp
345 The
346 .Va net.inet.tcp.sendspace
347 and
348 .Va net.inet.tcp.recvspace
349 sysctls are of particular interest if you are running network intensive
350 applications.
351 They control the amount of send and receive buffer space
352 allowed for any given TCP connection.
353 The default sending buffer is 32K; the default receiving buffer
354 is 64K.
355 You can often
356 improve bandwidth utilization by increasing the default at the cost of
357 eating up more kernel memory for each connection.
358 We do not recommend
359 increasing the defaults if you are serving hundreds or thousands of
360 simultaneous connections because it is possible to quickly run the system
361 out of memory due to stalled connections building up.
362 But if you need
363 high bandwidth over a fewer number of connections, especially if you have
364 gigabit Ethernet, increasing these defaults can make a huge difference.
365 You can adjust the buffer size for incoming and outgoing data separately.
366 For example, if your machine is primarily doing web serving you may want
367 to decrease the recvspace in order to be able to increase the
368 sendspace without eating too much kernel memory.
369 Note that the routing table (see
370 .Xr route 8 )
371 can be used to introduce route-specific send and receive buffer size
372 defaults.
373 .Pp
374 As an additional management tool you can use pipes in your
375 firewall rules (see
376 .Xr ipfw 8 )
377 to limit the bandwidth going to or from particular IP blocks or ports.
378 For example, if you have a T1 you might want to limit your web traffic
379 to 70% of the T1's bandwidth in order to leave the remainder available
380 for mail and interactive use.
381 Normally a heavily loaded web server
382 will not introduce significant latencies into other services even if
383 the network link is maxed out, but enforcing a limit can smooth things
384 out and lead to longer term stability.
385 Many people also enforce artificial
386 bandwidth limitations in order to ensure that they are not charged for
387 using too much bandwidth.
388 .Pp
389 Setting the send or receive TCP buffer to values larger than 65535 will result
390 in a marginal performance improvement unless both hosts support the window
391 scaling extension of the TCP protocol, which is controlled by the
392 .Va net.inet.tcp.rfc1323
393 sysctl.
394 These extensions should be enabled and the TCP buffer size should be set
395 to a value larger than 65536 in order to obtain good performance from
396 certain types of network links; specifically, gigabit WAN links and
397 high-latency satellite links.
398 RFC1323 support is enabled by default.
399 .Pp
400 The
401 .Va net.inet.tcp.always_keepalive
402 sysctl determines whether or not the TCP implementation should attempt
403 to detect dead TCP connections by intermittently delivering
404 .Dq keepalives
405 on the connection.
406 By default, this is enabled for all applications; by setting this
407 sysctl to 0, only applications that specifically request keepalives
408 will use them.
409 In most environments, TCP keepalives will improve the management of
410 system state by expiring dead TCP connections, particularly for
411 systems serving dialup users who may not always terminate individual
412 TCP connections before disconnecting from the network.
413 However, in some environments, temporary network outages may be
414 incorrectly identified as dead sessions, resulting in unexpectedly
415 terminated TCP connections.
416 In such environments, setting the sysctl to 0 may reduce the occurrence of
417 TCP session disconnections.
418 .Pp
419 The
420 .Va net.inet.tcp.delayed_ack
421 TCP feature is largely misunderstood.
422 Historically speaking, this feature
423 was designed to allow the acknowledgement to transmitted data to be returned
424 along with the response.
425 For example, when you type over a remote shell,
426 the acknowledgement to the character you send can be returned along with the
427 data representing the echo of the character.
428 With delayed acks turned off,
429 the acknowledgement may be sent in its own packet, before the remote service
430 has a chance to echo the data it just received.
431 This same concept also
432 applies to any interactive protocol (e.g.,\& SMTP, WWW, POP3), and can cut the
433 number of tiny packets flowing across the network in half.
434 The
435 .Fx
436 delayed ACK implementation also follows the TCP protocol rule that
437 at least every other packet be acknowledged even if the standard 100ms
438 timeout has not yet passed.
439 Normally the worst a delayed ACK can do is
440 slightly delay the teardown of a connection, or slightly delay the ramp-up
441 of a slow-start TCP connection.
442 While we are not sure we believe that
443 the several FAQs related to packages such as SAMBA and SQUID which advise
444 turning off delayed acks may be referring to the slow-start issue.
445 .Pp
446 The
447 .Va net.inet.ip.portrange.*
448 sysctls control the port number ranges automatically bound to TCP and UDP
449 sockets.
450 There are three ranges: a low range, a default range, and a
451 high range, selectable via the
452 .Dv IP_PORTRANGE
453 .Xr setsockopt 2
454 call.
455 Most
456 network programs use the default range which is controlled by
457 .Va net.inet.ip.portrange.first
458 and
459 .Va net.inet.ip.portrange.last ,
460 which default to 49152 and 65535, respectively.
461 Bound port ranges are
462 used for outgoing connections, and it is possible to run the system out
463 of ports under certain circumstances.
464 This most commonly occurs when you are
465 running a heavily loaded web proxy.
466 The port range is not an issue
467 when running a server which handles mainly incoming connections, such as a
468 normal web server, or has a limited number of outgoing connections, such
469 as a mail relay.
470 For situations where you may run out of ports,
471 we recommend decreasing
472 .Va net.inet.ip.portrange.first
473 modestly.
474 A range of 10000 to 30000 ports may be reasonable.
475 You should also consider firewall effects when changing the port range.
476 Some firewalls
477 may block large ranges of ports (usually low-numbered ports) and expect systems
478 to use higher ranges of ports for outgoing connections.
479 By default
480 .Va net.inet.ip.portrange.last
481 is set at the maximum allowable port number.
482 .Pp
483 The
484 .Va kern.ipc.somaxconn
485 sysctl limits the size of the listen queue for accepting new TCP connections.
486 The default value of 128 is typically too low for robust handling of new
487 connections in a heavily loaded web server environment.
488 For such environments,
489 we recommend increasing this value to 1024 or higher.
490 The service daemon
491 may itself limit the listen queue size (e.g.,\&
492 .Xr sendmail 8 ,
493 apache) but will
494 often have a directive in its configuration file to adjust the queue size up.
495 Larger listen queues also do a better job of fending off denial of service
496 attacks.
497 .Pp
498 The
499 .Va kern.maxfiles
500 sysctl determines how many open files the system supports.
501 The default is
502 typically a few thousand but you may need to bump this up to ten or twenty
503 thousand if you are running databases or large descriptor-heavy daemons.
504 The read-only
505 .Va kern.openfiles
506 sysctl may be interrogated to determine the current number of open files
507 on the system.
508 .Pp
509 The
510 .Va vm.swap_idle_enabled
511 sysctl is useful in large multi-user systems where you have lots of users
512 entering and leaving the system and lots of idle processes.
513 Such systems
514 tend to generate a great deal of continuous pressure on free memory reserves.
515 Turning this feature on and adjusting the swapout hysteresis (in idle
516 seconds) via
517 .Va vm.swap_idle_threshold1
518 and
519 .Va vm.swap_idle_threshold2
520 allows you to depress the priority of pages associated with idle processes
521 more quickly then the normal pageout algorithm.
522 This gives a helping hand
523 to the pageout daemon.
524 Do not turn this option on unless you need it,
525 because the tradeoff you are making is to essentially pre-page memory sooner
526 rather than later, eating more swap and disk bandwidth.
527 In a small system
528 this option will have a detrimental effect but in a large system that is
529 already doing moderate paging this option allows the VM system to stage
530 whole processes into and out of memory more easily.
531 .Sh LOADER TUNABLES
532 Some aspects of the system behavior may not be tunable at runtime because
533 memory allocations they perform must occur early in the boot process.
534 To change loader tunables, you must set their values in
535 .Xr loader.conf 5
536 and reboot the system.
537 .Pp
538 .Va kern.maxusers
539 controls the scaling of a number of static system tables, including defaults
540 for the maximum number of open files, sizing of network memory resources, etc.
541 .Va kern.maxusers
542 is automatically sized at boot based on the amount of memory available in
543 the system, and may be determined at run-time by inspecting the value of the
544 read-only
545 .Va kern.maxusers
546 sysctl.
547 .Pp
548 The
549 .Va kern.dfldsiz
550 and
551 .Va kern.dflssiz
552 tunables set the default soft limits for process data and stack size
553 respectively.
554 Processes may increase these up to the hard limits by calling
555 .Xr setrlimit 2 .
556 The
557 .Va kern.maxdsiz ,
558 .Va kern.maxssiz ,
559 and
560 .Va kern.maxtsiz
561 tunables set the hard limits for process data, stack, and text size
562 respectively; processes may not exceed these limits.
563 The
564 .Va kern.sgrowsiz
565 tunable controls how much the stack segment will grow when a process
566 needs to allocate more stack.
567 .Pp
568 .Va kern.ipc.nmbclusters
569 may be adjusted to increase the number of network mbufs the system is
570 willing to allocate.
571 Each cluster represents approximately 2K of memory,
572 so a value of 1024 represents 2M of kernel memory reserved for network
573 buffers.
574 You can do a simple calculation to figure out how many you need.
575 If you have a web server which maxes out at 1000 simultaneous connections,
576 and each connection eats a 16K receive and 16K send buffer, you need
577 approximately 32MB worth of network buffers to deal with it.
578 A good rule of
579 thumb is to multiply by 2, so 32MBx2 = 64MB/2K = 32768.
580 So for this case
581 you would want to set
582 .Va kern.ipc.nmbclusters
583 to 32768.
584 We recommend values between
585 1024 and 4096 for machines with moderates amount of memory, and between 4096
586 and 32768 for machines with greater amounts of memory.
587 Under no circumstances
588 should you specify an arbitrarily high value for this parameter, it could
589 lead to a boot-time crash.
590 The
591 .Fl m
592 option to
593 .Xr netstat 1
594 may be used to observe network cluster use.
595 .Pp
596 More and more programs are using the
597 .Xr sendfile 2
598 system call to transmit files over the network.
599 The
600 .Va kern.ipc.nsfbufs
601 sysctl controls the number of file system buffers
602 .Xr sendfile 2
603 is allowed to use to perform its work.
604 This parameter nominally scales
605 with
606 .Va kern.maxusers
607 so you should not need to modify this parameter except under extreme
608 circumstances.
609 See the
610 .Sx TUNING
611 section in the
612 .Xr sendfile 2
613 manual page for details.
614 .Sh KERNEL CONFIG TUNING
615 There are a number of kernel options that you may have to fiddle with in
616 a large-scale system.
617 In order to change these options you need to be
618 able to compile a new kernel from source.
619 The
620 .Xr config 8
621 manual page and the handbook are good starting points for learning how to
622 do this.
623 Generally the first thing you do when creating your own custom
624 kernel is to strip out all the drivers and services you do not use.
625 Removing things like
626 .Dv INET6
627 and drivers you do not have will reduce the size of your kernel, sometimes
628 by a megabyte or more, leaving more memory available for applications.
629 .Pp
630 .Dv SCSI_DELAY
631 may be used to reduce system boot times.
632 The defaults are fairly high and
633 can be responsible for 5+ seconds of delay in the boot process.
634 Reducing
635 .Dv SCSI_DELAY
636 to something below 5 seconds could work (especially with modern drives).
637 .Pp
638 There are a number of
639 .Dv *_CPU
640 options that can be commented out.
641 If you only want the kernel to run
642 on a Pentium class CPU, you can easily remove
643 .Dv I486_CPU ,
644 but only remove
645 .Dv I586_CPU
646 if you are sure your CPU is being recognized as a Pentium II or better.
647 Some clones may be recognized as a Pentium or even a 486 and not be able
648 to boot without those options.
649 If it works, great!
650 The operating system
651 will be able to better use higher-end CPU features for MMU, task switching,
652 timebase, and even device operations.
653 Additionally, higher-end CPUs support
654 4MB MMU pages, which the kernel uses to map the kernel itself into memory,
655 increasing its efficiency under heavy syscall loads.
656 .Sh CPU, MEMORY, DISK, NETWORK
657 The type of tuning you do depends heavily on where your system begins to
658 bottleneck as load increases.
659 If your system runs out of CPU (idle times
660 are perpetually 0%) then you need to consider upgrading the CPU
661 or perhaps you need to revisit the
662 programs that are causing the load and try to optimize them.
663 If your system
664 is paging to swap a lot you need to consider adding more memory.
665 If your
666 system is saturating the disk you typically see high CPU idle times and
667 total disk saturation.
668 .Xr systat 1
669 can be used to monitor this.
670 There are many solutions to saturated disks:
671 increasing memory for caching, mirroring disks, distributing operations across
672 several machines, and so forth.
673 .Pp
674 Finally, you might run out of network suds.
675 Optimize the network path
676 as much as possible.
677 For example, in
678 .Xr firewall 7
679 we describe a firewall protecting internal hosts with a topology where
680 the externally visible hosts are not routed through it.
681 Most bottlenecks occur at the WAN link.
682 If expanding the link is not an option it may be possible to use the
683 .Xr dummynet 4
684 feature to implement peak shaving or other forms of traffic shaping to
685 prevent the overloaded service (such as web services) from affecting other
686 services (such as email), or vice versa.
687 In home installations this could
688 be used to give interactive traffic (your browser,
689 .Xr ssh 1
690 logins) priority
691 over services you export from your box (web services, email).
692 .Sh SEE ALSO
693 .Xr netstat 1 ,
694 .Xr systat 1 ,
695 .Xr sendfile 2 ,
696 .Xr ata 4 ,
697 .Xr dummynet 4 ,
698 .Xr eventtimers 4 ,
699 .Xr login.conf 5 ,
700 .Xr rc.conf 5 ,
701 .Xr sysctl.conf 5 ,
702 .Xr firewall 7 ,
703 .Xr hier 7 ,
704 .Xr ports 7 ,
705 .Xr boot 8 ,
706 .Xr bsdinstall 8 ,
707 .Xr ccdconfig 8 ,
708 .Xr config 8 ,
709 .Xr fsck 8 ,
710 .Xr gjournal 8 ,
711 .Xr gpart 8 ,
712 .Xr gstripe 8 ,
713 .Xr gvinum 8 ,
714 .Xr ifconfig 8 ,
715 .Xr ipfw 8 ,
716 .Xr loader 8 ,
717 .Xr mount 8 ,
718 .Xr newfs 8 ,
719 .Xr route 8 ,
720 .Xr sysctl 8 ,
721 .Xr tunefs 8
722 .Sh HISTORY
723 The
724 .Nm
725 manual page was originally written by
726 .An Matthew Dillon
727 and first appeared
728 in
729 .Fx 4.3 ,
730 May 2001.
731 The manual page was greatly modified by
732 .An Eitan Adler Aq Mt eadler@FreeBSD.org .