Managing How Data is Written to Disk

You can configure GemFire XD to write immediately to disk and you may be able to modify your operating system behavior to perform buffer flushes more frequently.

Typically, GemFire XD writes disk data into the operating system's disk buffers and the operating system periodically flushes the buffers to disk. Increasing the frequency of writes to disk decreases the likelihood of data loss from application or machine crashes, but it impacts performance.

Modifying Disk Flushes for the Operating System

You may be able to change the operating system settings for periodic flushes. You may also be able to perform explicit disk flushes from your application code. For information on these options, see your operating system's documentation. For example, in Linux you can change the disk flush interval by modifying the setting /proc/sys/vm/dirty_expire_centiseconds. It defaults to 30 seconds. To alter this setting, see the Linux documentation for dirty_expire_centiseconds.

Modifying GemFire XD to Flush Buffers on Disk Writes

You can have GemFire XD flush the disk buffers on every disk write. Do this by setting the system property gemfire.syncWrites to true at the command line when you start your GemFire XD member. You can modify this setting only when you start a member. When this property is set, GemFire XD uses a Java RandomAccessFile with the flags "rwd", which causes every file update to be written synchronously to the storage device. This only guarantees your data if your disk stores are on a local device. See the Java documentation for java.IO.RandomAccessFile.

Configure this property when you start a GemFire XD member:

gfxd server start -J-Dgemfire.syncWrites=true