前言
測試cephfs的寫入大量文件,通過mdtest寫入1K大小的文件1億個,每個目錄里面文件為1萬,目錄總數為1萬,總文件數目就為1億了
寫入的命令
mdtest -C -F -L -z 4 -b 10 -I 10000 -d /mnt/1yi/ -w 1024
- -C 只創建
- -F 只創建文件
- -L 只在葉子層目錄創建文件
- -z 目錄深度層級為4
- -b 每個樹下面子目錄為10
- -I 指定目錄里面的文件數目
- -w指定文件大小為1K
每層的目錄數目
1,10,100,1000,10000
統計寫入的情況
通過擴展屬性統計
[root@lab101 #test-dir.0]# getfattr -d -m ceph.dir.* mdtest_tree.0/
# file: mdtest_tree.0/
ceph.dir.entries="10"
ceph.dir.files="0"
ceph.dir.rbytes="1000307712"
ceph.dir.rctime="1600762346.09161429944"
ceph.dir.rentries="1001670"
ceph.dir.rfiles="990559"
ceph.dir.rsubdirs="11111"
ceph.dir.subdirs="10"
參數解析
ceph.dir.entries 指定目錄下面文件和目錄總個數
ceph.dir.files 指定目錄下面沒有文件
ceph.dir.rbytes 指定目錄下面的文件總文件容量為1000307712 bytes
ceph.dir.rctime 目錄的訪問時間戳
ceph.dir.rentries 目錄下面的文件和目錄的總個數
ceph.dir.rfiles 目錄下面的文件的個數
ceph.dir.rsubdirs 目錄下面的子目錄總個數(遞歸統計)
ceph.dir.subdirs 目錄下面的子目錄的個數(一層的)
mds內存占用統計
200萬文件 內存3.3G
300萬文件 內存4.3G
統計腳本
[root@lab101 ~]# cat getmdsmem.sh
#! /bin/sh
while [ 2 > 1 ]
do
mem=`ps -p 49808 -o rsz|tail -n 1`
file_num=`getfattr -d -m ceph.dir.* /mnt/1yi/|grep ceph.dir.rfiles|cut -d "=" -f 2|cut -d "\"" -f 2`
date=`date "+%Y%m%d%H%M%S"`
echo $date,$file_num,$mem>>/opt/recode.txt
sleep 2
done