Version 11.3.0
File allocation

File growth

It's faster on some filesystems to grow a file in chunks rather than to extend it a block at a time as new blocks are written. By configuring the wiredtiger_open functions file_extend value, applications can grow files ahead of the blocks being written.

error_check(wiredtiger_open(home, NULL, "create,file_extend=(data=16MB)", &conn));

The system calls used to extend files in chunks on some systems require locking across the system call, which may decrease performance. Before configuring a file_extend value, before and after throughput should be carefully evaluated.

File block allocation

By default, when file blocks are being reused, WiredTiger attempts to avoid file fragmentation by selecting the smallest available block rather than splitting a larger available block into two. The block_allocation configuration string to WT_SESSION::create can be set to first to change the algorithm to first-fit, that is, take the first available block in the file. Applications where file size is more of an issue than file fragmentation (for example, applications with fixed-size blocks) might want to configure this way.

session, "table:mytable", "key_format=S,value_format=S,block_allocation=first"));
int create(WT_SESSION *session, const char *name, const char *config)
Create a table, column group, index or file.
int wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *config, WT_CONNECTION **connectionp)
Open a connection to a database.