Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Appendix A SDK Programming Guidelines : Using Distributed Processes for Load Balancing

Using Distributed Processes for Load Balancing
TIBCO Rendezvous Distributed Queue messaging (RVDQ also known as RVCMQ) can be used to implement message-level load balancing.
RVCMQ should be used if the adapter must process messages in the order sent or if the adapter must not process the same message twice (duplicate processing).
Distributed Queue Member
A distributed queue is a group of cooperating transport objects, each in a separate process. Each transport object is called a member. From the outside, a distributed queue appears as a single transport object; inside, the group members act in concert to process inbound task messages.
Each distributed queue member has two roles: as a worker and as a potential scheduler. In the worker role, members listen for task messages and process inbound task messages as assigned by the scheduler. To determine whether a member is a worker or scheduler, create an advisory listener on the RVCMQ advisory subject _RV.INFO.RVCM.QUEUE.SCHEDULER.ACTIVE.>. See Advisory Handling.
Worker Weight and Worker Tasks
RVCMQ provides message-level load distribution based on Worker Weight and Worker Tasks. Each worker in the workgroup can specify a different value for these parameters, thereby influencing how the work is distributed among workers. The value 0 is the reserved value.
If the parameters Worker Weight and Worker Tasks are set to the same value for all adapters, RVCMQ will distribute messages evenly. Depending on their capacities to process tasks, each adapter can specify a different value for each worker task. For example, if an adapter has n dispatchers, it can specify n tasks.
A thread pool design can also be combined with RVCMQ to increase the number of tasks a worker member can handle concurrently.
Scheduler
If the incoming rate of messages is very high and overwhelms the worker adapters, the adapter in which the RVCMQ scheduler lives will start taking up tasks itself. When a DQ member assumes a scheduler job, it overwrites its worker weight and worker task to 1.
You cannot avoid the likelihood of the scheduler being assigned work, but you can set a short completion time (for example, 1000 milliseconds) on the scheduler and disable automatic confirmation. This will reassign a certified message (task) assigned to the scheduler to an available worker one second later.
The actual completion time value to use depends on other DQ parameters and use cases, such as the number of tasks or threads per worker, the number of workers, the message rate, and so on. 1000 milliseconds is not appropriate for all cases.
APIs for Setting RVCMQ Backlog Size
TIBCO Adapter SDK provides the following APIs in the MRvSession class both for C++ and Java SDK to set the RVCMQ backlog size.
setTaskBacklogLimitInBytes()
setTaskBacklogLimitInMessages()

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved