When you configure a replication, you can enable the retention of up to 24 VM replica instances from Multiple Points in Time (MPIT).
For example, you can configure the retention of 3 instances per day for the last 5 days.
After you recover a replicated virtual machine, the retained replicas appear as snapshots of the virtual machine in the vSphere Web Client. The list of snapshots includes the retained instances according to the retention policy that you set, and the latest instance. By the example above, the list will contain 15 snapshots and the latest saved instance of the virtual machine, or a total of 16 snapshots. You can use the snapshots to revert to an earlier state of the recovered virtual machine.
Administrators cannot configure the precise time when replica instances are created, because the retention policy is not directly related to replication schedule and RPO. As a consequence, replications with the same retention policy might not result in replicas retained at the same time instants.
RPO Without Retention Policy
By default, vSphere Replication is configured to a 4-hour RPO. This means that the latest available replica instance can never reflect a state of the virtual machine that is older than 4 hours. You can adjust the RPO interval when you configure or reconfigure a replication.
When the age of the latest replication instance approaches the RPO interval, vSphere Replication starts a sync operation to create a new instance on the target site. The replication instance reflects the state of the virtual machine at the time the synchronisation starts. If no retention policy is configured, when the new instance is created, the previous instance expires and the vSphere Replication Server deletes it.
How RPO and the Retention Policy Combine
To save some of the replica instances that are created during RPO synchronisations, you can configure vSphere Replication to keep up to 24 instances per replication. The exact instances that vSphere Replication keeps are determined by applying a specific algorithm. Using this algorithm, the vSphere Replication Server tries to match each instance to a slot of the retention policy. Instances that do not match any slot expire and are deleted. If a slot contains more than one instance, the instances that do not match the retention criteria are also deleted. vSphere Replication always keeps the latest created instance and it is not taken into account when determining the number of instances to keep.
- The granularity of the retention policy is determined based on the replication settings. For example, if you configured vSphere Replication to keep 3 instances for the last 1 day, it means that you want to keep 3 replica instances that are relatively evenly distributed over 24 hours. This equals approximately 1 instance in a 8-hour interval, or the granularity of this retention policy is 8 hours.
- The time of the last saved instance is rounded down to the nearest slot time. If the granularity is 8 hours, the slot times are 0:00, 8:00, and 16:00.
- The instances that are between the nearest slot time and the last saved instance are traversed. Let us assume that the time of the last saved instance is 10:55. Following our example, the nearest slot time is 8:00 o'clock. Let us also assume that the RPO is 1 hour, and each sync operation takes 5 minutes to complete. Between 8:00 o'clock and 10:55, the slot contains an 8:55 instance, and a 9:55 instance.
- The earliest instance that is newer than the nearest slot time is saved, and the rest of the instances in this slot are deleted, except for the latest created instance that vSphere Replication always keeps. Following our example, the 8:55 instance is saved, and the 9:55 instance is deleted. The 10:55 instance is the latest created instance, so it is also saved.
- The slot time is decremented by the granularity of the retention policy and a check is performed for the earliest instance between the beginning of the current slot and the beginning of the previous slot. If the slot contains expiring instances, they are deleted.
- The number of slots that contain saved instances is analyzed. If the number of slots with saved instances is higher than the number of slots determined by the retention policy, the oldest saved instance expires and is deleted. The last saved instance is not included in this count. In our example, if we had an instance saved for the interval 8:00 - 16:00 o'clock of the previous day, that instance would be deleted.
The number of replication instances that vSphere Replication keeps depends on the configured retention policy, but also requires that the RPO period is short enough for these instances to be created. Because vSphere Replication does not check whether the RPO settings will create enough instances to keep, and does not display a warning message if the instances are not enough, you must ensure that you set vSphere Replication to create the instances that you want to keep. For example, if you set vSphere Replication to keep 6 replication instances per day, the RPO period should not exceed 4 hours, so that vSphere Replication can create 6 instances in 24 hours.