Replication Introduction
Access to this feature requires an active Software Asset Management (SAM) subscription. See Benefits of ‘Software Asset Management' Feature Line.
Background
In BBj 11.0 and higher, replication is the process of sharing information for the purposes of consistency between redundant resources. The purpose of replication is to improve reliability, fault-tolerance, or accessibility.
IMPORTANT: Replication requires exclusive access to the data files; replication jobs cannot be created if "Shared File Access" is set for the BBjServices configuration.
The BASIS File System and Database technology allows each user to create an endless variety of structures in their records and files. It is important that each user of the Replication System evaluate the impact of the replication on their production systems and the resulting replicated files. This technology is designed for both onsite and offsite backup systems as well as data warehousing and as an aid for part of any business continuation and disaster recovery plans. The plethora of ever-changing technologies on which these systems are deployed, make it impossible to benchmark or elaborate on particular use-cases, but BASIS believes that this technology will be a useful and integral part of most corporate file system and database strategies.
For Database Replication, select the primary database to replicate and specify the target machine information (must be running BBjServices) where the replicated database will reside. The replication wizard (shown below) will automatically populate a mirrored list of directories to replicate for the database. The wizard also allows for customizing with additional directories and/or files to be included in the replication job. Replication can start without any of the files or directories existing on the remote machine, but it could take a very long time for the replicated database to reach a synchronized state.
BASIS requires databases be handled as follows before starting a replication job:
- Copy all data files to the target machine.
- Have everyone stop using the source system for a brief moment.
- Shutdown BBjServices to Admin Only Mode and restart BBjServices.
- Use RSYNC to update the target data files, so that they match before starting the replication.
- Create/Start the replication job.
- Restart BBjServices in normal mode.
- Allow everyone back on the system.
Once a replicated database is configured, the primary database is required to keep the replicated database in sync. Therefore, if the access to the replicated database fails for any reason, the log file on the primary database will grow until it consumes all of the available disc space where the main machine is running. When the access to the replicated database is restored, the replicated database will "catch up" on all of the transactions that occurred while the access was disrupted and shrink the replication log back down to a manageable size.
BBj replication jobs operate at the file or directory level and can be configured to replicate to the same machine, or an entirely different installation of BBjServices on another machine on the other side of the globe. This power and flexibility opens up numerous possibilities for BBj administrators.
Types of Replication
Currently, there are two types of replication jobs: Database Replication and BBj Directory/File Replication. Each serves a unique purpose.
Database Replication
Database Replication makes it quick and easy to replicate an entire database to another location on the same machine, or a machine across the world, with just a few settings. All directories used by the database will be replicated and a new database will be created on the target machine - all automatically. The administrator can add additional directories to the replication job if there are other directories and files not directly referenced by tables or stored procedures. Any changes made to the files in the source database will also occur on the target database including: WRITE, WRITE RECORD, INSERT, UPDATE, DELETE, CREATE/DROP TABLE, etc.
BBj File Replication
By far, the most powerful type of replication is BBj File Replication. The administrator creates a replication job that contains a mapping of source files to target files. The target files can reside on the same machine or an entirely different installation of BBjServices. While the job runs, any changes made to any of the source files or directories (including all files in that directory as well as all sub-directories) will be made to the target files and directories. The target files and directories are read only while the replication job is running.
Synchronous vs. Asynchronous
Replication jobs also have a setting that determines whether they will run in synchronous or asynchronous mode and can also be changed during a running job.
- Synchronous mode means that any write operations made to source files or directories will not complete until all of the necessary replication has occurred.
- Asynchronous mode means that the write operation tells the replication engine what needs to be done, then continues on while the replication engine performs its necessary tasks.
Synchronous mode slows down write operations on data files since the write operation must wait until the replication task is complete. If the target is located on another machine over a slow connection, this could make a significant performance difference. Further, if there are multiple replication jobs replicating to multiple machines, then this could also cause performance issues.
Asynchronous mode, on the other hand, does not need to wait for the replication task to complete and therefore has much less impact on the performance of write operations. However, if write operations to source files occur very quickly, then the replication job has the potential to fall behind, leaving target files out of sync to some degree. Eventually, if the writing slows down on the source files, the target files may become completely in sync.
It is important to examine the needs of a project before choosing one over the other. If write speed is more important over real-time synchronization, then asynchronous is the best choice. However, if real-time synchronization is a must, then choose synchronous mode.