Skip to content

Choosing a Chunk Size

The chunk is the unit of everything in flexBlock: a fixed-size span of the device that is one object in the bucket and one slot on the cache device. You choose its size once, when you create the volume, so it is worth a moment’s thought.

CommandFlagDefaultMeaning
init--chunk-size <1M|2M|4M|8M>2MUnit of caching and storage, one object and one slot each. Fixed for the volume’s life.
Terminal window
sudo flexblock init --chunk-size 1M --device-size 2T
  • Caching. The cache holds whole-chunk slots. A read miss fetches one chunk object from the bucket.
  • Object storage. Each chunk is one object, overwritten in place by every flush. A small write to a chunk eventually uploads the whole chunk.
  • Largest I/O. The device advertises the chunk size as its optimal and maximum I/O size, so filesystems align to it without being told.
  • Memory. In copy mode the I/O buffer pool is sized by the chunk, so a larger chunk costs more RAM despite needing fewer slots. See Memory.
Smaller chunks (1 MiB)Larger chunks (4 or 8 MiB)
Less write amplification for random I/OBetter sequential throughput and read-ahead
More objects in the bucket and more slot metadataFewer objects and less slot metadata
Smaller copy-mode buffer poolLarger copy-mode buffer pool
WorkloadChunk size
General-purpose filesystems2 MiB (the default)
Random-heavy databasesConsider 1 MiB
Sequential archivesConsider 4 or 8 MiB

The chunk size also sets the default queue depth (--queue-depth auto is 64 for 1 MiB chunks and 32 above), and the device size must be a multiple of it.

You can check the chunk size of a serving volume with flexblock show or the flexblock_chunk_size_bytes metric.