Skip to main content

Distributed Coordination Protocol

Coordination across time and space

The Distributed Coordination Protocol is responsible for the coordination of distributed function executions.

Eventual Resumption

Eventual resumption occurs when when the calling execution E1 awaits a promise P2 that is not yet resolved. The calling execution E1 is suspended until the promise P2 is resolved or rejected.

Distributed Coordination Protocol sequence diagram

  1. When the calling execution E1, identified by Durable Promise P1 and hosted on worker W1, invokes a function remotely, W1 sends a request to create a Durable Promise (P2) to the server S.

  2. Upon receiving the request, the server S creates the durable promise P2.

  3. The Server S sends a response to W1 which forwards P2 to E1.

  4. The server S sends an Invoke(P2) message to process group GB, here delivered to worker W2

  5. Worker W2 spawns execution E2

  6. When the calling execution E1 awaits promise P2, W1 sends a request to register a callback Resume(P1, P2) deliverable to GA with preference W1 on P2 to server S

  7. Upon receiving the request, since P2 is still pending, server S registers the callback C1 with promise P2.

  8. Server S sends a response indicating success to worker W1, which suspends E1

  9. When the called execution E2 returns, the worker W2 sends a request to resolve or reject durable promise P2 to the server S

  10. Upon receiving the request, the server S resolves or rejects the durable promise P2.

  11. Server S sends a response containing P2 to W2.

12.The server S sends a Resume(P1, P2) message to process group GA with the preference of W1, here delivered to worker W1, which suspends E1.

Immediate Resumption

Immediate resumption occurs when the calling execution E1 awaits a promise P2 that is already resolved.

Distributed Coordination Protocol sequence diagram

  1. When the calling execution E1, identified by durable promise P1 and hosted on worker W1, invokes a function remotely, W1 sends a request to create a durable promise P2 to the server S.

  2. Upon receiving the request, the server S creates the durable promise P2.

  3. Server S sends a response to W1, which forwards P2 to E1.

  4. The server S sends an Invoke(P2) message to process group GB, here delivered to worker W2.

  5. Worker W2 spawns execution E2.

  6. When the called execution E2 returns, the worker W2 sends a request to resolve or reject durable promise P2 to the server S.

  7. Upon receiving the request, the server S resolves or rejects the durable promise P2.

  8. Server S sends a response containing P2 to W2.

  9. When the calling execution E1 awaits promise P2, W1 sends a request to register a callback Resume(P1, P2) deliverable to GA with preference W1 on P2 to server S.

  10. Upon receiving the request, since P2 is already completed, server S does not register a callback.

  11. Server S sends a response indicating the callback was not registered because the promise is already completed to worker W1, which resumes E1.