workflow README

The project's README from github.com/sogou/workflow. As one markdown file: README.md.

简体中文版(推荐)

Sogou C++ Workflow

License Language Platform Build Status

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.

You can use it:

#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;
}

Compiling and Running Environment

Get Started (Linux, macOS):

git clone https://github.com/sogou/workflow
cd workflow
make
cd tutorial
make

With SRPC Tool (NEW!):

https://github.com/sogou/srpc/blob/master/tools/README.md

With apt-get on Debian Linux, ubuntu:

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

With dnf on Fedora Linux:

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

With xmake

If you want to use xmake to build workflow, you can see xmake build document

Tutorials

Programming Paradigm

Program = Protocol + Algorithm + Workflow

Structured Concurrency and Task Abstraction

Callback and Memory Reclamation Mechanism

Any Other Questions?

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.

workflow (sogou/workflow)

Searching Database…

14.4K ·GitHub
What is this?Sogou C++ Workflow is an enterprise-grade C++ engine for asynchronous networking and parallel computing, used internally by Sogou to power search, cloud input method, and ad services, handling billions of requests daily.
Is it a framework or just a networking library?It is a full asynchronous programming framework: besides being a multi-protocol client/server library (HTTP, Redis, MySQL, Kafka), it also lets you build custom protocols, your own RPC system, and arbitrary DAG-based workflows combining networking and computation.
How do I add this to my project?Install prebuilt packages via apt-get on Debian/Ubuntu or dnf on Fedora, build with xmake, or compile from source with make; then follow the tutorials (e.g. 'wget' client example) to write your first task.
What do I need to build it?A C++11-capable compiler and OpenSSL 1.1+ (BoringSSL also works); it has no boost or asio dependency, but the Kafka protocol needs lz4, zstd and snappy compression libraries.
Is the Windows version on par with Linux?Windows support ships as a separate branch using IOCP instead of the Linux epoll-based implementation, though the user-facing interfaces are kept identical to the Linux version.
Which platforms and CPUs does it run on?It runs on Linux, macOS, Windows and Android, across 32/64-bit x86, big- and little-endian ARM, and Loongson processors.
How does Workflow relate to srpc?srpc is a separate open-source RPC system built on top of Workflow, adding support for the srpc, brpc, trpc and thrift protocols.
Can workflows be more complex than simple series/parallel chains?Yes, in addition to common series and parallel structures the framework supports arbitrary DAG (directed acyclic graph) task topologies.
What clients come built in out of the box?It ships with ready-made asynchronous clients for HTTP, Redis, MySQL (and MariaDB/TiDB), and Kafka, so you don't need to write your own protocol code for these.
How does it avoid memory leaks in async callback code?Every task's lifetime runs from creation to its callback finishing, after which it's automatically reclaimed; unwanted tasks must be released via dismiss(), and the design deliberately avoids std::shared_ptr in favor of std::function-based callbacks.
What are similar projects?brpc, consul, swoole-src, pingora, go-zero, istio, zenc, eureka
Creator
sogou
Size
5 MB
Stars
14.4K
Age
6y
Commits · 90 Days