Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRPC的链路跟踪与性能测试 #86

Closed
zebingzhou opened this issue Jul 30, 2021 · 1 comment
Closed

SRPC的链路跟踪与性能测试 #86

zebingzhou opened this issue Jul 30, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@zebingzhou
Copy link

1、链路跟踪有吗, 有埋点方案与可视化工具吗
2、性能测试,用的什么工具,如WIKI介绍中的图,是怎么生成的?

@holmes1412
Copy link
Contributor

1.链路追踪
有的。用法可以参考tutorial-01-srpc_pb_server.cc

SRPCServer server;
RPCSpanDefault<RPCTYPESRPC> span_module; // RPCTYPESRPC作为module的模版,配合server使用
server.add_module(&span_module);

tutorial里由于已经有了,你直接跑起来的话,server会得到:

[SPAN_LOG] trace_id: 1317158132757037056 span_id: 1 service: Example method: Echo start: 1627638902336 end_time: 1627638902336 cost: 0 remote_ip: 127.0.0.1 state: 1 error: 0

而client会得到:

[SPAN_LOG] trace_id: 1317158132757037056 span_id: 0 service: Example method: Echo start: 1627638902336 end_time: 1627638902337 cost: 1 remote_ip: 127.0.0.1 state: 1 error: 0
[SPAN_LOG] trace_id: 1317158132757037058 span_id: 1 service: Example method: Echo start: 1627638902336 end_time: 1627638902337 cost: 1 remote_ip: 127.0.0.1 state: 1 error: 0

这是基于RPCModule实现的一种module,用于请求在框架层帮你做的事情。目前span的功能具体实现有两个:RPCSpanDefaultRPCSpanRedis,分别是打log和入redis库(都是异步做的,不会堵住当前请求),这个接口是开放的,如果你有想要对接的可视化工具,可以模仿代码进行派生实现。

另外支持不同采样需求^_^~~~ 比如,刚才的trace_id: 1317158132757037056在server的log里有、而另一条没有,是因为server对于span的采集默认控制了1s只打一条log。所以你可以构造一个RPCSpanFilterPolicy传给RPCSpan的module指定需要的采样。

2.性能测试
不同的协议是用的不同的测试工具,这个在benchmark里有写。比如,测brpc框架,咱们肯定是用brpc-client,然后对srpc框架的brpc协议和brpc框架的brpc协议进行测试对比。thrift也是一样的。画图用的python带着gnu plot画的。

@Barenboim Barenboim added the documentation Improvements or additions to documentation label Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants