3

I have a folder full of email back-up files (from offlineimap). One such folder has 87k files, of which 68k are between 512-1024 bytes in size. (This one folder is pretty representative of the rest.) The whole size distribution looks like this:

Size bin    % by count  % by space
512         0.08%       0.00%
1024        77.37%      74.58%
2048        1.65%       1.62%
4096        3.92%       4.05%
8192        6.11%       6.78%
16384       3.68%       4.25%
32768       3.07%       3.66%
65536       1.77%       2.15%
131072      0.75%       0.92%
262144      0.36%       0.44%
524288      0.33%       0.41%
1048576     0.30%       0.37%
2097152     0.21%       0.27%
4194304     0.20%       0.25%
8388608     0.11%       0.14%
16777216    0.08%       0.10%

My question is: what is the best record size to use for this data? I would be tempted to think 1k but this is way smaller than the normal recommended values, and I am concerned about overhead from metadata.

I have read a few articles that touch on this, but have not reached any conclusions. For example, one article examines the storage efficiency of using record sizes smaller than the average file. His average minimum file size was 128k and he found that with compression, storage efficiency increased as block size increased from 512 to 128k, but he did not test block sizes larger than his files so the full trend is not clear.

Another good read was this reddit thread that describes the difference between record and block sizes, and goes into SSD performance tuning.

  • Just use 128k unless you have a specific reason not to. – ewwhite Jan 15 '17 at 16:13
  • You apparently did a reasonable amount of reading, but did you read the zfs(8) man page description of the recordsize property that you are contemplating changing? In particular: Use of this property for general purpose file systems is strongly discouraged, and may adversely affect performance. – a CVn Jan 15 '17 at 16:15
  • @MichaelKjörling I agree there might be adverse effects, thus the question :) – Alex Hirzel Jan 15 '17 at 16:22
2

I ended up doing what @ewwhite said and did a quick benchmark. My conclusion is that 128k is fine.

BlockSize   CompRatio   du-s
1           0           50747244
2           1           26001757
4           1           13487472
8           1.04        12690656
16          1.06        9560063
32          1.08        8011524
64          1.09        7872713
128         1.1         7822344
256         1.11        7804225
512         1.14        7799985
1024        1.16        7801688

enter image description here

  • Nice. You should mark this the answer. – ewwhite Jan 16 '17 at 1:07
0

I rarely change the record size on ZFS pools. The default of 128K is suitable for most workloads.

You can easily benchmark this at varying record sizes...

If storage performance is your concern, there are more opportunities to optimize elsewhere. Do you have details on the OS/hardware/requirements?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.