What database backend should I use for which databases?

Here's a brief summary of the three major database types:

  • Berkeley DB: Slow enumeration, fast random access, fast write, binary support. However, it has proved to be somewhat unstable and prone to locking problems.
  • Berkeley DB (no sync): Slow enumeration, fast random access, very fast write, binary support, but no guarantee of database durability; recent writes can be lost on crashes.
  • Skiplist: Proprietary Cyrus Format, fast enumeration, moderately fast write, moderately fast random access, binary support
  • Flat: Easy to maintain format, fast enumeration, very slow write, moderate random access, no binary support

And now the current recommendations (provided you are not having the Berkeley DB locking problem, in which case those entries become 'skiplist'):

Note that 'berkeley' in 2.2 is the same as 'db3' in 2.1. Note also that while the original message is quoted as using configure options, Cyrus 2.2.3 and later can support runtime configuration of the database choices (see imapd.conf(5)).

>    --with-duplicate-db=DB  use DB (db3, skiplist) as a backend
>                            for the duplicate delivery db

berkeley_nosync, since the worst part about losing this is that someone might get a vacation message twice. It also needs fast lookups.

>    --with-mboxlist-db=DB   use DB (flat, db3, skiplist) as a backend
>                            for the mailbox list

skiplist. You need fast list operations and good consistency in the event of a crash. Also, since the mailboxes database is a frequent source of lock contention, the speed of skiplist writes reduces the amount of time any process is waiting to use the file.

>    --with-seen-db=DB       use DB (flat, db3, skiplist) as a backend
>                            for the seen state (Default: flat)

skiplist. Writes happen very frequently to this file so the logging nature of skiplist can give good performance (it also helps to have good consistency here)

>    --with-subs-db=DB       use DB (flat, db3, skiplist) as a backend
>                            for the subscriptions list

flat. You need fast list performance, and write operations don't happen often to this database, and it might be useful to be able to modify it by hand. Also, flat files tend to be smaller than skiplist copies of the same data.

>    --with-tls-db=DB        use DB (db3, skiplist) as a backend
>                            for the TLS cache (Default: db3_nosync)

berkeley_nosync. for the similar reasons to the deliver database (you need fast lookups and if the db bites the dust, it's not a big deal).

The following are only available in 2.2

>  --with-pts-db=DB        use DB (berkeley, skiplist) as a backend
>                          for the pts cache

berkeley. The need for fast random access is key for the PTS database. This database may be able to be successfully used in a nosync mode, though writes tend to be semi-infrequent compared to the TLS db and the deliver DB.

>  --with-annotation-db=DB use DB (berkeley, skiplist) as a backend
>                          for the mailbox annotations

skiplist. annotations are frequently enumerated, so the random access benefits of berkeley can be lost, which makes this almost a toss up, slightly in favor of skiplist (Because it avoids the locking issues).

-- RobSiemborski? - 27 Aug 2003

Topic revision: r28 - 31 Aug 2005 - 15:21:06 - TWikiGuest
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback