February 20, 2013

On-Demand File Replication


replication serviceBesides the new replica filtering features, another improvement in the 2013.1 release makes Perforce replication even more flexible: on-demand content replication. In this mode, a Perforce replica only fetches file content when that content is requested by a user.

On-demand file replication is very helpful in two cases. First, if you are setting up a warm spare instance, you may wish to replicate the database but have the replica share the file archives with the main server using a SAN or other shared file system.

Second, you may be supporting a remote site with a small user base that only needs a few files from several parts of the repository. In this case, it may be more efficient to let the replica pull the files as users need them. If the users at the remote site have a predictable set of files they need, you can create a workspace that includes these files and sync that workspace nightly. That way the replica will be up to date when the team arrives in the morning. You'll notice a lot of similarity to proxy behavior in this case.

So how do you configure a replica for on-demand file transfer? As part of the replica configuration you set two configurables that specify how the replica's database and archives can be used. For example, a normal read-only replica has a full read-only copy of both the database and archives. It would be configured using:

  • db.replication=readonly
  • lbr.replication=readonly

To turn on on-demand file transfer mode, just set lbr.replication=ondemand in 2013.1. For releases 2013.2 or later, setting the option to lbr.replication=cache would enable the replica to purge archive files when p4 obliterate commands are replicated. Of course you wouldn't schedule any file transfer p4 pull -u threads for the replica.

If on-demand file transfer fills a need in your environment, grab the latest release and give it a try!