[GitHub] [brpc] FightingCoder opened a new issue, #2094: 约千分之一的请求server耗时严重

2023-01-17 Thread GitBox


FightingCoder opened a new issue, #2094:
URL: https://github.com/apache/brpc/issues/2094

   **Describe the bug (描述bug)**
   
io-bound型服务,服务压力很低。查看工作线程数以及cpu使用程度都没有问题。bthread_worker_count:9,bthread_worker_usage维持在1.5以下。process_cpu_usage
 0.5以下。排除锁的嫌疑。
   使用rpcz发现耗时大的请求都卡在了最后Leave阶段,以下是其中一个,Leave 
core.HttpService.HotSearch阶段耗时350ms:
   2023/01/18-14:58:29.320573 Received request(1378) from 127.0.0.1:53900 http 
log_id=0 trace=99c59dc851f7088b span=c51c916151762d93
   14:58:29.320625.52 Processing the request in a new bthread
   14:58:29.320672.47 Enter core.HttpService.HotSearch
   14:58:29.320753.81 Requesting redis-server@xxx redis log_id=0 
call_id=7142530642355 trace=99c59dc851f7088b 
span=[c51c916151762d94](http://xxx/rpcz?trace=99c59dc851f7088b&span=c51c916151762d94)
   14:58:29.320770.17 Requested(49) [1]
   14:58:29.322242.  1472 Received response(14) of request[1]
   14:58:29.322252.10 Processing the response in a new bthread
   14:58:29.322256. 4 Back to user's callsite
   ...
   14:58:29.468671.17 Requested(467) [1]
   14:58:29.469738.  1067 Received response(5) of request[1]
   14:58:29.469747. 9 Processing the response in a new bthread
   14:58:29.469751. 4 Back to user's callsite
   14:58:29.820964.351213 Leave core.HttpService.HotSearch
   14:58:29.821091.   127 Responded(5280)
   
   
   **To Reproduce (复现方法)**
   
   
   **Expected behavior (期望行为)**
   
   
   **Versions (各种版本)**
   OS: CentOS Linux release 7.9.2009
   Compiler: gcc8
   brpc: 0.9.7
   protobuf: 3.19
   
   **Additional context/screenshots (更多上下文/截图)**
   


-- 
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: dev-unsubscr...@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn commented on pull request #2093: Add Mysql Protocol

2023-01-17 Thread GitBox


yanglimingcn commented on PR #2093:
URL: https://github.com/apache/brpc/pull/2093#issuecomment-1385095711

   mysql的prepared statement协议的支持。
   遇到的两个问题解决方案如下:
   1、prepared statement首先是在某个连接上创建一个statement id,后续操作可以根据这个statement 
id向这个连接发送后续的请求。同一个语句在每个连接上的statement 
id是不同的。在pooled模式下,每次RPC选择的连接是不同的,所以需要记录SocketId和statement 
id的关系,我们这里称为id_map。但是一个SocketId有可能关闭,然后又重新建立起来,这个新SocketId对应的连接没有这个statement 
id。id_map没有机制可以做到同步更新,保存的SocketId与statement id关系信息是旧的关系。这样就会产生问题。
   
这个问题的修改方式是,给socketid对应的fd一个唯一的版本号,每次通过stmt_id找到socketid的时候对比一下版本号,版本号一致说明fd没有变化,版本号不一致说明fd变化过。
   
2、目前还不能支持single模式,唯一的原因就是auth部分,正常auth多个请求会竞争发送auth,后续操作就不需要发送auth了,auth不用等待服务端应答,就可以让其他请求继续发送。但是mysql的auth和这个逻辑不通,mysql的auth首先接收mysql-server发送过来的salt,客户端根据salt加密密码,再把加密后的密码发送给服务端。这样的逻辑如果不等待服务端应答就解锁别的请求,就会出现发送auth的请求落后于正常的请求,导致消息乱序。
   这个目前就先不支持single模式了。


-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn opened a new pull request, #2093: Add Mysql Protocol

2023-01-17 Thread GitBox


yanglimingcn opened a new pull request, #2093:
URL: https://github.com/apache/brpc/pull/2093

   Add Mysql Protocol, support text protocol, transaction, support prepare 
statement.
   
   issue #209
   
   ### What problem does this PR solve?
   
   Issue Number:
   
   Problem Summary:
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects(性能影响):
   
   - Breaking backward compatibility(向后兼容性): 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related 
tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of 
Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn closed pull request #692: Add Mysql Protocol, support transaction and prepared statement

2023-01-17 Thread GitBox


yanglimingcn closed pull request #692: Add Mysql Protocol, support transaction 
and prepared statement
URL: https://github.com/apache/brpc/pull/692


-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn closed pull request #722: Mysql transaction

2023-01-17 Thread GitBox


yanglimingcn closed pull request #722: Mysql transaction
URL: https://github.com/apache/brpc/pull/722


-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn closed pull request #760: MySQL Prepared Statement support

2023-01-17 Thread GitBox


yanglimingcn closed pull request #760: MySQL Prepared Statement support
URL: https://github.com/apache/brpc/pull/760


-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org