babylon

[简体中文]

Use Arena for brpc

Before invoking a user’s service, brpc needs to construct instances of Request and Response internally, as well as perform corresponding serialization and deserialization operations. By default, it uses dynamic heap memory allocation. For complex structures, the allocation and deallocation of memory, along with the construction and destruction of Message structures, can lead to noticeable overhead.

Since version 3.x, Protobuf has introduced Arena allocation, which enables aggregated allocation and deallocation for complex structures. More recent versions of brpc also support the Protobuf arena component. Based on this, further acceleration for string members can be achieved by applying arenastring.

In addition to using native Arena, you can also employ babylon::SwissMemoryResource for memory pool acceleration. babylon::SwissMemoryResource enables further flexibility through a customizable fixed-size paging reuse mechanism.

Performance Demonstration

CPU: AMD EPYC 7W83 64-Core Processor, taskset 0-3 core

QPS: 800