• Products
  • Solutions
  • Customers
  • Resources
  • Company
  • Pricing
  • Download
Try Playground
  • NCache Architecture
  • Cache Client
Show / Hide Table of Contents
  • Administrator's Guide
  • NCache Architecture
    • Cache Topologies
      • Partitioned Topologies
      • Replicated Topology
      • Mirrored Topology
      • Scalability in Topologies
    • Dynamic Clustering
    • Local Cache
    • Cache Client
    • Client Cache
    • Bridge for WAN Replication
    • Connectivity with Load Balancer
    • Serialization Format
    • Data Encryption
    • Data Compression
    • Data Load Balancing
    • Pipelining
    • Cache Server Backward Compatibility
    • Client Backward Compatibility
    • Eviction
    • Indexing
    • Split-Brain
    • Maintenance Mode
    • Runtime Data Sharing
    • Portable Data Types
    • Class Versioning
    • IP Binding with Multiple NICs
    • Graceful Node Down
    • Separate Cache Host Process
    • Self Healing Dynamic Clustering
    • Distributed Cache with Persistence
  • NCache Management Center
  • Configure Caches
    • Create a Cache
      • Local Cache Overview
        • Local Cache
        • Local Cache with Persistence
        • Pub/Sub Messaging Cache
        • Add Existing Cache
      • Clustered Cache Overview
        • Distributed Cache
        • Persistent Distributed Cache
        • Pub/Sub Messaging Cache
        • Add Existing Clustered Cache
        • Troubleshooting
    • Remove Cache
    • Clear Cache
    • Add Server Node
    • Remove Server Node
    • Add Test Data
    • Configure Query Indexes
    • Configure JSON Query Indexes
    • Compact Serialization
      • Non-Generic Registration
      • Non-Generic Unregistration
      • Generic Registration
      • Using Type Handler
    • Deploy Providers
    • Configure Custom Dependency
    • Add Data Source Providers
      • Read-Through Provider
      • Write-Through Provider
      • Write-Behind Provider
    • Loader and Refresher
    • Configure Maintenance Mode
      • Stop for Maintenance Mode
      • Exit Maintenance Mode
    • Configure LINQPad
      • Configure LinqPad for NCache
      • Querying Data in LinqPad
  • Configure Clients
    • Add Client Node
    • Remove Client Node
  • Configure Client Cache
    • Create Client Cache
    • Create Client Cache with NuGet
    • Enable Client Cache on Client Nodes
    • Disable Client Cache on Client Nodes
    • Remove Client Cache
  • Management Operations
    • Start Cache
    • Stop Cache
    • Restart Cache
    • Manage Cache Service on a Server Node
    • Memory Dumps
    • Data Load Balancing
    • Invoke Refresher Dataset
    • Import/Export Cache Data
    • Import Lucene Indexes
    • Suspend/Resume NCache Data Persistence
    • Backup and Restore NCache Persisted Data
  • Cache Settings
    • General Cache Settings
      • Cache Size
      • Cache Isolation Levels
      • Cache Serialization Format
      • Cache Data Expiration
    • Cache Cluster Settings
      • Ports
      • Operation Timeout
      • Configure Pipelining
      • Static Replication Interval
      • Connection Retries
      • Retry Interval
      • Split-Brain Auto Recovery
    • NCache Persistence Settings
      • Store Information
      • Persistence Interval
    • Error Logging
    • Cache Level Events
    • Client Activity Events
    • Eviction Policy
    • MapReduce
    • Register Classes for Portable Data Sharing
    • Compression
    • Email Notifications
    • Bind IP with Multiple NICs
      • Bind Cluster with a Dedicated IP
      • Bind Client/Server with a Dedicated IP
    • Heartbeat
    • Keep Alive
    • Client Death Detection
    • Communication Reliability
    • Auto Start Cache on Boot
    • Nagle's Algorithm
    • Dual Socket
    • Configuration Files
      • Client Side Configurations
        • Client Config
        • EFCaching Config
      • Server Side Configurations
        • Cache Config
        • Bridge Config
        • Modules Config
        • Security Config
        • TLS Config
        • Monitoring Config
        • Emails Template
  • Cache Server Settings
    • Server Connectivity
    • Bind to Multiple NICs
    • Server Ports
    • Memory
    • Custom Dependency
    • Request Inquiry
    • Windows Events
    • Message Events
    • Expiration & Eviction
    • SQL Server
    • Logging
    • Monitoring
    • Persistence Data Loading Retries
    • Miscellaneous Configurations
  • Bridge Server Settings
  • Cache Client Settings
  • Client Cache Settings
  • Configure Security
    • Configure Authentication and Authorization
    • Configure Encryption for Cache
    • Configure TLS Encryption
    • Configure HTTPS for NCache Management Center
  • Configure Bridge for WAN Replication
    • Create Bridge
    • Add Clustered Caches to Bridge
    • Configure Bridge Settings
    • Change Cache Synchronization Modes
    • Bridge Management
    • Synchronize Caches in Bridge
    • Leave Bridge
    • Remove Cache from Bridge
    • Configure Conflict Resolver
  • Setup Database for Cache Synchronization
    • Setup SQL Server Environment
    • Setup Oracle Database Environment
    • Setup OleDb Environment
    • Setup SQL Server for CLR Procedures
  • Simulate NCache Usage
  • Monitor Caches
    • Counters
      • Distributed Cache Counters
      • Distributed Cache with Persistence Counters
      • Pub/Sub Messaging Cache Counters
      • Distributed Lucene Cache Counters
      • Cache Client Counters
      • Bridge Counters
    • Monitor NCache using the NCache Management Center
      • Using Tabular Statistics
        • Configure Counters to Display Caching Statistics
        • Configure Counters to Display Pub/Sub Statistics
        • Configure Counters to Display Lucene Statistics
        • Configure Counters to Display Bridge Statistics
        • Browse Cache Statistics
        • Monitor Bridge
      • Using Monitoring Dashboards
        • Configure Monitor Settings
        • Configure Event Logging
        • Configure API Logging
        • Monitor with a Built-In NCache Monitor Dashboard
        • Monitor with the NCache Monitor Custom Dashboard
        • Monitor Cluster Connectivity
        • Monitor Cache Clusters using NCache Email Alerts
    • Monitor Cache Using Command Line Tools
      • Monitor Cache Server Statistics with Command Line Tools
      • Monitor Cache Client Statistics with Command Line Tools
    • Monitor NCache Using Windows PerfMon Tool
      • Monitoring Cache Server Counters using PerfMon
      • Monitoring Cache Client Counters using PerfMon
      • Monitor Bridge Counters Using PerfMon Tool
    • Monitor NCache using Prometheus
    • Monitor NCache using Grafana
    • Monitor NCache Using SNMP Counters
    • Monitor NCache Using JMX Counters
    • Logging
      • NCache Log Viewer
      • Performance Counters Logging
      • Windows Event Logging
      • Cache Health Alerts
      • Email Notifications on NCache Events
      • Cache Server Logging
      • Client Side API Logging
      • Cache Event IDs
      • Feature Usage Logging
    • Troubleshooting NCache Monitoring
      • Computer Name Not Found
      • Diskperf Not Installed
      • No READ Access to Perflib Subkeys
      • Unable to Connect to Remote Server
    • IPV6 Support

Distributed Cache Client

The use of NCache spans a variety of use cases, starting from a simple key-value store to advanced SQL searching and Pub/Sub. Client applications include, but are not limited to, console applications, windows services, web applications, and web services. Client libraries (SDK) include .NET, Java, and NodeJS. Moreover, support for Python is also provided. Using the relevant SDK, client applications can connect with one or more caches.

Note

This feature is also available in NCache Professional.

Communication Methods for Distributed Cache Client

  • Google Protobuf as a data exchange format: The client communicates with the distributed cache over a persistent TCP socket. NCache client uses Google Protocol buffer (Protobuf) as a protocol to communicate with the cache server. The use of Protobuf provides flexibility to older client versions of NCache, to communicate with new cache server versions.

  • Request-Response based parallel request execution: NCache client supports multi-threading. Those applications can make parallel requests to the cache. NCache follows the RequestId-based request-response protocol in client-server communications, where every request is assigned a unique RequestId. Despite having a single TCP connection between the cache client and a cache server, the client can send multiple requests with their unique RequestIds to the cache server without waiting for the response of already sent requests. So, each request is truly independent. NCache server also supports parallel request execution. This architecture enables applications to execute multiple parallel operations from the client to cache servers without operations waiting for each other, thus, providing maximum performance and scalability.

  • Request Pipelining: Pipelining refers to combining and sending multiple requests in a single socket (I/O) operation. Whenever applications perform I/O operations, user-to-kernel mode switching occurs, which is a costly operation. Pipelining avoids this cost by performing the same task in a reduced number of I/O operations. Pipelining increases application performance manyfold. NCache supports pipelining on both the client and server end.

  • Cache topology awareness: NCache client is cache topology-aware. When a cache client connects to the first cache server, it retrieves the cache metadata, including its topology. How a client should establish connectivity with cache servers and how client operations should be executed, depends on the underlying topology of the cache. For example, data is distributed among different cache servers in Partitioned and Partition-Replica topologies. Therefore, the client establishes a TCP connection with each server in the cache cluster and fetches the latest data distribution maps. The client directly performs read and write operations against the partition containing the concerned data. Similarly, each server in the Replicated topology contains the same set of data. Thus, the client only connects with a single cache server.

  • Handling connection failures in a seamless fashion: The NCache client maintains a persistent connection with the cache server(s). If this connection breaks due to network glitches, the NCache client is equipped with a background connection re-establishment mechanism. This mechanism automatically establishes connectivity with the failed server, as soon as network connectivity is resumed between the client and server. And all of this happens seamlessly, without client application intervention.

  • Data Serialization: Application data goes through the serialization process before going to the cache server. NCache supports both Binary and JSON serialization. You can choose either of the serialization formats at the time of configuring the cache. The cache client fetches the serialization format from the cache server upon connecting to the cache. Then it serializes the application data according to the serialization format.

  • Data Encryption: Encrypting of application data is an optional feature that you can enable. If Encryption is configured, the client encrypts application data after it has been serialized. The client fetches the encryption-related configuration from the cache server upon connecting to the cache.

  • Data Compression: Compression of the application data can help reduce cache size if the data is really large. Data is first serialized, then encrypted (if encryption is enabled), and finally compressed by the cache client before being dispatched to the cache. The cache client fetches the compression-related configuration from the cache server upon connecting to the cache.

Connecting With the Cache

The cache client needs the server information to connect with the cache. Server information can be either provided through the client configuration file (client.ncconf ) or through CacheConnectionOptions. The client iterates through the provided cache server list and tries to connect with the cache running on the server. If the cache instance is not running on a given server, it moves to the next server provided in the list. Client connection usually goes through the following steps:

  • The client first establishes a TCP connection with NCache Service over port 9800.

  • The client then makes a request for the complete list of configured cache servers. This way, it has an updated list of the cache servers.

  • The client then sends the cache an initialization request to the server, which includes the cache name and security credentials in case cache security is enabled. Every cache runs in a separate process. If you have .NET Framework based installation of NCache on the server end, then the service seamlessly hands over client connection to the cache process, and the client successfully connects with the cache. In .NET Core or .NET 6 and higher installations, the service shares the port information with the client on which the cache is listening for connections. The client then establishes a direct connection with the cache process and sends an initialization request.

Note

NCache automatically configures the Firewall to open all the required ports on Windows. However, you need to open NCache ports on Linux by Configuring Firewall.

  • If the client is connecting with a Replicated cache and client load balancing is enabled, then the client asks for a server that has the least number of clients connected to it. It then connects with the least loaded server.

  • If the client is connecting with a Partitioned or a Partition-Replica cache, then it requests the distribution maps for the servers. Upon receiving the map(s), it establishes connections with the cache servers present in the distribution map.

  • The client also requests different cache configurations like

    • Compression threshold and cache serialization format.
    • Encryption keys are shared between the client and cache server.
    • Configured Query indexes and registered compact types, etc.

See Also

Cache Topologies
Cache Cluster
Local Cache
Client Cache
Bridge for WAN Replication

In This Article
  • Communication Methods for Distributed Cache Client
  • Connecting With the Cache
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top