How the Retention Policy WorksLast Updated March 14, 2025
When you configure a replication, you
can enable the retention of up to 24 virtual machine replica instances from Multiple Points
in Time (MPIT).
After you recover a replicated virtual machine, the
retained replicas appear as snapshots of the virtual machine in the
vSphere
Client
. The list of snapshots includes
the retained instances according to the retention policy that you set, and the latest
instance. You can use the snapshots to revert to an earlier state of the recovered
virtual machine. You can configure the retention
of three instances per day for the last five days. The list of snapshots contains 15
snapshots and the latest saved instance of the virtual machine, or a total of 16
snapshots.
Administrators cannot configure the precise
time when replica instances are created, because the retention policy is not
directly related to the 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 one-hour RPO, so the latest
available replica instance can never reflect a state of the virtual machine that is
older than one hour. 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 an instance on the
target site. The replication instance reflects the state of the virtual machine at
the time the synchronization 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 synchronizations, 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
included when determining the number of instances to keep. When the age of the latest instance approaches the RPO
interval,
vSphere
Replication
starts creating a replica instance. The start time of
the sync operation is the time of the new instance. When the sync operation
completes, vSphere
Replication
assesses the existing replica instances to determine
which ones to keep:- The granularity of the retention policy is determined based on the replication settings. For example, if you configuredvSphere Replicationto keep three instances for the last one day, it means that you want to keep three replica instances that are relatively evenly distributed over 24 hours. This equals approximately one instance in an eight-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 eight 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 thatvSphere Replicationalways 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 granularity of the retention policy decrements the slot time 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 verify whether the RPO
settings creates 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 six replication instances per
day, the RPO period must not exceed four hours, so that vSphere
Replication
can create six instances in 24 hours.