Products | Versions |
---|---|
TIBCO SmartSockets | - |
Not Applicable | - |
Resolution:
To enable flow control, set the following in the RTserver configuration file:
setopt _server_ri_imr_fc_inbound_msgq_lwm 500
setopt _server_ri_imr_fc_inbound_msgq_hwm 1000
setopt _server_ri_imr_fc_display_stats false
To validate that flow control is operational, set the following options. Set them to off in the final runs:
setopt _server_ri_imr_fc_display_stats true
setopt _server_trace_level verbose
The following is a brief explanation of the above options.
The server consists of one or more I/O threads and one 'functional' SMR thread. When a client connects to the server, the server associates the client with one of the many I/O threads. When data is published by a publisher, the I/O thread handling the publisher reads the data and hands it off to the SMR thread. The SMR thread consults the routing tables and determines the intended recipients of the message. It then hands off a reference of the message to each of the threads that handle the set of intended recipients. The flow control mechanism implemented in the server (called IMR (Input Message Rate) flow control)
controls the maximum number of outstanding messages in the SMR thread input queue (the queue used by the I/O threads to hand off messages for processing to the SMR thread). The queue is associated with a HWM (high water mark) and LWM (low water mark). When the number of pending messages in the queue reaches the HWM, the server suspends input from the publisher which caused the HWM to be reached.
Once input processing has been suspended, the queue eventually will reach the LWM at which point all suspended publishers are resumed. This causes the rate at which messages are input to the server to be throttled in order to prevent an inordinate amount of messages from accumulating in the SMR thread input queue.
The SMR thread actually receives messages in batch from the I/O threads. When data is ready to be read from the publisher, the I/O threads reads as much data as possible at that point in time, batches it, and hands the batch off to the SMR thread for processing. The message queue actually consists of message batches rather than individualmessages. Since it is too expensive to walk through the message queue and calculate the exact number of messages in the queue, every time a message batch arrives for processing, the server uses a statistical average of the size of a message batch to estimate the number of messages in the queue. Furthermore, in order to prevent locking of the message queue on every message batch received, the server only performs flow control calculations when
necessary. It uses a heuristic algorithm to determine when it is necessary to perform a flow control check.
The following parameters control the flow control implementation in the server:
_server_ri_imr_fc_inbound_msgq_lwm: The message queue low water mark (in # of messages).
_server_ri_imr_fc_inbound_msgq_hwm: The message queue high water mark (in # of messages). A value of 0 (default) disables flow control.
_server_ri_imr_fc_display_stats: Controls whether the server outputs flow control statistics.This must be accompanied by a 'setopt _server_trace_level verbose' for it to take effect.
_server_ri_imr_fc_sampling_frequency: Controls the rate at which the server samples the message queue to determine if the HWM/LWM have been reached. A
value of 0 (default) instructs the server to utilize the heuristic algorithm. A non-negative value is interpreted by the server as a request to perform flow control checks on a periodic basis determined by the receipt of a constant number of messages indicated by this options value.
_server_ri_imr_fc_rollover_frequency: Controls the interval after which the total number of messages received is rolled over to 0. This affects the
computation of average message batch size (Default value = 1000000).
According to the values provided to you (in the setopts mentioned above), the server will be performing flow control checks using the heuristic algorithm, with a HWM = 1000, a LWM of 500 and a rollover of 1000000.