Velocity Notifications - Why there are failures
In this post I am going to talk about "velocity" cache notifications failures.
If you are not familiar with the "velocity" notifications, here some references:
- What is "velocity" notifications
- How to use "velocity" notifications
So why there are notifications failure?
Every cache host manage a "queue" of notifications (a circular buffer). This queue size is limited (by notifications number).
While the "queue" exceed its max size, while new notification need to be stored in the "queue", the "oldest" notification pull out.
When a client register to get notifications the application checks with the cache cluster at a regular interval to see if any new notifications are available. This interval, called the polling interval, is every 300 seconds by default.
So, if the "queue" size is, for example, 10 items and since the last polling (and before the next one) 11 notifications were pushed, one notification will "get lost".
In this situation, you can get a "notification failure" notification, but this notification will inform you that you miss some notifications, with any data on the lost notifications.
How we can eliminate from this situation?
We can't, all we can is to reduce the chance it will happen.
We can set the polling interval shorter (,of course this can impact on performance):
"The polling interval is specified in units of seconds in the application configuration settings. To specify a specific interval, you can use the pollInterval attribute of the clientNotifications element in the application configuration file. You can also specify a specific polling interval programmatically with the DataCacheFactory constructor."
(from msdn: http://msdn.microsoft.com/en-us/library/dd631052.aspx).
We can increase the "queue" size:
In cluster config, for each cache we can specify the number of notifications to be kept.
<cache name="new" type="partitioned">
<policy>
<eviction type="LRU" />
<expiration isExpirable="true" defaultTTL="1000" />
<serverNotification isEnabled="true" maxEvents="1024" />
</policy>
</cache>
In CTP3, there is no parameter exposed in powershell comand "new-cache" to configure it , but using export-import command you can configure it, also note that the number of notification stored will be power of 2 equal or higher than what you specify in the configuration attribute "maxEvents".e.g. if you specify a value of 1000, then queue length will be 1024.
And also note that this "maxEvent" notifications will be stored for each partitions of the cache.
Good luck,
Tal