I have some very big binary files (>1TB each) with highly compressed data. I read very often some data chunks of about 300 bytes from these files. To do that I have the file opened in 7 threads at once and do read operations.
How does the disk cluster size correspond to this. When I read 300 bytes and the disk cluster size is set to 64KB, will .net read the whole 64KB instead the 300 bytes?
Is a small or a big cluster size better for this scenario?
I use FileStream with FileOptions set to FileOptions.RandomAccess.
Yes, you will read 64kb chunks off the disk. A smaller cluster size will provide you faster reads of small ranges. It has the risk of more file fragmentation (probably not a concern).
You can’t get much more throughput, though, by lowering the cluster size. In the time the disk has done the seek operation do get your data it could have read about 1MB of data. You are saving very little by going from 64kb to 4kb. You are saving about 1/20th of the time the disk seek took.