Skip to main content

BLOB_PAGE_SIZE

Constant BLOB_PAGE_SIZE 

Source
pub const BLOB_PAGE_SIZE: u32 = 4096;
Expand description

Size in bytes of a blob page, the smallest unit in which storage is expected to read and persist Blob data.

Blobs created with DEFAULT_BLOB_LAYOUT begin their data on a blob-page boundary, so blob offset n lies in page n / BLOB_PAGE_SIZE.

Writing part of a page costs about as much as writing all of it, so writes that share a page are cheaper combined into one. Data read together is likewise cheaper when it stays within one page.

A host may use a larger power-of-two unit, such as a bigger memory page or filesystem block. Each such unit holds whole blob pages, so data within one page still shares a unit, but a structure larger than one page may straddle two of them.

Page alignment affects performance only: a write within one page can still tear (see Blob). The size is a fixed power of two, independent of the host’s memory page size, so layouts derived from it are the same on every host.