brpc icon indicating copy to clipboard operation
brpc copied to clipboard

about support protobuf arena

Open heyuyi0906 opened this issue 5 years ago • 7 comments

#535 麻烦看下这个实现是否可以被接受,当前先只改了baidu rpc protocol。

heyuyi0906 avatar Jul 18 '20 13:07 heyuyi0906

赞,好奇有多少的性能提升?

yjhjstz avatar Aug 10 '20 03:08 yjhjstz

在大包情况下,自测发现对于性能提升还是比较明显的。 support_pb_arena分支测试结果: image master分支测试结果: image

测试条件: 机器:8核 Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz protobuf版本:v3.6.1 压测工具:rpc_press thread_num=50 协议:

syntax="proto2";
package example;

option cc_generic_services = true;

message Obj {
    optional uint64 val = 1;
};

message EchoRequest {
    required string message = 1;
    repeated double array = 2;
    repeated Obj objs = 3;
};

message EchoResponse {
    required string message = 1;
    repeated double array = 2;
    repeated Obj objs = 3;
};

service EchoService {
      rpc Echo(EchoRequest) returns (EchoResponse);
};

server处理逻辑:

        response->set_message(request->message());

        for (int i = 0; i < request->array_size(); ++i) {
            response->add_array(request->array(i));
        }

        for (int i = 0; i < request->objs_size(); ++i) {
            auto o = response->add_objs();
            o->set_val(request->objs(i).val());
        }

压测input:

{
  "message":"xxx......", 
  "array":[2.9,2.9,......],
  "objs":[{"val":10},......]
}

message字符串长度16384 array包含8192个double objs包含8192个对象

heyuyi0906 avatar Aug 10 '20 11:08 heyuyi0906

大包看起来效果不错,方便看下不同包大小的场景下(比如16B,32B,64B,128B,256B,512B...)的性能差异么,这些包更典型些

zyearn avatar Aug 10 '20 13:08 zyearn

好,我补充下这块的数据

heyuyi0906 avatar Aug 11 '20 12:08 heyuyi0906

请问这个pr没合入是还存在什么问题么?

limindlmu avatar Aug 30 '24 07:08 limindlmu

请问这个pr没合入是还存在什么问题么?

现在可以使用 https://github.com/apache/brpc/pull/2718 中提供的功能,通过自定义RpcPBMessageFactory来支持arena

wwbmmm avatar Sep 02 '24 09:09 wwbmmm

请问这个pr没合入是还存在什么问题么?

@limindlmu 可以看看#2751 。

chenBright avatar Sep 02 '24 10:09 chenBright

Closed this as completed #2751 .

chenBright avatar Oct 29 '24 07:10 chenBright