ZeroNet
ZeroNet copied to clipboard
Average file size in Zeronet directory (alot of 1 and 8 kilobyte files)
Interesting Linux command can show the file size distribution in the ZN directories:
find /path/of/zeronet/ -type f -print0 2>/dev/null| xargs -0 ls -l 2>/dev/null| awk '{ n=int(log($5)/log(2)); if (n<10) { n=10; } size[n]++ } END { for (i in size) printf("%d %d\n", 2^i, size[i]) }' | sort -n | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) } } { a[1]=$1; a[2]=0; human(a); printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) }'
1k: 403007
2k: 33644
4k: 48356
8k: 155711
16k: 62305
32k: 52709
64k: 47308
128k: 44223
256k: 35698
512k: 32049
1M: 34376
2M: 22291
4M: 38327
8M: 8134
16M: 2448
32M: 1346
64M: 1948
128M: 1438
256M: 379
512M: 276
1G: 124
2G: 3
Which makes me think what should be the optimal block size of the HDD's filesystem.
Btw. the ZFS filesystem has option to automatically place files smaller than certain size to special, usually fast SSD drive and rest keep on slow large capacity HDD: https://forum.level1techs.com/t/zfs-metadata-special-device-z/159954 zpool add zpoolname special mirror /dev/nvme0n1 /dev/nvme1n1 mirror /dev/nvme2n1 /dev/nvme3n1 zfs set special_small_blocks=64K zpoolname (i am guessing that it works only on newly added files though)