Altering When Buffers Are Flushed to Disk
You can configure Tanzu GemFire to write immediately to disk and you may be able to modify your operating system behavior to perform buffer flushes more frequently.
Typically, Tanzu GemFire 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. Your other option, which may give you better performance, is to use Tanzu GemFire’s in-memory data backups. Do this by storing your data in multiple replicated regions or in partitioned regions that are configured with redundant copies. See Region Types.
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
You can have Tanzu GemFire 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 Tanzu GemFire member. You can only modify this setting when you start a member. When this is set, Tanzu GemFire 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
To modify the setting for a Tanzu GemFire application, add this to the java command line when you start the member:
To modify the setting for a cache server, use this syntax:
gfsh>start server --name=... --J=-Dgemfire.syncWrites=true