Communication and Task Scheduling

When Engines are configured as multiplexed, communication with the Broker is multiplexed over a single HTTP keep-alive session to reduce overhead. Also, only one heartbeat is communicated per process. Heartbeats are received by Engine instance zero and simulated to the other Engine Proxies.

To prevent starvation of Engines to other Service sessions, a lease duration is defined. This is the amount of time a set of multiplexed Engines work on one Service before they stop working on that Service and are allowed to work on others if necessary. The lifecycle for this is as follows, given a lease duration of 5 minutes:

When work is started on the Grid, Engine instance 0 picks up a task.
Immediately following that, all other instances pick up tasks from the same Service session.
Assuming there is enough work, the instances continue to take tasks from that session.
After five minutes has passed, when any instance finishes a task, it does not pick up any more tasks.
As soon as the last instance has finished, immediately after the response has been written, Engine instance 0 requests another task from any appropriate session. It could be the same session or another session.