荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: georgehill (小美), 信区: Linux
标 题: File Server Tuning
发信站: BBS 荔园晨风站 (Tue Nov 9 13:42:15 1999), 转信
File Server Tuning
Linux comes bundled with servers for several types of network file
systems. These pages are aimed at getting better performance out of
such software than is available with the default configurations.
Servers
NFS
Homepage:
Tips:
Samba
Homepage: samba.org
Tips: Two documents about Samba performance tuning from the
documentation: Speed.txt, and Speed2.txt. These are synthesised in this
article.
Samba 2 tuning article
General
Default Packet Sizes
NFS: The rsize and wsize mount options (specifyable in /etc/fstab)
increase the packet sizes used by NFS clients, and usually increase
performace. Try
mount -o rsize=8192,wsize=8192 -t nfs host:/dir /mnt/point
SMB: A similar gain can be achieved with the Samba server by setting
the following in smb.conf:
socket options = SO_SNDBUF=4096 SO_RCVBUF=4096
Block sizes
For filesystems dedicated to serving fairly large files, adopting a
larger than default 1024 byte block size may yield significant
performance gains.
Recent transactions on the linux kernel list suggest that setting the
block sizein an ext2 file system to 4096 instead of the default 1024
will result in less file fragmentation, faster fsck's, faster deletes
and faster raw read speed, due to the reduced number of seeks.
Unfortunately this cannot be changed on the fly. Only a reformat will
make this so. The command to format a file system with 4096 byte blocks
is:
mke2fs -b 4096 /dev/whatever
Additionally, on any filesystems except those used for logfiles, the
default of 5% reserved for root use is excessive for large file
systems, so the command to make the filesystem can be augmented to
mke2fs -b 4096 -m 1 /dev/whatever
to set the reserved fraction to 1 percent.
Anything that speeds up the linux filesystem will speed up its file
serving capabilities correspondingly.
However, use some judgment when considering this suggestion. The
performance gain is at the expense of being less space efficient. And
if the filesystem in question is dedicated to small files, such as for
a news server or mail server, going to 4096 byte blocks will have an
amplified cost in terms of disk space. For these, you might want to
stick with 1024 byte blocks. For example, the average size of the 9250
files currently in our comp.os.linux.hardware is 2145 bytes, with many
smaller and obviously many larger than that. So going to a 4096 byte
block would mean the average file would use 4096-2145=1951 too much. At
1024, there'd be two full 1024 byte blocks and a third block to get the
remaining 97 bytes. Third block would be 927 bytes empty, on average.
Going to a 512 byte block, there'd be 415 bytes wasted, on average.
The atime attribute
In addition to the information about when files were created and last
modified, Linux also records when a file was last accessed. This
information is not particularly useful, and there is a cost associated
with recording it. The ext2 filesystem allows the superuser to mark
individual files such that their last access time is not recorded. This
may lead to significant performance improvements when running find, and
may also be useful on often accessed frequently changing files such as
the contents of /var/spool/news.
To set the attribute, use
chattr +A filename
For a whole directory tree, do something like:
chattr -R +A /var/spool
Additionally, entire partitions can be mounted with no access time
updating, again, news spools are a prime example. The man page for
mount lists the following option:
noatime
Do not update inode access times on this
file system (e.g, for faster access on the
news spool to speed up news servers).
The syntax to do this automagically is to edit the /etc/fstab, adding
in the noatime option to the options column, separated by a comma. eg:
# device mount point type options dump freqency fsck pass number
/dev/sdb1 /var/spool/news ext2 defaults,noatime 1 2
--
磨难,是上苍给我最宝贵的财富!
感谢上苍!
我是来自大富翁的小美!^_^
※ 来源:·BBS 荔园晨风站 bbs.szu.edu.cn·[FROM: 192.168.1.115]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店