Message Events
NCache provides configurable parameters to optimize server-side message event processing. These configurations control message processing iterations, polling limits, pending event overrides, enabling administrators to optimize performance, and resource utilization.
The following configuration keys define how NCache handles and manages message event processing within its internal Pub/Sub and Event Notification subsystems. These settings ensure efficient event handling, balanced message throughput, and reduced processing latency across distributed nodes.
Process Message Count
NCache processes event messages through its Pub/Sub module, and this configuration parameter applies to both Pub/Sub and Event Notification messages. The MessagesToProcessPerIteration specifies the maximum number of messages that can be processed in a single iteration of the event processing cycle. It directly influences how message assignment, dispatch, and any other related operations are handled within the internal event pipeline.
NCache uses this value to ensure balanced message distribution across all active Topics (channels). If this value is set too high, it may cause message starvation, where messages belonging to a single Topic dominate the processing cycle, leading to delayed messages handling from other Topics or operations. Therefore, it is generally suggested to configure this setting with a moderate value to maintain optimal throughput and fair processing across all channels.
<add key="NCacheServer.MessagesToProcessPerIteration" value="2000" />
Max Messages Per Poll
The MaxMessagesPerPoll configuration defines the maximum number of messages that can be fetched from the server in a single client poll request. The default value is 3000. This setting acts as an upper threshold, meaning it is not mandatory that the same number of messages will always be sent to the client in each poll. The actual number of messages delivered can be equal to or less than this value, depending on the number of available messages in the queue at the time of polling.
By modifying this configuration, administrators can optimize client-side message processing load and network utilization:
- If the client application processes messages slowly, it is generally suggested to decrease this value to prevent the client from being overwhelmed by a large batch of incoming events.
- Conversely, if the client can handle a high message throughput, increasing this value helps minimize the number of unprocessed (queued) messages and reduces polling overhead. Essentially, this configuration helps NCache balance throughput vs. responsiveness, ensuring efficient message distribution without overburdening slower clients.
<add key="NCacheServer.MaxMessagesPerPoll" value="3000" />
Store Single Event Message Per Key
This configuration specifies whether only the most recent event message for a specific key is stored. When enabled, any new event message replaces a previously pending message with the same key. The default value is false.
<add key="NCacheServer.StoreSingleEventMessagePerKey" value="false" />
Store Single CQ Event Message Per Key
This configuration functions similarly to StoreSingleEventMessagePerKey, but applies specifically to Continuous Query (CQ) event messages. When enabled, only the latest CQ event message for a given key is retained in the queue, replacing any previously pending messages. The default value is false.
<add key="NCacheServer.StoreSingleCQEventMessagePerKey" value="false" />
Note
Both StoreSingleEventMessagePerKey and StoreSingleCQEventMessagePerKey retain only the latest event for a given key. Enable them when the application requires only the most recent state, improving efficiency and reducing redundant messages. Keep them disabled if every intermediate event must be processed, as enabling may cause clients to miss critical state changes.