Backend Development 8 min read

Introducing Sogou C++ Workflow: A High‑Performance Network Framework

The article presents Sogou's open‑source C++ Workflow framework, highlighting its industrial‑grade performance, simple asynchronous API for servers and clients, benchmark results, and key features such as integrated task scheduling, extensive documentation, and real‑world adoption across many companies.

Refining Core Development Skills
Refining Core Development Skills
Refining Core Development Skills
Introducing Sogou C++ Workflow: A High‑Performance Network Framework

Today I introduce Sogou's latest official open‑source project – the Sogou C++ Workflow!

Workflow is a high‑performance network framework that quickly earned 3.6k stars; within Sogou it powers almost all C++ backend services—including search, input method, advertising—and handles over a hundred billion requests daily, making it an industrial‑grade solution already adopted by dozens of companies.

GitHub address: https://github.com/sogou/workflow

Server‑side example – using Workflow you can write an HTTP server in just a few lines, similar to Go:

void process(WFHttpTask *server_task) {
    server_task->get_resp()->append_output_body("Hello World!");
}

int main(int argc, char *argv[]) {
    ...
    WFHttpServer server(process);
    if (server.start(8888) == 0) {
        server.stop();
    }
    return 0;
}

Full source: https://github.com/sogou/workflow/blob/master/docs/tutorial-04-http_echo_server.md

Workflow hides all low‑level concepts such as I/O threads, worker threads, task queues, and timeout handling, offering an extremely simple development model.

Performance comparison – the article reproduces benchmark results (CPU 40‑core @2.20 GHz, 192 GB RAM, 25 Gbps NIC). Workflow uses 16 poller threads and 20 handler threads, while nginx uses 40 workers and brpc uses 40 threads. Data lengths of 64, 512, and 4096 bytes were tested with concurrency ranging from 1 to 2 K.

Especially for data lengths of 64 and 512 bytes, the curves show that Workflow can sustain 500 K QPS when concurrency is sufficient.

Client‑side optimization – blocking network I/O is a major bottleneck for high‑performance servers. Workflow implements pure asynchronous clients for MySQL, HTTP, Redis, Kafka, etc., integrating their sockets with poller threads for efficient non‑blocking I/O.

MySQL asynchronous client example:

// Process result in callback
void mysql_callback(WFMySQLTask *task) {
    ...
}

int main(int argc, char *argv[]) {
    ...
    task = WFTaskFactory::create_mysql_task(url, RETRY_MAX, mysql_callback);
    task->get_req()->set_query("show databases");
    task->start();
    ...
}

Full source: https://github.com/sogou/workflow/blob/master/docs/tutorial-12-mysql_cli.md

With just a few lines you can submit an asynchronous MySQL task; under proper configuration a single machine can handle tens of thousands of MySQL requests per second.

Other features

1. User‑friendly experience – developers work with high‑level task and series abstractions, focusing solely on application logic without worrying about threads.

2. Integrated communication and computation – unlike many C++ frameworks that only address network I/O, Workflow also provides task scheduling and resource coordination across network, disk, etc.

3. Comprehensive documentation and demos – the project includes complete docs, examples, and a QQ support group (ID: 618773193) for troubleshooting.

Project address: https://github.com/sogou/workflow

Star the repository and don’t miss out!

Finally, the article shares the public account of one of Workflow’s architects, who periodically publishes explanatory posts.

Related hot articles

Sogou releases two major open‑source projects – have you heard of them?

Sogou’s pure‑async MySQL client open‑sourced – tens of thousands of queries per second!

Single‑machine 400 K QPS with Sogou WF framework – a must‑learn open‑source code.

Sogou Workflow asynchronous scheduling framework – basic introduction.

backendperformanceasynchronousOpen-sourceC++Network Framework
Refining Core Development Skills
Written by

Refining Core Development Skills

Fei has over 10 years of development experience at Tencent and Sogou. Through this account, he shares his deep insights on performance.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.