Durability, backups and recovery#
This page covers how Live Edit protects session and layer state, how to turn on backups, and what to do when the backing store is lost or when the service holds itself for disaster recovery. It assumes a backing store set up as in Backing store and the service identity from Service identity.
Two protection layers#
Store persistence (Valkey AOF; the transaction log on Amazon MemoryDB) protects live state across store restarts and failovers.
Checkpoints back up each edited layer and session to a separate backup store, so the service can rebuild them after the store’s whole dataset is lost.
Run both in production. Together they give four modes:
Mode |
Loss on a store restart |
Loss when the store’s data is gone |
At startup |
|---|---|---|---|
Persistence on, checkpoints on (recommended) |
About 1 s with AOF; none on MemoryDB |
Edits since the newest backup |
Allowed |
Persistence on, checkpoints off |
About 1 s with AOF; none on MemoryDB |
All sessions and layers |
Allowed |
Persistence off, checkpoints on |
Edits since the newest backup |
Edits since the newest backup |
Allowed |
Persistence off, checkpoints off |
All sessions and layers |
All sessions and layers |
Refused (warning only on managed stores) |
Each edited layer is backed up within checkpoint.interval seconds (default 60) of its previous backup, or sooner once idle for checkpoint.quiesce seconds (default 30).
At the defaults, expect to lose up to about 70 seconds of edits; failed or delayed backups lose more, so monitor them (Monitoring).
Choose checkpoints without persistence only when your store cannot persist, such as Azure Managed Redis with active geo-replication.
The startup durability check#
A replica refuses to start, and its pod restarts in CrashLoopBackOff, when checkpoints are enabled with the Disabled adapter or are off while the store reports persistence off.
The chart defaults to the first case (checkpoint.enabled: true, checkpoint.adapter: Disabled), so a fresh install starts only once you choose a mode.
The log shows:
live-edit refuses to start with no durability configured: enable Valkey AOF, enable LIVE_EDIT_CHECKPOINT_ENABLED with a configured adapter, or both
Warning
Managed stores (Azure Managed Redis, Amazon MemoryDB, Amazon ElastiCache) do not let the service read their persistence setting.
With checkpoints off, the service there logs a warning containing could not verify Valkey AOF state and starts, even with no protection.
Confirm persistence in the provider’s console, or run checkpoints.
Enable checkpoints#
Choose the adapter:
StorageApi, for production: backups go to a Storage service prefix that every replica shares.LocalDisk, only for a single replica with a persistent volume atcheckpoint.localDiskPath. Per-pod or container disks are not a shared backup store.InMemoryis lost on restart; never use it for recovery.
The checkpoint values for each adapter:
# StorageApi
checkpoint:
enabled: true
adapter: StorageApi
storageApiEndpoint: "{STORAGE_ENDPOINT}" # https://storage.example.com
basePath: "{BACKUP_PREFIX}" # https://assets.example.com/live-edit-backups/
---
# LocalDisk
checkpoint:
enabled: true
adapter: LocalDisk
localDiskPath: "{VOLUME_MOUNT_PATH}"
Create the values file shows them in a complete values file.
Give each deployment its own backup prefix.
With StorageApi, also set up Access to the backup store.
To rely on store persistence alone, set checkpoint.enabled: false instead.
Pacing and retention settings: Checkpoint settings.
Incremental backups and retention#
Between full backups the service can write smaller incremental backups, which recovery uses automatically.
They are on by default; checkpoint.tail.enabled: false keeps full backups only.
checkpoint.retainGenerations (default 2) sets how many recovery points each layer keeps.
A full backup and the incremental backups on top of it count as one.
A restored layer takes a fresh full backup that uses one slot, so to keep N recovery points through a restore, set N + 1.
The service deletes its own old backups and cleans up partial ones. Do not delete backup objects by hand or apply bucket lifecycle rules to the prefix: either can remove a backup that a recovery point still needs.
Backups of large values#
Each replica copies every uploaded large value to the backup store separately, shortly after the upload.
A copy is skipped when large uploads arrive faster than the backup store accepts them, when the backup store refuses it, or when a replica stops or crashes before sending it.
Editing is unaffected, and the value stays in the backing store.
The service repairs a skipped copy from the backing store: with StorageApi at its default timeouts normally within about 3 to 8 minutes, and with LocalDisk within about 1 to 6 minutes.
If the backing store’s data is lost before then, requests that open a restored layer using that value fail with INTERNAL until a user uploads the value again or replaces the attribute value that uses it.
After you lower layer.maxSize, a large value uploaded under the higher limit may never be copied; restore layer.maxSize, or raise resources.limits.memory until live_edit_checkpoint_ext_mirror_budget_bytes exceeds the value’s size (Are large values backed up?).
After the service restores from backups, or after you change checkpoint.storageApiEndpoint, checkpoint.basePath or checkpoint.localDiskPath, it checks every large value once and uploads the ones the backup store lacks, which after a change of location is usually all of them.
Watch live_edit_checkpoint_ext_backup_owed and add the LiveEditLargeValueBackupsMissing rule (Backup alert rules); live_edit_checkpoint_ext_mirror_dropped_total by reason shows why copies are skipped (Are large values backed up?).
Access to the backup store#
StorageApi writes with the service’s own identity, which needs the token provider from Configure the token sidecar; the chart refuses to render StorageApi without it.
Grant that identity read, list, write and delete under the backup prefix.
Those rights must include listing {BACKUP_PREFIX}/.live-edit/sessions/ and checking whether a stored file exists, which the disaster-recovery Jobs rely on.
The Jobs also write, list and delete a small test file under {BACKUP_PREFIX}/.live-edit/dr-canary/; one left by a stopped Job is harmless, and you can delete it.
If your Storage service stores its files in an S3-compatible service other than Amazon S3, that service must list objects with strong consistency: a listing started after an upload succeeded includes that upload.
Network access to the backup store#
Restores and small backups use checkpoint.storageApiEndpoint alone.
Backups above the Storage service’s upload size limit (2 MiB by default) go to a short-lived blob-storage URL it returns, usually on another host.
Before enabling checkpoints, confirm that the Live Edit pods can resolve that host, trust its TLS certificate, and reach it through your network policies and egress rules; allowing the Storage service does not allow its blob storage.
A missing route shows as small backups succeeding while large ones never land, with live_edit_checkpoint_adapter_redirect_total{verb="put",outcome="target_failed"} rising steadily.
Validate backups#
Before relying on recovery:
Edit a small disposable layer and a large one (several MiB), and wait a minute. Confirm that
live_edit_checkpoint_writes_total{result="success"}increases,result="error"does not, and objects appear under the backup prefix. One exception is expected on a new backup prefix:kind="counters_sidecar"errors can rise after the first layer is created for up to about 15 minutes, or as long as your Storage service caches “not found” answers, then stop by themselves. AWARNcontainingthe post-write checkpoint listing is emptymeans the service writes backups but cannot list them; see Backups behind or stopped.Note the IDs of a few sessions and their layers’ content, then copy the backup prefix to a new prefix with your Storage tools.
Install a second release in its own namespace, with an empty backing store and
checkpoint.basePathset to the copy. Grant the test release’s service identity read, list, write and delete on the copied prefix. Never point it at the production prefix: its own backup clean-up would delete production backups.Through the test release, open each noted session by its ID and its layers with a fresh client. Recovery works when
live_edit_checkpoint_recovery_attempts_total{result="restored"}rises on the test release and the content matches what you noted.Compare the recovery time and the recovered content with your requirements, then uninstall the test release.
When the backing store is lost#
With checkpoints on, the service restores lost sessions and layers from their backups as clients request them.
When the service holds itself for disaster recovery instead, follow When the service is held.
Open streams end with UNAVAILABLE and clients reconnect.
The first request for a missing session or layer rebuilds it from its newest backup; the layer keeps its identity, but its content goes back to that backup.
Warning
A layer whose content is over the 99,999-entry limit of one upload (the client API guide’s Deltas that are too large) is not rebuilt from its backup.
Requests for it fail with INTERNAL, and a replica usually logs a WARN containing a backup over the per-delta entry limit cannot be restored on access, with the layer’s object_id.
To bring the layer back, a user who still has its content creates the layer again, split across several uploads; otherwise the service cannot recover it.
A layer created again this way is still over the limit, so its backups still cannot rebuild it; to have it protected, split its content into layers of fewer than 99,999 entries each.
Creating it again replaces the layer, and the service then deletes the old layer’s backups and the large values no other backup uses; to keep them, first copy the files under {BACKUP_PREFIX}/.live-edit/layers/ whose names start with {OBJECT_ID}., and {BACKUP_PREFIX}/.live-edit/ext/.
Bring the backing store back, empty, with the same requirements and connection settings (Backing store).
Wait for the pods to report ready: readiness drops while the store is unreachable and returns when it answers.
Open a known session by its ID and confirm its layers’ content.
live_edit_checkpoint_recovery_attempts_total{result="restored"}counts rebuilt sessions and layers;result="error"should stay flat, except for layers over the entry limit (warning above). For the next day, watch the signals in After a disaster-recovery restore.Ask users to reopen their sessions by ID and reload the recovered layers, as below, before they resume editing.
Important
Only a request that names a session’s ID restores it. Until each session has been opened by its ID, session lists are empty and the session looks lost. Do not create a replacement session with the same name: that makes a new, separate session, and the original stays recoverable by its ID.
To find the IDs, list {BACKUP_PREFIX}/.live-edit/sessions/ with your Storage tools: each {SESSION_ID}.json file there is one backed-up session and holds its name and base path.
Give users the IDs of their sessions, or have them reopen sessions from links or history their client keeps.
Warning
After a recovery, a client that reconnects can keep content newer than the backup, including prims created after it. Reload each recovered layer from empty client state rather than resuming the client’s cached state. Rehearse this reload with your clients during recovery testing.
With checkpoints off, the sessions and layers are gone and clients must create them again.
When the service is held#
When the backing store loses data, the service can hold itself for disaster recovery: every replica refuses calls until the data is restored or its loss accepted (Held for disaster recovery).
Only a disaster-recovery Job ends the hold, and you start one with a change of dr values.
Find the incident: each replica logs an
ERROR,the fleet is held for disaster recovery, whoseincidentfield holds the incident ID, such as20261013t1708-a3f9.Choose the action:
With a backup store, restore first (Run the restore Job); a restore discards nothing.
Accept the loss when a restore stays held on something no backup can supply, and always when no backup store is configured (Accept a loss).
Check what a Job needs:
Kubernetes 1.29 or later: with an action set, the chart refuses to render for an older cluster.
Room in the namespace for one more pod of the Job’s resources,
dr.resources, which default to the service’sresources(Resources for the restore Job).The service’s network access to the backing store and the backup store. A Job’s pod carries
app.kubernetes.io/component: dr-job, notserver, so a network policy that selects server pods does not apply to it. If your namespace denies egress by default, give pods with that label andapp.kubernetes.io/instance: {RELEASE}the service’s egress (Configure ingress).If a service mesh in the namespace injects its proxy as a regular container, exclude pods labelled
app.kubernetes.io/component: dr-jobfrom injection, or use the mesh’s native-sidecar mode. Otherwise the proxy keeps the Job’s pod running after the Job’s work ends, so the Job neither completes nor fails.
For the values change that starts or stops a Job:
Change only
drvalues in it. Setting or clearing them changes neither the Deployment nor its settings, so nothing restarts. Never combine an action with a chart, image or settings upgrade, and never apply one during a rollout.Set one action at a time: setting both fails the render.
The chart’s smoke tests do not run while an action is set. With
tests.enabled: true, pass--no-hooksto an upgrade that clears every action while the service is still held, such as one that stops a Job. Otherwise the smoke tests run against the held service and fail the upgrade, and with--atomicthe rollback creates the Job again.Never pass
--wait-for-jobs. Helm would wait for the Job to finish, which can take longer than the upgrade’s timeout, and would wait out the timeout on a Job that failed at once; with--atomic, the rollback then deletes the Job and its log.With
--atomic, first delete any server pod that is not ready: if the upgrade’s wait times out on it, the rollback deletes the Job.
Run the restore Job#
Merge into your values file, with the incident from the
ERRORline:dr: restore: incident: "{INCIDENT}"
Apply it:
helm upgrade live-edit-service ./live-edit-service \ --namespace storage-apis -f live-edit-values.yaml
Find the Job by its labels, then follow its log:
kubectl get jobs -n storage-apis \ -l app.kubernetes.io/component=dr-job,app.kubernetes.io/instance=live-edit-service kubectl logs -f job/{JOB_NAME} -n storage-apis -c live-edit-service
For a release named
live-edit-servicethe Job islive-edit-service-dr-restore-{INCIDENT}, with-{ATTEMPT}appended whendr.restore.attemptis set.Verify:
the Job shows
1/1completions;its log’s last line starts
the restore Job cleared the hold for incident;live_edit_dr_heldreads0on every replica, and each server pod has restarted once.
Then follow After the hold clears. If the Job fails, see Read a Job’s log.
What a restore costs:
The Job writes nothing until a quiet period after the hold began has passed: about 3.5 minutes with
StorageApiat the default timeouts, and about 2 minutes otherwise.With
StorageApi, before it trusts that a backup or large value is missing, it waits untilcheckpoint.notFoundCacheSecs(default900seconds) after the quiet period. While it waits it logsINFOlines startingwaitingthat give the seconds left and what it waits for; a wait to plan again follows anINFOstartingthe restore plan saw.The restore takes longer the more layers and data the backups hold. With 4 CPUs and the backing store on the same network, one layer of about 194,000 specs, about 50 MB of backups, takes on the order of 45 seconds to restore.
When the hold clears, every replica exits within seconds and restarts once, and clients reconnect.
Resources for the restore Job#
The restore and accept-loss Jobs need a memory limit of at least 3,282 MiB, or 2,687 MiB with incremental backups off or no backup store.
dr.resources sets them: each key it sets replaces the service’s resources value, so limits: {memory: 8Gi} keeps the service’s CPU, and an unset memory request is 70% of the limit.
Below the minimum, a Job exits with code 2 before connecting to anything, logging a configuration error: line that names the smallest limit and dr.resources.limits.memory.
Any other setting refused at startup also exits 2; Kubernetes fails the Job at once rather than retrying it.
Each Job restores up to checkpoint.restoreParallelism layers at once (default 8).
If it cannot read its memory limit, it restores one layer at a time and logs a WARN starting the {MODE} Job could not read a memory limit ({MODE}: restore or accept-loss).
If a Job runs out of memory, raise dr.resources.limits.memory and set a new attempt: a Job keeps the resources it was created with.
Lowering checkpoint.restoreParallelism instead changes the service’s settings, so its replicas restart, held.
More CPU in dr.resources shortens the restore of a large store, since a Job writes several layers at once.
Read a Job’s log#
A Job’s log is the record of its run: its metrics are readable only on its pod while it runs.
When a Job fails at once, kubectl describe job {JOB_NAME} -n storage-apis shows the exit code, such as failed with exit code 3.
Exit code |
Meaning |
Kubernetes |
Do |
|---|---|---|---|
|
The hold cleared, was already cleared, or the service was not held |
Completes the Job |
|
|
The service stays held; the last |
Fails the Job at once |
See below |
|
The hold names a different incident; the Job cleared nothing |
Fails the Job at once |
Set the action’s |
|
A refused configuration, before the Job connected: a memory limit below the minimum, or a setting the service refuses at startup |
Fails the Job at once |
Fix the setting the |
|
A failure a retry may fix: another restore or accept-loss Job is running, a backing-store or backup-store fault, the backing store failed over, restarted or moved data between shards while the Job read it, or the Job was stopped |
Retries it, up to |
If the retries run out, fix what the last |
Any other code, such as 137 for a pod killed for running out of memory, is retried like 1.
A pod lost to an eviction or a node drain is retried without counting against dr.backoffLimit.
If the store moves data between shards, scales, fails over or restarts while a restore or accept-loss Job reads it, the Job usually detects it, stops, and Kubernetes re-runs it, up to dr.backoffLimit times.
It cannot detect every such change, so let store changes finish before starting a restore or accept-loss Job, and make no store change while it runs.
A restore that stays held ends with an ERROR containing exits 3:
the restore Job restored everything it could and recounted the references of the large values, butcounts what remains, and theWARNlines before it name each item. For items the backup storecould not confirm, it answered with an error rather than “not found”: fix the service identity’s access to it (Access to the backup store), then run the restore again with a newattempt. For layers, sessions or large values that no backup can supply, accept the loss.A line containing
cannot be shown tomeans the Job could not confirm which backing-store server answered its reads, so it trusts none of them; open a support case with the line.Any other exit-3 line names its cause; grant a backup-store permission it names, otherwise open a support case with the line.
The restore’s summary, logged whether or not the service stays held:
per restored layer, an
INFOstartinglayer {LAYER} of session {SESSION_ID} (object {OBJECT_ID}): restored from backup generation, with where the layer resumes and how many of its large values are in the backing store or fetched from the backup store on their first read;a
WARNcontainingis restored from an older backupfor a layer whose newest backup could not be used, so it lost more edits;a
WARNcontainingno session backup; it is not restoredfor a session nothing can restore;a totals line starting
the restore Job's summary:, which counts the large values only the backup store holds: each is fetched the first time a layer that uses it is opened after the restart, which makes that open slower (what to expect).
Accept a loss#
Accept-loss restores everything a backup can supply, as a restore does, then permanently discards what none can, and ends the hold. It discards:
layers with no usable backup, removed from their sessions;
sessions with no record in the backing store and no usable session backup, with every layer they name, complete ones included, and their session backups;
the attribute values and time samples whose large value is in no store.
It keeps backups no layer references. A layer whose only backups are full backups over the per-delta entry limit, written by an earlier release, is removed from its session, but its backups are kept; recovering it needs a support case.
Warning
Accept-loss cannot be undone, and its log is the only record of what it discarded. Save the log before the Job is deleted (After the hold clears).
Save the restore Job’s log, then clear
dr.restoreand merge into your values file:dr: acceptLoss: incident: "{INCIDENT}" confirm: "discard-lost-data"
The render fails without
confirm, with any other value, and with a confirmation left set whileincidentis not.Apply it, find the Job and follow its log as in Run the restore Job; it is named
live-edit-service-dr-accept-loss-{INCIDENT}. WithStorageApi, it reads nothing untilcheckpoint.notFoundCacheSecs(default900seconds) after the quiet period. It can therefore take up to 15 minutes longer than a restore; while it waits it logsINFOlines startingwaitingthat give the seconds left. Removing the values that are in no store takes longer on a large layer.Verify as for a restore; the log’s last lines start
the accept-loss Job's summary: discardedandthe accept-loss Job cleared the hold for incident.Have users reload each affected layer from empty client state; discarded layers and sessions no longer exist.
Items it cannot confirm lost.
When the backup store answers a read with an error rather than “not found”, the Job cannot confirm that item lost, so it discards nothing at all.
It still restores and recounts, then logs an ERROR starting the accept-loss Job restored everything it could and recounted the references of the large values, but discarded nothing and exits 3.
A layer or value of a session it discards goes with that session whatever the backup store answered.
Then, in order:
Fix the backup store’s access (the service identity, its permissions, the address) and run the Job again with a new
dr.acceptLoss.attempt.As a last resort, also set
dr.acceptLoss.confirmUnconfirmed: "discard-unconfirmed-data". The Job then discards those items too, although a backup may still hold them, and logs aWARNper item saying what it did. It leaves the backups of an object it cannot trace to a layer. For such an object, grant the identity read on its backups, or remove them by hand once the loss is accepted.
Read an accept-loss log#
An accept-loss log holds the restore’s lines, each naming the accept-loss Job, and these:
Level |
Line starts |
Meaning |
Do |
|---|---|---|---|
|
|
The restore is done; the discards start |
Nothing |
|
|
What it is about to discard |
Nothing |
|
|
A layer with no usable backup is removed |
Nothing |
|
|
A session with no record and no usable backup is removed, with its layers |
Nothing |
|
|
Values removed from one layer, with up to 100 prims and attributes that used them |
Have users upload again what they still have |
|
|
A layer of that name was created or replaced after the Job planned, so the Job left it |
Nothing |
|
|
A layer whose backups are over the per-delta entry limit is removed from its session; its backups are kept |
Open a support case with the line to recover it |
|
|
It skipped a full backup over the per-delta entry limit for an older one |
Nothing |
|
|
Only with |
Nothing |
|
|
What it discarded, before it ends the hold |
Save the log |
|
|
Exit 3: items it could not confirm lost; nothing discarded |
See Accept a loss |
|
|
Exit 1: a layer it was about to discard is complete, so another writer is active |
Find and stop the other writer, let the Job run again, and open a support case |
|
|
Exit 1: a defect in the Job; it discarded nothing |
Open a support case with the line |
|
|
Exit 1: a backing-store or backup-store step failed |
If the retries run out, fix that store, then set a new |
After the hold clears#
Save each Job’s log before anything deletes it, from every pod it ran, so a retried Job keeps its earlier pods’ lines:
kubectl logs -n storage-apis -l batch.kubernetes.io/job-name={JOB_NAME} \ -c live-edit-service --prefix --tail=-1 > {JOB_NAME}.log
Clear every
drvalue you set, and apply the change withhelm upgrade. Helm deletes the Job and its pod, and their log with them. A Job left in place makes a later upgrade to a new chart version or image, or one that changes a value the Job’s pod uses, such asresourcesorpodLabels, fail withfield is immutable, because a Job’s pod cannot change.Verify: the
kubectl get jobscommand in Run the restore Job lists no Job.
To run a Job again, after it failed or with different dr.resources, set a new dr.restore.attempt or dr.acceptLoss.attempt, such as 2.
The Job gets a new name, and Helm replaces the old Job with it.
To stop a running Job, clear its values, with --no-hooks if the smoke tests are on (When the service is held): Helm deletes it, the service stays held, and a later run continues from what it wrote.
Kubernetes deletes a finished Job, its pod and its log dr.ttlSecondsAfterFinished seconds after it finishes (default 604800, 7 days); 0 or null keeps it until you clear its values.
If the values are still set at a later helm upgrade, Helm creates the Job again; it acts only on its own incident’s hold, so once that hold has cleared it exits 0 and changes nothing.
See next#
Scaling: replica sizing, autoscaling and limits.