View | Details | Raw Unified | Return to bug 27885
Collapse All | Expand All

(-)tuning.7 (-16 / +16 lines)
Lines 16-22 Link Here
16
.Xr disklabel 8
16
.Xr disklabel 8
17
to lay out your filesystems on a hard disk it is important to remember
17
to lay out your filesystems on a hard disk it is important to remember
18
that hard drives can transfer data much more quickly from outer tracks
18
that hard drives can transfer data much more quickly from outer tracks
19
then they can from inner tracks.  To take advantage of this you should
19
than they can from inner tracks.  To take advantage of this you should
20
try to pack your smaller filesystems and swap closer to the outer tracks,
20
try to pack your smaller filesystems and swap closer to the outer tracks,
21
follow with the larger filesystems, and end with the largest filesystems.
21
follow with the larger filesystems, and end with the largest filesystems.
22
It is also important to size system standard filesystems such that you
22
It is also important to size system standard filesystems such that you
Lines 116-122 Link Here
116
in the partition table) will increase I/O performance in the partitions 
116
in the partition table) will increase I/O performance in the partitions 
117
where you need it the most.  Now it is true that you might also need I/O
117
where you need it the most.  Now it is true that you might also need I/O
118
performance in the larger partitions, but they are so large that shifting
118
performance in the larger partitions, but they are so large that shifting
119
them more towards the edge of the disk will not lead to a significnat
119
them more towards the edge of the disk will not lead to a significant
120
performance improvement whereas moving /var to the edge can have a huge impact.
120
performance improvement whereas moving /var to the edge can have a huge impact.
121
Finally, there are safety concerns.  Having a small neat root partition that
121
Finally, there are safety concerns.  Having a small neat root partition that
122
is essentially read-only gives it a greater chance of surviving a bad crash
122
is essentially read-only gives it a greater chance of surviving a bad crash
Lines 159-165 Link Here
159
recovery times after a crash.  Do not use this option
159
recovery times after a crash.  Do not use this option
160
unless you are actually storing large files on the partition, because if you
160
unless you are actually storing large files on the partition, because if you
161
overcompensate you can wind up with a filesystem that has lots of free
161
overcompensate you can wind up with a filesystem that has lots of free
162
space remaining but cannot accomodate any more files.  Using
162
space remaining but cannot accommodate any more files.  Using
163
32768, 65536, or 262144 bytes/inode is recommended.  You can go higher but
163
32768, 65536, or 262144 bytes/inode is recommended.  You can go higher but
164
it will have only incremental effects on fsck recovery times.  For
164
it will have only incremental effects on fsck recovery times.  For
165
example, 
165
example, 
Lines 187-196 Link Here
187
Softupdates drastically improves meta-data performance, mainly file
187
Softupdates drastically improves meta-data performance, mainly file
188
creation and deletion.  We recommend turning softupdates on on all of your
188
creation and deletion.  We recommend turning softupdates on on all of your
189
filesystems.  There are two downsides to softupdates that you should be
189
filesystems.  There are two downsides to softupdates that you should be
190
aware of:  First, softupdates guarentees filesystem consistency in the
190
aware of:  First, softupdates guarantees filesystem consistency in the
191
case of a crash but could very easily be several seconds (even a minute!)
191
case of a crash but could very easily be several seconds (even a minute!)
192
behind updating the physical disk.  If you crash you may lose more work
192
behind updating the physical disk.  If you crash you may lose more work
193
then otherwise.  Secondly, softupdates delays the freeing of filesystem
193
than otherwise.  Secondly, softupdates delays the freeing of filesystem
194
blocks.  If you have a filesystem (such as the root filesystem) which is 
194
blocks.  If you have a filesystem (such as the root filesystem) which is 
195
close to full, doing a major update of it, e.g.
195
close to full, doing a major update of it, e.g.
196
.Em make installworld,
196
.Em make installworld,
Lines 209-219 Link Here
209
time.  You should only stripe partitions that require serious I/O performance...
209
time.  You should only stripe partitions that require serious I/O performance...
210
typically /var, /home, or custom partitions used to hold databases and web
210
typically /var, /home, or custom partitions used to hold databases and web
211
pages.  Choosing the proper stripe size is also 
211
pages.  Choosing the proper stripe size is also 
212
important.  Filesystems tend to store meta-data on power-of-2 boundries
212
important.  Filesystems tend to store meta-data on power-of-2 boundaries
213
and you usually want to reduce seeking rather then increase seeking.  This
213
and you usually want to reduce seeking rather than increase seeking.  This
214
means you want to use a large off-center stripe size such as 1152 sectors
214
means you want to use a large off-center stripe size such as 1152 sectors
215
so sequential I/O does not seek both disks and so meta-data is distributed
215
so sequential I/O does not seek both disks and so meta-data is distributed
216
across both disks rather then concentrated on a single disk.  If
216
across both disks rather than concentrated on a single disk.  If
217
you really need to get sophisticated, we recommend using a real hardware
217
you really need to get sophisticated, we recommend using a real hardware
218
raid controller from the list of
218
raid controller from the list of
219
.Fx
219
.Fx
Lines 249-255 Link Here
249
the VM Page Cache to cache the directories.  The advantage is that all of
249
the VM Page Cache to cache the directories.  The advantage is that all of
250
memory is now available for caching directories.  The disadvantage is that
250
memory is now available for caching directories.  The disadvantage is that
251
the minimum in-core memory used to cache a directory is the physical page
251
the minimum in-core memory used to cache a directory is the physical page
252
size (typically 4K) rather then 512 bytes.  We recommend turning this option
252
size (typically 4K) rather than 512 bytes.  We recommend turning this option
253
on if you are running any services which manipulate large numbers of files.
253
on if you are running any services which manipulate large numbers of files.
254
Such services can include web caches, large mail systems, and news systems.
254
Such services can include web caches, large mail systems, and news systems.
255
Turning on this option will generally not reduce performance even with the
255
Turning on this option will generally not reduce performance even with the
Lines 270-276 Link Here
270
improve bandwidth utilization by increasing the default at the cost of 
270
improve bandwidth utilization by increasing the default at the cost of 
271
eating up more kernel memory for each connection.  We do not recommend
271
eating up more kernel memory for each connection.  We do not recommend
272
increasing the defaults if you are serving hundreds or thousands of
272
increasing the defaults if you are serving hundreds or thousands of
273
simultanious connections because it is possible to quickly run the system
273
simultaneous connections because it is possible to quickly run the system
274
out of memory due to stalled connections building up.  But if you need
274
out of memory due to stalled connections building up.  But if you need
275
high bandwidth over a fewer number of connections, especially if you have
275
high bandwidth over a fewer number of connections, especially if you have
276
gigabit ethernet, increasing these defaults can make a huge difference.
276
gigabit ethernet, increasing these defaults can make a huge difference.
Lines 280-286 Link Here
280
without eating too much kernel memory.  Note that the route table, see
280
without eating too much kernel memory.  Note that the route table, see
281
.Xr route 8 ,
281
.Xr route 8 ,
282
can be used to introduce route-specific send and receive buffer size
282
can be used to introduce route-specific send and receive buffer size
283
defaults.  As an additional mangagement tool you can use pipes in your
283
defaults.  As an additional management tool you can use pipes in your
284
firewall rules, see
284
firewall rules, see
285
.Xr ipfw 8 ,
285
.Xr ipfw 8 ,
286
to limit the bandwidth going to or from particular IP blocks or ports.
286
to limit the bandwidth going to or from particular IP blocks or ports.
Lines 296-304 Link Here
296
We recommend that you turn on (set to 1) and leave on the 
296
We recommend that you turn on (set to 1) and leave on the 
297
.Em net.inet.tcp.always_keepalive
297
.Em net.inet.tcp.always_keepalive
298
control.  The default is usually off.  This introduces a small amount of
298
control.  The default is usually off.  This introduces a small amount of
299
additional network bandwidth but guarentees that dead tcp connections
299
additional network bandwidth but guarantees that dead tcp connections
300
will eventually be recognized and cleared.  Dead tcp connections are a
300
will eventually be recognized and cleared.  Dead tcp connections are a
301
particular problem on systems accesed by users operating over dialups,
301
particular problem on systems accessed by users operating over dialups,
302
because users often disconnect their modems without properly closing active
302
because users often disconnect their modems without properly closing active
303
connections.
303
connections.
304
.Pp
304
.Pp
Lines 339-345 Link Here
339
willing to allocate.  Each cluster represents approximately 2K of memory,
339
willing to allocate.  Each cluster represents approximately 2K of memory,
340
so a value of 1024 represents 2M of kernel memory reserved for network
340
so a value of 1024 represents 2M of kernel memory reserved for network
341
buffers.  You can do a simple calculation to figure out how many you need.
341
buffers.  You can do a simple calculation to figure out how many you need.
342
If you have a web server which maxes out at 1000 simultanious connections,
342
If you have a web server which maxes out at 1000 simultaneous connections,
343
and each connection eats a 16K receive and 16K send buffer, you need
343
and each connection eats a 16K receive and 16K send buffer, you need
344
approximate 32MB worth of network buffers to deal with it.  A good rule of
344
approximate 32MB worth of network buffers to deal with it.  A good rule of
345
thumb is to multiply by 2, so 32MBx2 = 64MB/2K = 32768.  So for this case
345
thumb is to multiply by 2, so 32MBx2 = 64MB/2K = 32768.  So for this case
Lines 413-419 Link Here
413
.Sh CPU, MEMORY, DISK, NETWORK
413
.Sh CPU, MEMORY, DISK, NETWORK
414
The type of tuning you do depends heavily on where your system begins to
414
The type of tuning you do depends heavily on where your system begins to
415
bottleneck as load increases.  If your system runs out of cpu (idle times
415
bottleneck as load increases.  If your system runs out of cpu (idle times
416
are pepetually 0%) then you need to consider upgrading the cpu or moving to
416
are perpetually 0%) then you need to consider upgrading the cpu or moving to
417
an SMP motherboard (multiple cpu's), or perhaps you need to revisit the
417
an SMP motherboard (multiple cpu's), or perhaps you need to revisit the
418
programs that are causing the load and try to optimize them.  If your system
418
programs that are causing the load and try to optimize them.  If your system
419
is paging to swap a lot you need to consider adding more memory.  If your
419
is paging to swap a lot you need to consider adding more memory.  If your
Lines 436-442 Link Here
436
.Xr firewall 7
436
.Xr firewall 7
437
we describe a firewall protecting internal hosts with a topology where
437
we describe a firewall protecting internal hosts with a topology where
438
the externally visible hosts are not routed through it.  Use 100BaseT rather
438
the externally visible hosts are not routed through it.  Use 100BaseT rather
439
then 10BaseT, or use 1000BaseT rather then 100BaseT, depending on your needs.
439
than 10BaseT, or use 1000BaseT rather than 100BaseT, depending on your needs.
440
Most bottlenecks occur at the WAN link (e.g. modem, T1, DSL, whatever).
440
Most bottlenecks occur at the WAN link (e.g. modem, T1, DSL, whatever).
441
If expanding the link is not an option it may be possible to use ipfw's
441
If expanding the link is not an option it may be possible to use ipfw's
442
.Sy DUMMYNET
442
.Sy DUMMYNET

Return to bug 27885