m4_comment([$Id: intro.so,v 1.11 2006/11/13 18:05:02 bostic Exp $]) m4_ref_title(m4_db Replication, Replication introduction, introduction to @replication, transapp/faq, rep/id) m4_p([dnl m4_db includes support for building highly available applications based on replication. m4_db replication groups consist of some number of independently configured database environments. There is a single m4_italic(master) database environment and one or more m4_italic(client) database environments. Master environments support both database reads and writes; client environments support only database reads. If the master environment fails, applications may upgrade a client to be the new master. The database environments might be on separate computers, on separate hardware partitions in a non-uniform memory access (NUMA) system, or on separate disks in a single server. The only constraint is that all the participants in a replication group all be on machines of the same endianness. (We expect this constraint to be removed in a future release.) As always with m4_db environments, any number of concurrent processes or threads may access a database environment. In the case of a master environment, any number of threads of control may read and write the environment, and in the case of a client environment, any number of threads of control may read the environment.]) m4_p([dnl Applications may be written to provide various degrees of consistency between the master and clients. The system can be run synchronously such that replicas are guaranteed to be up-to-date with all committed transactions, but doing so may incur a significant performance penalty. Higher performance solutions sacrifice total consistency, allowing the clients to be out of date for an application-controlled amount of time.]) m4_p([dnl There are two ways to build replicated applications. The simpler way is to use the m4_db Replication Manager. The Replication Manager provides a standard communications infrastructure, and it creates and manages the background threads needed for processing replication messages. (Note that in Replication Manager applications, all updates to databases at the master environment must be done through a single DB_ENV environment handle, though they may occur in multiple threads. This of course means that only a single process may update data.)]) m4_p([dnl The Replication Manager implementation is based on TCP/IP sockets, and uses POSIX 1003.1 style networking and thread support. (On Windows systems, it uses standard Windows thread support.) As a result, it is not as portable as the rest of the m4_db library itself.]) m4_p([dnl The alternative is to use the lower-level "Base" replication API. This approach affords more flexibility, but requires the application to provide some critical components:]) m4_nlistbegin m4_nlist([dnl A communication infrastructure. Applications may use whatever wire protocol is appropriate for their application (for example, RPC, TCP/IP, UDP, VI or message-passing over the backplane).]) m4_nlist([dnl The application is responsible for naming. m4_db refers to the members of a replication group using an application-provided ID, and applications must map that ID to a particular database environment or communication channel.]) m4_nlist([dnl The application is responsible for monitoring the status of the master and clients, and identifying any unavailable database environments.]) m4_nlist([dnl The application must provide whatever security policies are needed. For example, the application may choose to encrypt data, use a secure socket layer, or do nothing at all. The level of security is left to the sole discretion of the application.]) m4_nlistend m4_p([dnl (Note that Replication Manager does not provide wire security for replication messages.)]) m4_p([dnl The following pages present various programming considerations, many of which are directly relevant only for applications which use the Base replication API. However, even when using Replication Manager it is important to understand the concepts.]) m4_p([dnl Finally, the m4_db replication implementation has one other additional feature to increase application reliability. Replication in m4_db is implemented to perform database updates using a different code path than the standard ones. This means operations that manage to crash the replication master due to a software bug will not necessarily also crash replication clients.]) include(rep/m4.methods) m4_page_footer