You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-21Lines changed: 20 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ int main()
44
44
* This project has built-in **service governance** and **load balancing** features.
45
45
* Wiki link : [PaaS Architecture](https://github.com/sogou/workflow/wiki)
46
46
47
-
#### Compiling and running environment
47
+
#### Compiling and Running Environment
48
48
49
49
* This project supports `Linux`, `macOS`, `Windows`, `Android` and other operating systems.
50
50
*`Windows` version is currently released as an independent [branch](https://github.com/sogou/workflow/tree/windows), using `iocp` to implement asynchronous networking. All user interfaces are consistent with the `Linux` version.
@@ -53,7 +53,7 @@ int main()
53
53
* Uses the `C++11` standard and therefore, it should be compiled with a compiler which supports `C++11`. Does not rely on `boost` or `asio`.
54
54
* No other dependencies. However, if you need `Kafka` protocol, some compression libraries should be installed, including `lz4`, `zstd` and `snappy`.
We believe that a typical back-end program=protocol+algorithm+workflow and should be developed completely independently.
139
+
Program = Protocol + Algorithm + Workflow
140
140
141
141
* Protocol
142
142
* In most cases, users use built-in common network protocols, such as HTTP, Redis or various rpc.
@@ -151,35 +151,34 @@ We believe that a typical back-end program=protocol+algorithm+workflow and shoul
151
151
* The typical workflow is a closed series-parallel graph. Complex business logic may be a non-closed DAG.
152
152
* The workflow graph can be constructed directly or dynamically generated based on the results of each step. All tasks are executed asynchronously.
153
153
154
-
Basic task, task factory and complex task
154
+
Structured Concurrency and Task Abstraction
155
155
156
-
* Our system contains six basic tasks: networking, file IO, CPU, GPU, timer, and counter.
157
-
* All tasks are generated by the task factory and automatically recycled after callback.
158
-
* Server task is one kind of special networking task, generated by the framework which calls the task factory, and handed over to the user through the process function.
159
-
* In most cases, the task generated by the user through the task factory is a complex task, which is transparent to the user.
156
+
* Our system contains five basic tasks: communication, computation, file IO, timer, and counter.
157
+
* All tasks are generated by the task factory, and users organize the concurrency structure by calling interfaces, such as series, parallel, DAG, etc.
158
+
* In most cases, the tasks generated by the user through the task factory is a complex task which encapsulates multiple asynchronous processes, but it is transparent to the user.
160
159
* For example, an HTTP request may include many asynchronous processes (DNS, redirection), but for user, it is just a networking task.
161
160
* File sorting seems to be an algorithm, but it actually includes many complex interaction processes between file IO and CPU computation.
162
161
* If you think of business logic as building circuits with well-designed electronic components, then each electronic component may be a complex circuit.
162
+
* The task abstraction mechanism greatly reduces the number of tasks users need to create and the depth of callbacks.
163
+
* Any task runs in a **SeriesWork** and the tasks in the same SeriesWork shares the series context, which simplifies data transfer between asynchronous tasks.
163
164
164
-
Asynchrony and encapsulation based on `C++11 std::function`
165
+
Callback and Memory Reclamation Mechanism
165
166
166
-
* Not based on user mode coroutines. Users need to know that they are writing asynchronous programs.
167
167
* All calls are executed asynchronously, and there is almost no operation that occupies a thread.
168
-
* Although we also provide some facilities with semi-synchronous interfaces, they are not core features.
168
+
* Explicit callback mechanism. Users are aware that they are writing asynchronous programs.
169
+
***A set of object lifecycle mechanisms greatly simplifies memory management for asynchronous programs.**
170
+
* The lifecycle of any task created by the framework is from creation until the callback functionfinishes running. There is no risk of leakage.
171
+
* If a task is created but the user does not want to run it, the user needs to release it through the `dismiss()` interface.
172
+
* Any data in the task, such as the response of the network request, will also be recycled with the task. At this time, the user can use `std::move()` to move the required data.
173
+
* The project doesn’t use `std::shared_ptr` to manage memory.
174
+
169
175
* We try to avoid user's derivations, and encapsulate user behavior with `std::function` instead, including:
170
176
* The callback of any task.
171
177
* Any server's process. This conforms to the `FaaS` (Function as a Service) idea.
172
178
* The realization of an algorithm is simply a `std::function`. But the algorithm can also be implemented by derivation.
179
+
* If used deeply, one will find that everything can be derived.
173
180
174
-
Memory reclamation mechanism
175
-
176
-
* Every task will be automatically reclaimed after the callback. If a task is created but a user does not want to run it, the user needs to release it through the dismiss method.
177
-
* Any data in the task, such as the response of the network request, will also be recycled with the task. At this time, the user can use `std::move()` to move the required data.
178
-
* SeriesWork and ParallelWork are two kinds of framework objects, which are also recycled after their callback.
179
-
* When a series is a branch of a parallel, it will be recycled after the callback of the parallel that it belongs to.
180
-
* This project doesn’t use `std::shared_ptr` to manage memory.
181
-
182
-
#### Any other questions?
181
+
#### Any Other Questions?
183
182
184
183
You may check the [FAQ](https://github.com/sogou/workflow/issues/406) and [issues](https://github.com/sogou/workflow/issues) list first to see if you can find the answer.
0 commit comments