what the value object is, just that it is stored using the given key. These
databases have no schema. The contents might be vastly different from one
another in type, size, domain, and so on. It is the client, the application that
uses the database, that is required to know about the value (what it is and the
context in which it can be used). The database merely stores it using a key,
knows the key/value pair, and serves the value when requested using its key.
Key/value stores are great for things like contents of a website shopping cart,
user preference lists, a post in a social media site. Think of things that are not
vital, things that might be useful but that will not cause problems if lost. You
would not want to use this for credit card information, personal identification,
health records, and such. You would want it for high-traffic sites that need to
make sure that a local user has quick and accurate access to the information
but where the information can take time to replicate to other database nodes
or where it might not require replication across nodes at all, or you might use
it where there is heavy access to the database itself but where users are not
necessarily using the same data concurrently.
Berkeley DB
Berkeley DB was originally created at the University of California, Berkeley,
to create a disk hash table that worked better than an existing solution while
also helping the university clean up its free UNIX version called BSD by
removing code inherited from AT&T. Several years later, Netscape asked the
developers to add some desired features to make Berkeley DB more useful to
them. This resulted in spinning off Berkeley DB from the university to a
company founded for this purpose called Sleepycat Software, which headed
development for many years. As of the purchase of Sleepycat Software in
2006, Berkeley DB is now owned by Oracle.
Although it is listed under key/value stores, this is not the only way to interact
with a Berkeley DB database. Support also exists for using SQL and Java.
Interaction is accomplished using an application programming interface
(API). Berkeley DB is very fast and very small. As a result, it can be found
running on large-scale systems and embedded within applications and even
running on mobile devices.
Berkeley DB is easily the most mature database mentioned in this chapter and
is most notable for its use in many well-known software projects, including
Subversion, Postfix, and OpenLDAP. It was even included as a data storage
backend for MySQL prior to MySQL 5.1.