In normal publish-subscribe operations, a message is published to all RTclients that have subscribed to the subject the message is being sent to. However, in some situations you may wish to have messages sent to only one of a specified set of RTclients. An example of this is a project where there is high message throughput and each message takes some time to process. In this case, you may wish to replicate a set of RTclients and have them take turns processing, or have the least busy one handle, the messages to better keep up with message flow.
This is accomplished in TIBCO SmartSockets using load balancing. Rather than have a single RTclient handle all the messages, you can use load balancing to process the messages across multiple RTclients. This is very useful when processing a heavy message load. A load-balanced message is routed to only a single RTclient, not to all RTclients subscribed to the destination subject. The RTclient to which the message is routed is selected based on the load balancing mode specified. Load balancing implies that there is a set of RTclients that are all equally capable of processing load-balanced messages.
For example, consider the simple example shown in Figure 5. There are three receivers, all subscribed to the same subject. Messages 1, 2, and 3 are published to that subject. On the left side of the figure, each message is routed to all receivers because there is no load balancing. The right side shows what happens when the messages are marked to be delivered using round-robin load balancing. The first message is delivered to Receiver 1, the second message to Receiver 2, and the third message to Receiver 3. Each message is delivered to only a single RTclient.
Load balancing can be specified per-message or per-message type with the load balancing mode message property. Load balancing is dynamic in that whenever an RTclient connects to or disconnects from an RTserver, the load balancing calculations are updated in real time. When an RTclient publishes the first message using load balancing to a subject, RTserver starts collecting subject subscription information from the appropriate other RTservers to accurately track load balancing accounting. This increases the scalability of load balancing because only the relevant RTservers dynamically exchange load balancing information.
By default, messages are not load balanced and are distributed to all subscribers. Setting the load balance mode per message takes precedence over message type. Setting load balancing for a message type takes precedence over the default value of NONE (T_IPC_LB_NONE). TIBCO SmartSockets supports four load balancing modes: NONE, ROUND ROBIN, WEIGHTED, and SORTED.
For more information, see the section on load balancing in the publish-subscribe chapter of the TIBCO SmartSockets User’s Guide.
TIBCO SmartSockets™ Tutorial Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |