Reserving Storage Space

.NET:

configuration.ReserveStorageSpace(byteCount)

Advantage

The allocation of a fixed number of bytes at one time makes it more likely that the database will be stored in one chunk on the mass storage. Less read/write head movement can result in improved performance.

Effect

ReserveStorageSpace setting reserves an additional space (byteCount) in a database file.

The functionality of this setting depends on the context:

  • global context: new database files will be created with an additional amount of bytes reserved;
  • ObjectContainer context: each call to reserveStorageSpace will allocate an extra space in the database file.

Note: Allocated space will be lost on abnormal termination of the database engine (hardware crash, VM crash). A Defragment run will recover the lost space. For the best possible performance, this method should be called before the Defragment run to configure the allocation of storage space to be slightly greater than the anticipated database file size.

Alternate Strategies

An alternative strategy can be to use MemoryIoAdapter:

.NET: 

MemoryIoAdapter adapter = new MemoryIoAdapter();

configuration.Io(adapter);

You can control the growth of the memory file by:

.NET: 

adapter.GrowBy(100);

And you can control the size of the file on disk using RandomAccessFile API. For more information see MemoryIoAdapter.