The id-system configuration applies to the embedded- and the server-mode of db4o. There are tree different id-systems-available. All the id system configuration is accessible via the id-system-property on the configuration-object.
Note that you cannot change the id-system for an existing database. You need to defragment the database in order to change the id-system.
The id-system is responsible to mapping a object id to the physical location of an object. This mapping can have significant impact on the performance.
This setting uses a stack of two BTree's on top of an InMemoryIdSystem. This system is scalable for a large number of ids.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.IdSystem.UseStackedBTreeSystem();
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.IdSystem.UseStackedBTreeSystem()
This setting uses a single BTree on top of a in memory id system. This system works great for small databases. However it cannot scale for a large number of ids.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.IdSystem.UseSingleBTreeSystem();
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.IdSystem.UseSingleBTreeSystem()
This id-system keeps all ids in memory. While accessing the ids if fast, all ids have to be written to disk on every commit. Therefore it can be used only for tiny databases.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.IdSystem.UseInMemorySystem();
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.IdSystem.UseInMemorySystem()
This id system uses pointers to handle ids. Each id represents a pointer into the database-file. This makes the id-mapping simple. However since it's a pointer, you cannot change the location. Therefore this system leads to more fragmentation and performance degradation as the database grows.
This id system is here to ensure backward-compatibility. It's not recommended to use for new databases.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.IdSystem.UseInMemorySystem();
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.IdSystem.UseInMemorySystem()
It's possible to implement your own id system. You can pass an factory which creates your id-system implementation.
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.IdSystem.UseCustomSystem(new CustomIdSystemFactory());
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration() configuration.IdSystem.UseCustomSystem(New CustomIdSystemFactory())