GCP: Does a regional disk's writes replicate across zones before an OS fsync?

485 Views Asked by At

https://cloud.google.com/compute/docs/disks#repds

Regional persistent disks provide synchronous replication for workloads that might not have application-level replication.

If the VM crashes after disk writes but before an fsync, is that data lost?

When is a disk write replicated to the replica disk in another zone?

Note: The VM OS is the default Ubuntu, with the default file system.

1

There are 1 best solutions below

0
On

Data that are written to the regional persistent disk are replicated to another zone.

Answering your question - after the fsync.

Whatever remains in OS or your application buffer is not replicated - hence in the event of an zonal outage this data will be lost so you have to put that into cosderation when you design you application.

Quoting @John Hanley:

The exact answer depends on how you (the application) have writes setup (write-through or write-behind). Typically, Linux caches writes in memory and periodically flushes the cache to disk (fsync is one way)