Configure Write-Through for Write-Behind Cache Operations
If the Write-Behind option is enabled, then all of the data source operations are queued up and performed in the background. There are multiple settings, which can be used to optimize the Write-Through provider to fulfill the user requirements.
Important
For Java, before deploying your JAR files, ensure that your Environment Variable for Java Home is set and have the appropriate JDK installed as discussed in the NCache Installation Guide.
Configure Write-Through for Write-Behind Cache Operations Using the NCache Management Center
Launch the NCache Management Center by browsing to http://localhost:8251 or
<server-ip>:8251
for Windows and Linux.In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache to which the query index will be added. Against the cache name, click on View Details.
Make sure that the cache is stopped.
This opens up the detailed configuration page for the cache. Go to the Advanced Settings tab and click on Backing Source in the left bar.
Configure a Write-Through provider as explained in Configuring Write Through Provider.
Once here, you can change or specify the values as per your application requirement(s).
Check the Enable Batching checkbox to perform all Write-Behind operations on the data source in bulk/batches. You can also configure the Batch-interval(s) and Operation-delay(ms) for the batching mode.
Change the value for Operations per second, to control how many Write-Behind operations will be performed on the data source in a second.
You can also configure the Failed operations queue limit. This queue is used to re-queue the failed operations and will be retried on the data source.
The Failed operations eviction ratio specifies the eviction ratio percentage to evict the most retried operations when the queue is full.
Once you have added Read-Through/Write-Through providers, deploy the providers through Deploy Backing Source Providers which requires the assemblies to be deployed over NCache.
- After applying all the changes, click on Save Changes.
Note
If there is a change in provider code, and you have to redeploy the provider, make sure to restart the NCache Execution Service for the changes to take effect.
Configure Write-Through for Write-Behind Cache Operations Using Command Line Tools
Configure Write-Behind
The add-backingsource tool enables users to configure backing source (Read-Through and Write-Through) providers for the specified cache.
The following command configures Writer as a Write-Through provider on demoCache with Write-Behind enabled and with a throttling limit of 500 operations per second.
add-backingsource -cachename demoCache -assemblypath /user/Providers.jar -class com.alachisoft.ncache.Write.SampleProvider -providername Writer -writethru -isbatching -operationpersecond 500
Remove Write-Behind
The remove-backingsource tool removes the preconfigured backing source providers (Read-Through or Write-Through) from the cache or a specified server.
• The following command removes the preconfigured Write-Behind provider from demoCache.
remove-backingsource -cachename demoCache -providername Writer -writethru
See Also
Read-Through Provider
Write-Through Provider
Deploy Providers
Add Test Data