Swap space

A swap space is used to prevent OOM errors. If data persistence is not enabled, eviction can create data loss for our application. However, if we don't want to enable native or third-party persistence, we can configure a physical disk location to swap data from RAM to disk. If the swap path is configured and Ignite cannot allocate any more pages, the OS swaps data from RAM to the swap location. We need to configure DataStorageConfiguration's maxSize greater than the RAM size and set swapPath to enable OS data swapping.

The swap space data is available as long as the node is active. Once the node shuts down, the data is lost. We should never consider swap space as replacement to data persistence. You cannot enable both the swap path and the eviction policy.

The following code snippet enables data swapping for a data region:

DataRegionConfiguration region1 = new DataRegionConfiguration();
region1.setName("region1");
region1.setSwapPath("D:\ignite\swap");
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.36.38