NCache 4.4 - Online Documentation

Troubleshooting Client Socket Deadlock

You may experience a deadlock situation on your client socket because of a long wait for a response from the cache server. This may also result in a lot of waiting threads that may cause performance issues. To resolve this problem, please follow these steps:
 
Step1: Changes on Server Side
 
  • Go to Alachisoft.NCache.Service.exe.config located at
    %INSTALLATION_PATH%/NCache/bin/service/Alachisoft.NCache.Service.exe.config
     
  • Add the following lines in the configuration file:
 
<add key = "NCacheServer.EnableBadClientDetection" value = "true" />
 
The value "true" indicates that BadClientDetection is enabled on your client socket. This means that now if a deadlock situation arises on your client socket, the socket will be reset. The default value of this property is "false".
 
<add key = "NCacheServer.ClientSocketSendTimeout" value = "10" />
 
When you have enabled BadClientDetection, you can specify the time interval after which the socket is reset in case of a deadlock. The default value of this property is "10" and this value can not be less than 1.
 
A few other properties have also been introduced in Alachisoft.NCache.Service.exe.config to help with this issue. Please configure these properties as follows:
 
<add key ="NCacheServer.EventPriorityRatio" value="30"/>
 
On the server-side a priority queue is used for events and cache operations. You can configure a ratio of events and cache operations for this queue through the property called EventPriorityRatio. The default value of this property is 30 which indicates a ratio 30:70 for events and cache operations. The value of this property can not be less than 1.
 
<add key ="NCacheServer.EventBulkCount" value="50"/>
 
The cache server now sends events to clients in bulk. Through this property you can set the number of items to be sent in bulk. By default this value is 50 and the value can not be less than 1. This is available in client version 4124 and above.
 
<add key ="NCacheServer.EventBulkCollectionInterval" value="2"/>
 
This property is used to set the time interval, in seconds, after which bulk of events is fired even in case the bulk count does not reach the EventBulkCount that the user has specified. Default value for this property is 2 seconds and the value can not be less than 1.
 
  • Restart the NCache service for these changes to take effect.
 
Step2: Changes on Client Side
 
  • Please make the following changes in your app.config/web.config file:
 
<configuration>
  <appSettings>
              <add key ="NCacheClient.AsynchronousEventNotification" value="true"/>
              <add key ="NCacheClient.NumberofEventProccesingThreads" value="2"/>
        </appSettings>
</configuration>
 
  • AsychronousEventNotification: Specifies whether events will be fired asynchronously or synchronously on client side. The default value is "true" which indicates that events will be fired asynchronously. The value "false" means that events will be fired synchronously on client side.
  • NumberofEventProcessingThreads: When the user has configured events to be fired synchronously, this flag is used to specify the number of threads which will process these events on client side. A very large value can cause performance issues.