Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: DR for clustered data-plane #4522

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Clustered data-plane

## Decision

We will make the data-plane being able to run in a clustered environment.

## Rationale

Currently, data-plane cannot run effectively in a clustered environment because:
- there's no way to identify a specific replica that is running a data flow and "terminate/suspend" it
- there's no way to re-start a data flow that was interrupted because the replica crashed

## Approach

We will provide this feature through the `DataPlaneStore` persistence layer.
A `runtimeId` will be added in the `DataFlow`, and it will be set when it gets started with the replica's `runtimeId`.
There will be a configured duration `flowLease` (that can be in milliseconds, seconds at most).

### Identify specific replica to suspend/terminate

The now synchronous `suspend`/`terminate` will become asynchronous by putting the `DataFlow` in a `-ING` state like:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These will be propagated back to the control plane, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are releated to DataFlow, because SUSPENDING and TERMINATING in the control-plane have different meaning.
only when the DataFlow would been correctly SUSPENDED or TERMINATED the control-plane will be advertised and it would transition the transfer from the SUSPENDING/TERMINATING state to SUSPENDED/TERMINATED

Copy link
Contributor

@jimmarino jimmarino Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I meant the transition to Dataflow terminated, now that the operation is async. There's two ways to approach this:

  1. Have the control plane transition to TERMINATING and wait until the DataFlow is TERMINATED before itself transitioning to TERMINATED
  2. Have the control plane send a terminate message to the data plane and immediately transition to TERMINATED once the ack is received.

Appraoch 2 is a lot easier and straightforward without much downside. It does place the burden on the data plane to handle the terminate message correctly or perform some form of cleanup if it fails but that I think is acceptable.

What do you think? Perhaps this should be documented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 2 will be enough because termination of data flow it's just a cleanup operation, generally speaking it should be quick to complete. I will add some details to the DR

- `SUSPENDING`
- `TERMINATING`

For termination (the same logic will be duplicated for suspension), in the `DataPlaneManager` state machine there will be
two new `Processor` registered:
- one filters by `TERMINATING` state and `runtimeId`: it will stop the data flow and transition it to `TERMINATED`
- one filters by `TERMINATING` and by `updatedAt` passed by at least 2/3 times `flowLease`: it will transition the data flow to
`TERMINATED` (as cleanup for dangling data flows).

Note: once the "termination" message is sent from the control-plane to the data-plane and the ACK received, the control-plane
will consider the `DataFlow` as terminated, and it will continue evaluating the termination logic on the `TransferProcess`
(send protocol message, transition to `TERMINATED`).
We consider this acceptable because `DataFlow` termination is generally a cleanup operation that shouldn't take too much time.

### Re-start interrupted data flow

Please consider `flowLease` as a configured time duration (milliseconds, seconds at most).

A running data flow will need to update the `updatedAt` field every `flowLease`
In the `DataPlaneManager` state machine, fetches items in `STARTED` with `runtimeId` different from the replica one,
that have `updatedAt` past by at least 2/3 times `flowLease`.
These data-flows can then be started again

1 change: 1 addition & 0 deletions docs/developer/decision-records/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@
- [2024-08-16 Policy_Validation](./2024-08-16-policy-validation)
- [2024-09-24 STS Accounts API](./2024-09-24-sts-accounts-api)
- [2024-09-25 Multiple Protocol Versions](./2024-09-25-multiple-protocol-versions)
- [2024-10-02 Clustered data-plane](./2024-10-02-clustered-data-plane/)
Loading