muwanqing_cu 发表于 2012-04-22 19:21

【已经解决】freebsd对小文件读写性能怎么样?

本帖最后由 ulovko 于 2012-08-24 09:52 编辑

想做个web缓存服务器   不知道UFS对小文件读写性能怎么样

fender0107401 发表于 2012-04-22 19:42

这个貌似要看你的文件的具体大小,文件系统使用磁盘的时候是把磁盘分成小块的,不同的文件系统的分法是不一样的,而且这个具体数值是可以修改的(没见谁改过)。

貌似,如果你的文件大小和这个数值的相关性比较好,那么你就走运了。

action08 发表于 2012-04-22 22:41

看运气,

macafee 发表于 2012-04-23 09:44

如果是常用小文件,数量不多的话,放到内存盘里去。

ulovko 发表于 2012-04-23 09:45

本帖最后由 ulovko 于 2012-04-23 09:56 编辑

引文:Blocks are segments of disk that contain data. FreeBSD defaults to 16KB
blocks. Not all files are even multiples of 16KB, so FFS uses fragments to store
leftovers. The standard is one-eighth of the block size, or 2KB. For example,
a 20KB file would fill one block and two fragments.如果是LINUX系统直接修改 block size 即可 (支持:1K 2K 4K)需要重新格式化加上参数: block 大小值


BSD:
继续引文:FreeBSD defaults to using 16KB blocks and 2KB fragments.
We talked about UFS2 design back in Chapter 8. The defaults are a
good average on most modern systems. If you have a special-purpose filesystem
that will only hold files of an unusual size, you might want to change the
block size. For example, if your application uses millions of files that are only
6KB each, it makes sense to change the block size to 8KB. The minimum size
is 4KB. If your application will use only a few files, but they’re monstrously
huge, you might want to use 32KB or even 64KB blocks. One word of warning,
however: FreeBSD expects the fragment size to be exactly one-eighth of the
block size. Using another ratio for block:fragment size reduces performance.上面意思是:一定要确保 block size/fragments ==1:8   否则性能有影响,
其实上面说的很清楚,你的文件很小那么到底是多大的?

修改方法:# disklabel /dev/da0s1
# /dev/da0s1:
8 partitions:
# size offset fstype
b: 1G * swap
c: 17767827 0 unused 0 0 # "raw" part, don't edit
d: 2G * 4.2BSD 2048 16384 28552
e: 2G * 4.2BSD
f: * * 4.2BSD有点混乱是把?看不清阿!
给你书,自己看看吧!
有点大,等我分包!





ulovko 发表于 2012-04-23 10:20

本帖最后由 ulovko 于 2012-04-23 10:27 编辑

这是2个分割包,解压方法(这样解压需要后续添加后缀名.pdf):
> cat FreeBSDa* >> FreeBSD.gz
> gzip -d FreeBSD.gz

fender0107401 发表于 2012-04-23 14:44

这本书,我是打印出来看的。

作者的写作风格相当的欠抽,颇有加菲猫只风范。 :wink:

muwanqing_cu 发表于 2012-04-23 17:25

多谢

ulovko 发表于 2012-08-17 20:58

回复 8# muwanqing_cu


    不客气 ^_^更多BSD相关书籍: http://bbs.chinaunix.net/forum-127-1.html

OpenBSD5 发表于 2012-08-28 21:28

我也有这方面疑惑:victory:
页: [1]
查看完整版本: 【已经解决】freebsd对小文件读写性能怎么样?