• Webinars
  • Docs
  • Download
  • Blogs
  • Contact Us
Show / Hide Table of Contents
  • Administrator's Guide
  • NCache Architecture
    • Cache Topologies
    • Cache Cluster
    • Local Cache
    • Cache Client
    • Client Cache
    • Data Load Balancing
    • Cache Server Backward Compatibility
    • Client Backward Compatibility
    • Eviction
    • Indexing
    • Runtime Data Sharing
    • Portable Data Types
    • Class Versioning
    • IP Binding with Multiple NICs
    • Graceful Node Down
    • Separate Cache Host Process
    • Self Healing Dynamic Clustering
  • Configuring Caches
    • Create Cache
      • Creating Local Cache
        • Create New Cache
        • Add Existing Cache
      • Creating Clustered Cache
        • Create New Cache Cluster
        • Add Existing Cache Cluster
    • Remove Cache
    • Clear Cache Contents
    • Adding Server Node in Cache Cluster
    • Removing Server Node from Cache Cluster
    • Configuring Basic Cache Settings
      • Cache Size
      • Cache Isolation Levels
      • Cache Data Expiration
      • Cache Data Format
    • Configuring Cache Cluster Settings
      • Ports
      • Operation Timeout
      • Static Replication Interval
      • Connection Retries
      • Retry Interval
    • Add Test Data to Cache
    • Deploy Providers
    • Configuring Query Indexes
    • Registering Classes for Compact Serialization
      • Registering Non-Generic Classes
      • Unregistering Non-Generic Classes
      • Registering Generic Classes
      • Registering Generic Classes Using Generic Type Handler
    • Registering Classes for Portable Data Sharing
    • Configuring Data Source Providers
      • Read-Through Provider
      • Write-Through Provider
      • Write-Through Provider for Write-Behind Operations
    • Configuring Cache Startup Loader
    • Configuring Cache Level Events
    • Configuring Cache Activity Events
    • Configuring Eviction Policy
    • Configuring Compression
    • Configuring Email Notifications
    • Binding Cluster and Client/Server IP with Multiple NICs
      • Binding Cluster with a Dedicated IP
      • Binding Client/Server with a Dedicated IP
    • Configuring Heartbeat
    • Configuring MapReduce
    • Configuring Communication Reliability
    • Auto Start Cache on Boot
    • Nagling
    • Dual Socket
    • Error Logging
    • Configuration Files
      • Client Side Configurations
        • Client Config
        • EFCaching Config
      • Server Side Configurations
        • Cache Config
        • Bridge Config
        • Security Config
      • Cache Server Configuration
  • Management Operations
    • Start Cache
    • Stop Cache
    • Restart Cache
    • Manage Cache Service on a Server Node
    • Apply Configuration
    • Hot Apply Configuration
    • Reset Configuration
    • Data Load Balancing
  • Configuring Cache Clients
    • Adding Client Node in Cluster
    • Removing Client Node from Cluster
    • Configuring Client Node Settings
    • Creating Client Cache
    • Enable Client Cache on Client Nodes
    • Disable Client Cache on Client Nodes
    • Removing Client Cache
    • Configuring Client Cache Settings
  • Configuring Security
    • Configuring Security for Cache Management
    • Configuring Security for Cache
    • Configuring Security for Client Nodes
    • Configuring Encryption for Cache
    • Configure SSL/TLS Encryption in NCache
  • Configuring Bridge for WAN Replication
    • Creating Clustered Bridge
    • Adding Clustered Caches to Bridge
    • Configuring Bridge Settings
    • Configuring Conflict Resolver
    • Changing Cache Syncronization Modes
    • Configuring Master Cache
    • Force State Transfer
    • Connect/Disconnect Cache in Bridge
    • Remove Cache from Bridge
    • Bridge Management
  • NCache on Docker
    • Using NCache Docker Images
    • Customize NCache Dockerfile
  • Monitoring NCache
    • Cache Counters
    • Monitoring Caches using NCache Manager
      • Changing Management Port of Cache Node
      • Configuring Counters to Display
      • Browse Cache Statistics
      • Cluster Health
      • Monitoring Cache Clusters using NCache Email Alerts
    • Monitoring Caches using NCache Monitor
      • Monitoring with Built-In Dashboard
      • Monitoring with Custom Dashboard
    • Monitoring Bridge using NCache Manager
    • Monitoring NCache using Windows PerfMon Tool
      • Monitoring Cache Server Counters Using PerfMon
      • Monitoring Cache Client Counters Using PerfMon
      • Monitoring Bridge Counters Using PerfMon
    • Logging in NCache
      • NCache Log Viewer
      • NCache Monitor Logging
      • Performance Counters Logging
      • Windows Event Logging
      • Email Notifications on NCache Events
      • Cache Server Logging
      • Client Side API Logging
      • Cache Event IDs
    • Troubleshooting NCache Monitoring
      • Computer Name Not Found
      • Diskperf Not Installed
      • No READ Access to the Perflib Subkeys
      • Unable to Connect to Remote Server
    • IPV6 Support
  • Upgrading NCache Versions
    • Live Upgrade NCache Version
    • Upgrade NCache Version Offline
  • Apply Windows Patches on NCache Server

Client Cache

A Client Cache is a local cache synchronized with a remote clustered cache. It always synchronizes with remote cache through notifications that are triggered whenever changes are made into the state of data. Because of synchronized nature of client cache, it provides maximum boost in performance and scalability of application for read operations without compromising data integrity.

Since the client cache resides on the same box where client application is running, it saves the network roundtrip every time data is served from the client cache. Therefore, data retrieval in this case is much faster as compared to fetching the same data from the remote server.

Client cache can either be InProc (resides within the application process) or OutProc (resides locally or on remote box). By default, cache is initialized as OutProc, however, from NCache Manager, it can be configured to start as InProc. Client applications can initialize the cache as InProc by specifying the initialization mode as ‘InProc’ while calling NCache.InitializeCache(). Client cache cannot be directly initiated using Client API Initialize method. It's always used with some remote clustered cache such as Mirrored, Partitioned, and Partition-Replica Cache.

Synchronization Modes

There can be multiple client cache instances running on different client nodes that simultaneously interact with remote clustered caches. Also, client cache has a subset of data residing in remote clustered cache. It means that there is a small window of time for client caches to sync their state. To solve this problem, client cache provides data synchronization with the clustered cache. Data synchronization is performed between client cache and remote clustered cache and is inevitable. Client cache provides two synchronization modes.

Optimistic Synchronization

In optimistic mode, application fetches data from client cache despite the fact that data is updated or not. It assumes that data is newer in client cache, however, there are possibilities that data may be older than that on the clustered cache because event notifications might not have yet been received during get operations. In optimistic synchronization, updates are propagated to the client cache using event notifications. Synchronization mechanism is explained later in this chapter.

Pessimistic Synchronization

Pessimistic mode is used when applications are handling sensitive data. On data fetch request, if data is found in client cache, its version is matched with item on remote cache. If both versions are the same, then item is returned. Otherwise the updated item is fetched from remote cache and is updated back to client cache. This is done to make sure that client application always gets the latest data. However, get operations are slower in pessimistic mode than in optimistic, but it ensures data consistency and takes extra care that the retrieved data is always updated. Notification based updates work similar to optimistic mode.

How Client Cache Works

Whenever the client application using client cache adds/updates data into the cache, it's first updated to second level (remote clustered cache) then on the successfully completed operation, data is updated to client cache. Whereas in the case of data retrieval, it's first looked into client cache; if found, the data is returned to client, otherwise it is fetched from the remote cache and inserted into client cache to make it available for next access. By doing this, client cache reduces unwanted trips to clustered cache, thus increasing performance while fetching data. The figure below explains the internal working of client cache for update and fetch operations on data.

Drawing3.jpg

Data Synchronization in Client Cache

While an item is added to client cache, client cache registers an item level notification with the remote server for any updates or removal of that very item. Whenever this item is updated on the server node, client cache receives a notification which then fetches the updated data from remote cache and updates it locally too. This way, it is made sure that client cache is always synchronized with cache servers even when items are being updated from clients running on other machines. The remote servers propagate these changes only to the clients who have shown interest in the specific items instead of propagating these changes to all client caches. This synchronization mechanism is used for both optimistic and pessimistic client cache. The following figure demonstrates data synchronized with clustered cache and client cache.

Note

InProc client cache stores items in object form, therefore if object is modified by the application, it should be updated back to the cache so that other remote clustered cache and other client caches have no other data integrity issues.

Back to top Copyright © 2017 Alachisoft