📄 00000002.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: althea (痛并快乐着), 信区: Linux <BR>标 题: [转载] File Server Tuning <BR>发信站: BBS 水木清华站 (Tue Nov 9 02:37:04 1999) <BR> <BR> File Server Tuning <BR> <BR> <BR> <BR> Linux comes bundled with servers for several types of network file <BR> systems. These pages are aimed at getting better performance out of <BR> such software than is available with the default configurations. <BR> <BR> Servers <BR> <BR> NFS <BR> <BR> Homepage: <BR> Tips: <BR> <BR> Samba <BR> <BR> Homepage: samba.org <BR> Tips: Two documents about Samba performance tuning from the <BR> documentation: Speed.txt, and Speed2.txt. These are synthesised in this <BR> article. <BR> Samba 2 tuning article <BR> <BR> General <BR> <BR> Default Packet Sizes <BR> <BR> NFS: The rsize and wsize mount options (specifyable in /etc/fstab) <BR> increase the packet sizes used by NFS clients, and usually increase <BR> performace. Try <BR> <BR> mount -o rsize=8192,wsize=8192 -t nfs host:/dir /mnt/point <BR> <BR> SMB: A similar gain can be achieved with the Samba server by setting <BR> the following in smb.conf: <BR> <BR> socket options = SO_SNDBUF=4096 SO_RCVBUF=4096 <BR> <BR> Block sizes <BR> <BR> For filesystems dedicated to serving fairly large files, adopting a <BR> larger than default 1024 byte block size may yield significant <BR> performance gains. <BR> <BR> Recent transactions on the linux kernel list suggest that setting the <BR> block sizein an ext2 file system to 4096 instead of the default 1024 <BR> will result in less file fragmentation, faster fsck's, faster deletes <BR> and faster raw read speed, due to the reduced number of seeks. <BR> <BR> Unfortunately this cannot be changed on the fly. Only a reformat will <BR> make this so. The command to format a file system with 4096 byte blocks <BR> is: <BR> <BR> mke2fs -b 4096 /dev/whatever <BR> <BR> Additionally, on any filesystems except those used for logfiles, the <BR> default of 5% reserved for root use is excessive for large file <BR> systems, so the command to make the filesystem can be augmented to <BR> <BR> mke2fs -b 4096 -m 1 /dev/whatever <BR> <BR> to set the reserved fraction to 1 percent. <BR> <BR> Anything that speeds up the linux filesystem will speed up its file <BR> serving capabilities correspondingly. <BR> <BR> However, use some judgment when considering this suggestion. The <BR> performance gain is at the expense of being less space efficient. And <BR> if the filesystem in question is dedicated to small files, such as for <BR> a news server or mail server, going to 4096 byte blocks will have an <BR> amplified cost in terms of disk space. For these, you might want to <BR> stick with 1024 byte blocks. For example, the average size of the 9250 <BR> files currently in our comp.os.linux.hardware is 2145 bytes, with many <BR> smaller and obviously many larger than that. So going to a 4096 byte <BR> block would mean the average file would use 4096-2145=1951 too much. At <BR> 1024, there'd be two full 1024 byte blocks and a third block to get the <BR> remaining 97 bytes. Third block would be 927 bytes empty, on average. <BR> Going to a 512 byte block, there'd be 415 bytes wasted, on average. <BR> <BR> The atime attribute <BR> <BR> In addition to the information about when files were created and last <BR> modified, Linux also records when a file was last accessed. This <BR> information is not particularly useful, and there is a cost associated <BR> with recording it. The ext2 filesystem allows the superuser to mark <BR> individual files such that their last access time is not recorded. This <BR> may lead to significant performance improvements when running find, and <BR> may also be useful on often accessed frequently changing files such as <BR> the contents of /var/spool/news. <BR> <BR> To set the attribute, use <BR> <BR> chattr +A filename <BR> <BR> For a whole directory tree, do something like: <BR> <BR> chattr -R +A /var/spool <BR> <BR> Additionally, entire partitions can be mounted with no access time <BR> updating, again, news spools are a prime example. The man page for <BR> mount lists the following option: <BR> <BR> noatime <BR> Do not update inode access times on this <BR> file system (e.g, for faster access on the <BR> news spool to speed up news servers). <BR> <BR> The syntax to do this automagically is to edit the /etc/fstab, adding <BR> in the noatime option to the options column, separated by a comma. eg: <BR> <BR> # device mount point type options dump freqency fsck pass number <BR> /dev/sdb1 /var/spool/news ext2 defaults,noatime 1 2 <BR> <BR>-- <BR>※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 162.105.179.11] <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -