jiangsongHW opened a new issue #1512:
URL: https://github.com/apache/incubator-brpc/issues/1512
**Describe the bug (描述bug)**
brpc server
异步响应模式在往response中写消息字段时,通过前后取时间戳发现,response写pb消息偶现耗时4-5ms,更长时甚至20ms+
response proto格式:
{
optional uint64 id = 1;
optional int32 stat = 2;
optional uint32 cxxdiali = 3;
repeated uint32 acount = 4; //大概40+个
}
在response赋值pb消息前后取时间戳
// send response
**long long tik = GetClock();**
response->set_id (request->id ());
if (succ) {
response->set_stat (STATUS_OK);
} else {
response->set_stat (STATUS_FAILURE);
}
response->set_cxxdiali (carty);
for (int i = 1; i < size; ++i) {
response->add_ acount(xxdialis[i]);
}
**long long tok = GetClock();**
当tok-tik 超时3ms以上记录,占比大概2~3/1000:
cost: 5 1628476500710->1628476500715.
cost: 6 1628476503023->1628476503029.
cost: 8 1628476503323->1628476503331.
cost: 4 1628476505146->1628476505150.
cost: 4 1628476506299->1628476506303.
cost: 5 1628476507680->1628476507685.
cost: 23 1628476508124->1628476508147.
cost: 24 1628476508274->1628476508298.
cost: 23 1628476508455->1628476508478.
cost: 23 1628476508515->1628476508538.
cost: 23 1628476508545->1628476508568.
cost: 23 1628476508755->1628476508778.
cost: 23 1628476508876->1628476508899.
cost: 23 1628476508936->1628476508959.
cost: 23 1628476509056->1628476509079.
**To Reproduce (复现方法)**
**Expected behavior (期望行为)**
**Versions (各种版本)**
OS: linux 3.10.0-514.44.5.10.h254.x86_64
Compiler: gcc 9.x
brpc: 0.9.7
protobuf: 3.6.1
**Additional context/screenshots (更多上下文/截图)**
我的服务占用内存很高,我判断是pb在写消息时申请内存导致的偶现延时增大,请问各位是否有什么优化建议?
我查了pb的资料有arena方式创建message,不知道brpc内是否支持,如何调用?或者各位大佬有其他好的建议?
多谢 !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]