You are here: Tuning > Performance Hints > Increasing The Maximum Database File Size

Increasing The Maximum Database File Size


EmbeddedConfiguration configuration= Db4oEmbedded.newConfiguration();
DefragmentConfig defragConfig = new DefragmentConfig("database.db4o");


Increasing the block size from the default of 1 to a higher value permits you to store more data in a db4o database.


By default db4o databases can have a maximum size of 2GB. By increasing the block size, the upper limit for database files sizes can be raised to multiples of 2GB. Any value between 1 byte (2GB) to 127 bytes (254GB) can be chosen as the block size.

Because of possible padding for objects that are not exact multiples in length of the block size, database files will naturally tend to be bigger if a higher value is chosen. Because of less file access cache hits a higher value will also have a negative effect on performance.

A very good choice for this value is 8 bytes, because that corresponds to the slot length of the pointers (address + length) that db4o internally uses.

Alternate Strategies

It can also be very efficient to use multiple ObjectContainers instead of one big one. Objects can be freely moved, copied and replicated between object containers.