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