NCache Memcached Gateway Approach
NCache provides Memcached gateway servers to use NCache without any application code changes or recompilation. NCache Memcached gateway is implemented based on Memcached socket protocol and acts as a Memcached server for Memcached applications. It understands all Memcached client requests and sends responses accordingly. However, it only serves as a proxy and in fact connects to the NCache cluster.
Gateway intercepts Memcached commands and then in turn executes NCache APIs equivalent to these commands on NCache distributed cache. This gives you NCache support for any type of Memcached client regardless of which programming language they’re developed in. There are two deployments of NCache Memcached gateway:
Memcached Client Side Gateway
Figure 1: Memcached Gateway Server running on NCache remote client machines
NCache gateway server is installed on the application servers. Applications talk to local gateway severs and then gateway servers act as a NCache client and execute the requested commands on NCache.
Gateway server is an intelligent NCache client that keeps record of all NCache servers in the cluster. Thus if any of the node in NCache cluster gets down, gateway starts communicating with other available NCache servers. This avoids a single point of failure for application. While using gateway, it is recommended to use NCache remote client configuration for using NCache in Memcached applications. Figure 1 illustrates this deployment.
Memcached Server Side Gateway
Figure 2: Memcached Gateway Server running on NCache cache servers
NCache gateway server is installed on NCache cache servers. Applications talk to gateway severs running on cache servers and then gateway server talks to cache and sends response back to the client. In the below diagram (figure 2), you can see that the Memcached gateway server (also called Memcached Client Wrapper) runs on NCache cache servers. The Memcached client application talks to this gateway as if it is a Memcached server. And, this in turn talks to the NCache cluster using NCache API calls.
In this configuration when a gateway server is running on one of the server nodes in the cluster, Memcached application communicates with only that server node. This produces a single point of failure risk for Memcached client applications. However, in this configuration Memcached socket protocol, messages will be communicated over a network that is more compact and less in size than NCache protocol messages.
Figure 2 illustrates this deployment.