Home/Shared Balancer
The Home/Shared Engine balancer uses an algorithm in which an Engine has a set of Home Brokers that it always works on while it has outstanding tasks, yet the Engine can be shared to other Brokers when there are no outstanding tasks on any home.
The balancer uses Broker needs and Engine preferences for Brokers to allocate Engines to Brokers. Each Engine divides the existing Brokers into tiers (unordered sets of Brokers). The two default tiers are:
|
•
|
The Engine’s home Brokers |
|
•
|
The shared Brokers of those home Brokers |
You can introduce a third tier by splitting shared Brokers into two groups: preferred shared brokers, and common shared Brokers. The higher the tier, the more the Engine prefers the Brokers in that tier.
The balancer uses the following rules:
|
•
|
An Engine is routed to the highest-tiered Broker that has pending tasks. If multiple Brokers in the same tier have pending tasks, the choice is made at random, as if all weights were 1. The number of Engines moving to a Broker is capped at the number of pending tasks if there are more pending tasks than available Engines in the tier. |
|
•
|
An Engine leaves its current Broker only if there is a needy Broker in a higher tier. An Engine does not move to a lower-tiered Broker unless it is idle. |
|
•
|
Failover Brokers are never allocated Engines unless they have pending tasks. |
|
•
|
If Options.MAX_ENGINES is set on a Service and the number of Engines from other Brokers are not shared with this Broker to run the Service. If there are more Engines on a Broker than the sum of all MAX_ENGINES values across active Services, the excess Engines are reported as available for sharing. |
Use the GridServer Administration Tool to configure Brokers. Configure an Engine’s home Broker with the Grid Components > Engines > Engine Configurations page. Configure Broker tiers (which Brokers share Engines with other Brokers) with the Grid Components > Brokers > Broker Configuration page as follows:
|
1.
|
To set the first tier of Brokers, fill in the Preferred Broker Sharing field. Supply a comma-delimited list of the Brokers with which the current Broker shares Engines. |
|
2.
|
To set the second tier of Brokers, fill in the Common Broker Sharing field. Supply a comma-delimited list of other Brokers with which the current Broker shares Engines. |
|
3.
|
You can also define additional tiers of Brokers by delimiting them with semicolons in the Common Broker Sharing field. For example, to enter a second and third tier of Brokers, you could enter the list B1, B2, B3; C1, C2, C3. |
For example, an Engine configuration’s home Brokers are A and B. A’s preferred broker is C; its common list is D,E. B’s preferred Broker is F; its common list is G. An Engine with this configuration uses the following preferences: first: A, B; second: C, F; third: D, E, G. Within each tier, Brokers are equal, and ordering doesn’t matter.
You can also use the Admin API to get or set the tiers. In com.datasynapse.gridserver.admin.BrokerAdmin, use the methods setSharedBrokers and getSharedBrokers to set or get the tier string. You can also create a Batch Definition that uses the Admin API to change the tiers according to a time schedule. For more information about using the Admin API, see the TIBCO GridServer® Developer's Guide.
On the Grid Components > Brokers > Broker Configuration page, you can also set a minimum number of idle home Engines for a Broker by adding the Min Idle Home Engines property column to the page. If the idle home Engine count is below this value, home Engines (idle or busy) are not logged off or shared to other Brokers.