Library Version 12.1.6.2

Chapter 14. Berkeley DB Slice Support
Prev |  | Next

## Chapter 14. Berkeley DB Slice Support

It is possible to improve the multiprocessor scaling of your DB databases by implementing slices. Slices cause your database records to be spread evenly across sub-environments and sub-databases using an internal hashing algorithm. Because your records are stored in separate physical environments and databases, this allows for better parallel processing support by spreading read and write workloads across separate, discrete processor cores.

To use slices, you must enable slice support for your library at compile time. You must also configure your environment and database to support slices. Optionally, you can also indicate which portion of your keys are slice-relevant; that is, which portions of your keys are used to determine which slice they belong to.

Be aware that use of slices has some ramifications when it comes to transactional processing of of multiple records within a single transaction. Because your records are distributed not just across physical databases, but also across physical environments, atomic operations can only be performed on records contained within the same physical slice.

### Note

Slices are only supported for databases using the BTree and Hash access methods. Also, slices are not supported for in-memory only databases, or for sub-databases.

### Note

Slices are not supported for Windows in this release.

## Enabling Slices

To create a sliced database, do all of the following:

1. Enable slices when you compile your DB library. Use the `--enable-slices` configuration option when compiling a *nix version of the library.

2. Configure slice support for your environment using the set_slice_count DB_CONFIG parameter. This parameter simply identifies the total number of slices you want to use. For best performance, the number of slices you configure should be equal to the number of cores available on your platform.

   Because using slices means that a sub-environment is created for each slice, it is sometimes necessary to perform configuration on a sub-environment basis. You can do this using the slice DB_CONFIG parameter.

3. Open your database so that it supports slices. Use the `DB_SLICED` flag with the DB->open() method to do this. Note that this flag is only required when you initially create the database. After that, using the database will be open with sliced support regardless of whether the flag is present.

Prev |  | Next
Ex_rep_chan: a Replication Manager channel example | Home | Slice APIs