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

BTP-176: Streamlined Architecture #176

Merged
merged 4 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
41 changes: 41 additions & 0 deletions docs/rfcs/0-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
- Author: (fill me in with `name <mail>`, e.g., Xuanwo <[email protected]>)
- Start Date: (fill me in with today's date, YYYY-MM-DD)
- RFC PR: [beyondstorage/beyond-tp#0](https://github.com/beyondstorage/beyond-tp/issues/0)
- Tracking Issue: [beyondstorage/beyond-tp#0](https://github.com/beyondstorage/beyond-tp/issues/0)

# BTP-0: <proposal name>

- Updates: (delete this part if not applicable)
- [GSP-20](./20-abc): Deletes something
- Updated By: (delete this part if not applicable)
- [GSP-10](./10-do-be-do-be-do): Adds something
- [GSP-1000](./1000-lalala): Deprecates this RFC
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved

## Background

Explain why we are doing this.

Related issues and early discussions can be linked, but the RFC should try to be self-contained if possible.

## Proposal

<proposal's content>

## Rationale

<proposal's rationale content, other implementations>

Possible content:

- Design Principles
- Drawbacks
- Alternative implementations and comparison
- Possible Q&As

## Compatibility

<proposal's compatibility statement>

## Implementation

Explain what steps should be done to implement this proposal.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: draft
updated_at: 2021-07-05
---

# DMP-110: Refactor Task Distribute
# BTP-110: Refactor Task Distribute

## Background

Expand Down Expand Up @@ -74,4 +74,4 @@ None
- subscribe prefix `s_t:{staff-id}:` (replace with its own staffID) when poll task
- to ensure the data consistency, we can use `transaction` between modify task status and insert `staff-task relation`.

Most of the work would be done by the author of this proposal.
Most of the work would be done by the author of this proposal.
69 changes: 69 additions & 0 deletions docs/rfcs/176-streamlined-architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
- Author: Xuanwo <[email protected]>
- Start Date: 2021-09-29
- RFC PR: [beyondstorage/beyond-tp#176](https://github.com/beyondstorage/beyond-tp/issues/176)
- Tracking Issue: [beyondstorage/beyond-tp#0](https://github.com/beyondstorage/beyond-tp/issues/0)
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved

# BTP-176: Streamlined Architecture

## Background

BeyondTP is designed to be a neutral data migration service, providing private deployment, SaaS services, and other delivery forms.

So we have a complex architecture:

```
Manager ----> Agent --+--> Leader
|
|
+--> Worker --+--> Runner
|
+--> Runner
```

Manager is the manager node of BeyondTP, it will take the following jobs:

- Agent management, including register, monitor, and so on.
- Task management, including task create/start/delete/distribute and so on.
- GraphQL API and GUI.

Agent is the client node of BeyondTP, it has two roles: Leader and Worker. Every time Agent got a task, it will try to elect as a leader. Only one of them will succeed and others will before a worker.

Every worker will try to contact the leader to poll/create/finish jobs. Inside a worker, it will start multiple runners so that we can run jobs concurrently.

However, it proved to be over-designed. Current architecture made us hard to implement features like:

- Speed limit
- Retry failed job
- Speed monitor
- Task report
- ...

## Proposal

So I propose to use streamlined architecture: merge manager and leader.

In this design, our architecture will be quite simple:

```
Server --> Client --+-> Worker
|
+-> Worker
|
+-> Worker
```

- Server will responsible for all coordinated operations
- client will focus on executing tasks
Comment on lines +55 to +56
Copy link
Contributor

Choose a reason for hiding this comment

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

I was a little confused about Server and Client at first glance. Are they corresponding to the grpc server(maybe also including web server, graphQL server and task manager) and grpc client?

Copy link
Contributor Author

@Xuanwo Xuanwo Sep 30, 2021

Choose a reason for hiding this comment

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

Yes.

  • the Server will include rpc server, ui server, and http server (aka, graphQL server).
  • the Client here is the rpc client which only communicates with rpc server.

For the user side, he will use

btp agent --role=server --addr=127.0.0.1:8000
btp agent --role=client --join=127.0.0.1:8000

- Every client will spawn multiple workers to executing jobs.

## Rationale

N/A

## Compatibility

Brand new design, we will refactor the whole architecture.

## Implementation

As described in the tracking issue.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: draft
updated_at: 2021-05-19
---

# DMP-69: Add identity management APIs
# BTP-69: Add identity management APIs

## Background

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: draft
updated_at: 2021-05-19
---

# DMP-71: Add list staffs API
# BTP-71: Add list staffs API

## Background

Expand Down Expand Up @@ -53,4 +53,4 @@ None

## Implementation

Most of the work would be done by the author of this proposal.
Most of the work would be done by the author of this proposal.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: draft
updated_at: 2021-06-24
---

# DMP-99: Add job metadata
# BTP-99: Add job metadata

## Background

Expand Down Expand Up @@ -87,4 +87,4 @@ None

## Implementation

Most of the work would be done by the author of this proposal.
Most of the work would be done by the author of this proposal.