Client Config (client.ncconf)
Client configuration file (client.ncconf) is used by NCache client API to get initial information for establishing a connection with the server. This file is universal for all the client instances running on the client node. It is located at %NCHOME%\config in Windows or /opt/ncache/config in Linux. Modules that need to read the configurations, first try to find client.ncconf in the application folder. If client.ncconf is not found in the application folder, it then reads the configuration from the installation folder.
Client configuration file is used by the client to connect to the OutProc caches. Light-weight client also uses this configuration file to connect to the remote caches. This file is automatically updated each time a new cache/cluster is created, or cache/cluster configuration settings are applied as long as NCache is installed on the machine and the NCache service is running. Additionally, security information can be provided for each cache in this file.
Note that the same configurations can be specified via the CacheConnectionOptions API in Alachisoft.NCache.Client
. For more detail on how to use the API while initializing caches, please refer to Connect to Cache in Programmers' Guide.
Important
The configurations specified through CacheConnectionOptions
will override the configurations in client.ncconf ONLY for the client which is specifying them.
Client configuration file is explained below:
<configuration>
<ncache-server connection-retries="5" retry-connection-delay="0" retry-interval="1" command-retries="3" command-retry-interval="0.1" client-request-timeout="90" connection-timeout="5" port="9800" local-server-ip="20.200.20.38" enable-keep-alive="true" keep-alive-interval="30" />
<cache id="demoCache" client-cache-id="" client-cache-syncmode="optimistic" default-readthru-provider="" default-writethru-provider="" load-balance="True" enable-client-logs="False" log-level="error">
<server name="20.200.20.38"/>
<server name="20.200.20.23"/>
</cache>
</configuration>
client-request-timeout:
Client-request-timeout
is the period for which client API waits for a response
for a command from the server. After this period is elapsed an
"OperationFailedException" is thrown. By default it is 90 seconds and minimum
value could be 60 seconds. Time span specified less than minimum value will
automatically be reset to minimum value i.e. 60 seconds.
connection-retries:
connection-retries
are the number of retries the client makes on the whole list
of servers mentioned in the client.ncconf at the time of connection
establishment. It is the same for connection break scenario.
retry-interval: If connection with cache server is dropped, then client tries to reconnect with the server and retry connection delay flag introduces the delay between each retry. This flag is specified in seconds.
connection-timeout:
connection-timeout
is the period threads wait before
throwing OperationFailedException
during connection-break, while one thread
tries to establish connection with cache server. If the connection is
successfully established then, all threads will complete their respective
operations. Otherwise, they will throw OperationFailedException
.
retry-connection-delay:
retry-connection-delay
is the time interval when client API waits before going through
another iteration of connection-retries. Delay is specified in seconds.
enable-keep-alive:
enable-keep-alive
specifies whether the connection between the client and server should be kept "alive", i.e., if the client is inactive (not communicating with its connected servers), it sends heart-beats or pings from client to server nodes after fixed intervals according to the cache topology. This feature is particularly useful if there is a firewall which breaks idle network connections or if it detects connection breakages proactively.
Note
This feature is only available in NCache Enterprise Edition.
keep-alive-interval:
keep-alive-interval
is the interval in seconds after which a heart beat is sent from the idle client to server to sustain the connection. The interval range is between 1 and 7200 seconds with default set at 30 seconds. If any value is specified out of the range, NCache resorts to using the default value.
Note
This feature is only available in NCache Enterprise Edition.
default-readthru-provider: Gets/Sets ID of default ReadThru Provider. If the provider is specified through API, this value will be overwritten with the value passed from API.
Note
This feature is only available in NCache Enterprise Edition.
default-writethru-provider: Gets/Sets ID of default WriteThru Provider. If the provider is specified through API, this value will be overwritten with the value passed from API.
Note
This feature is only available in NCache Enterprise Edition.
load-balance: When this flag is set, client tries to connect to the optimum server in terms of number of connected clients. This way almost equal number of clients are connected to every node in the clustered cache and no single node is overburdened.
Port Forwarding Configuration
Note
If your cache servers and client applications are on the same subnet, you don't need to configure port forwarding.
If your cache servers and clients are on a different subnet or network, your client application might not be able to access your cache servers directly on the basis of just IP addresses. In this case, you'll have to configure port forwarding and modify your client.ncconf file accordingly.
The following is a sample client.ncconf file with port forwarding configured:
<configuration>.
...
<server-end-point>
<end-point public-ip="172.19.0.11" public-ports="9801" private-ip="20.200.20.38" private-ports="9800"/>
<end-point public-ip="172.19.0.11" public-ports="1250-1260" private-ip="20.200.20.38" private-ports="8250-8260"/>
<end-point public-ip="172.19.0.11" public-ports="1300-1400" private-ip="20.200.20.38" private-ports="8300-8400"/>
<end-point public-ip="172.19.0.11" public-ports="9802" private-ip="20.200.20.23" private-ports="9800"/>
<end-point public-ip="172.19.0.11" public-ports="2250-2260" private-ip="20.200.20.23" private-ports="8250-8260"/>
<end-point public-ip="172.19.0.11" public-ports="2300-2400" private-ip="20.200.20.23" private-ports="8300-8400"/>
</server-end-point>
</configuration>
server-end-point: These represent those endpoints which will be used to communicate with the NCache servers.
end-point: The endpoint of the ncache server. A combination of an IP address and port.
public-ip: This is the IP address that is publicly accessible or present outside of the local network.
public-ports: The public ports that will be used to access the private ports.
private-ip: This is the IP address that is present within the local network and is not directly accessible. This is the IP address that is used by the NCache server.
private-ports: These are the ports that are not directly accessible. These are the ports used by the NCache server.
See Also
EFCaching Config
Server Side Configurations
Cache Server Settings
General Cache Settings