README.md
As Sogou`s C++ server engine, Sogou C++ Workflow supports almost all back-end C++ online services of Sogou, including all search services, cloud input method, online advertisements, etc., handling more than 10 billion requests every day. This is an enterprise-level programming engine in light and elegant design which can satisfy most C++ back-end development requirements.
#include <stdio.h>
#include "workflow/WFHttpServer.h"
int main()
{
WFHttpServer server([](WFHttpTask *task) {
task->get_resp()->append_output_body("<html>Hello World!</html>");
});
if (server.start(8888) == 0) { // start server on port 8888
getchar(); // press "Enter" to end.
server.stop();
}
return 0;
}
HTTP, Redis, MySQL and Kafka protocols.
MySQL protocol supports MariaDB, TiDB as well.Linux system, with high performance exceeding any system call. Disk file IO is also a task.Linux, macOS, Windows, Android and other operating systems.
Windows version is currently released as an independent branch, using iocp to implement asynchronous networking. All user interfaces are consistent with the Linux version.x86 processors, big-endian or little-endian arm processors, loongson processors.OpenSSL 1.1 or above, and BoringSSL is fully compatible. If you don't like SSL, you may checkout the nossl branch.C++11 standard and therefore, it should be compiled with a compiler which supports C++11. Does not rely on boost or asio.Kafka protocol, some compression libraries should be installed, including lz4, zstd and snappy.git clone https://github.com/sogou/workflow
cd workflow
make
cd tutorial
make
https://github.com/sogou/srpc/blob/master/tools/README.md
Sogou C++ Workflow has been packaged for Debian Linux and ubuntu 22.04.
To install the Workflow library for development purposes:
sudo apt-get install libworkflow-dev
To install the Workflow library for deployment:
sudo apt-get install libworkflow1
Sogou C++ Workflow has been packaged for Fedora Linux.
To install the Workflow library for development purposes:
sudo dnf install workflow-devel
To install the Workflow library for deployment:
sudo dnf install workflow
If you want to use xmake to build workflow, you can see xmake build document
Program = Protocol + Algorithm + Workflow
Structured Concurrency and Task Abstraction
Callback and Memory Reclamation Mechanism
All calls are executed asynchronously, and there is almost no operation that occupies a thread.
Explicit callback mechanism. Users are aware that they are writing asynchronous programs.
A set of object lifecycle mechanisms greatly simplifies memory management for asynchronous programs.
dismiss() interface.std::move() to move the required data.std::shared_ptr to manage memory.We try to avoid user's derivations, and encapsulate user behavior with std::function instead, including:
FaaS (Function as a Service) idea.std::function. But the algorithm can also be implemented by derivation.You may check the FAQ and issues list first to see if you can find the answer.
You are very welcome to send the problems you encounter in use to issues, and we will answer them as soon as possible. At the same time, more issues will also help new users.