Client configuration file (client.ncconf) is used by NCache client API to get initial information for establishing connection with server. This file is universal for all the client instances running on the client node. It is located at
%NCHOME%/config. Modules that need to read the configurations, first try to find client.ncconf in application folder. If client.ncconf is not found in application folder, it then reads the configuration from installation folder.
Client configuration file is used by client to connect to 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. Additionally, security information can be provided for each cache in this file.
Note that the same configurations can be specified via the CacheInitParams API in
Alachisoft.NCache.Web.Caching. For more detail on how to use the API while initializing caches, please refer to Initializing Cache using CacheInitParams in Programmers' Guide.
The configurations specified through
CacheInitParams 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="126.96.36.199" enable-keep-alive="true" keep-alive-interval="30" /> <cache id="myreplicatedcache" client-cache-id="repclientcache" client-cache-syncmode="optimistic" default-readthru-provider="" default-writethru-provider="" load-balance="True" enable-client-logs="False" log-level="error"> <server name="188.8.131.52"/> <server name="184.108.40.206"/> </cache> <cache id="mypartitionedcache" client-cache-id="partitionedclientcache" client-cache-syncmode="optimistic" default-readthru-provider="" default-writethru-provider="" load-balance="True" enable-client-logs="False" log-level="error"> <server name="220.127.116.11"/> <server name="18.104.22.168"/> </cache> </configuration>
Client-request-timeoutis 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 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 is the period threads wait before
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
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 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.
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.
default-readthru-provider: Gets/Sets ID of default ReadThru Provider.
default-writethru-provider: Gets/Sets ID of default WriteThru Provider.
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.