Message Events
NCache provides configurable parameters to optimize server-side message event processing in its Pub/Sub and Event Notification subsystems. These configurations control message processing iterations, client polling limits, and event message replacement, allowing administrators to optimize throughput, latency, and overall resource utilization. By adjusting limits on processing iterations and polling batches, NCache ensures fair distribution of messages across Topics and subscribers while preventing message starvation under high load.
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 processing, 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 setting 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 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 message 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 recommended 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 and 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"/>