惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News | PayPal Newsroom
Application and Cybersecurity Blog
Application and Cybersecurity Blog
O
OpenAI News
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Latest news
Latest news
NISL@THU
NISL@THU
S
Security Affairs
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
AI
AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AWS News Blog
AWS News Blog
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
I
InfoQ
Schneier on Security
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
IT之家
IT之家
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
L
LINUX DO - 最新话题
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
H
Heimdal Security Blog
S
SegmentFault 最新的问题

文章列表 on polarisxu

通过一个例子让你彻底掌握 Go 工作区模式 这道题正确率竟然只有 22% Go 开源项目推荐:一个简单的 Go 练手项目 go test 如何禁用缓存? Go1.18 快讯:constraints 包被移除标准库 跟着 Go 作者学泛型 「2022 版」轻松搞定 Go 开发环境 鹅厂小哥用行动反对加班:程序员加班能被终结吗? Go 为什么选择 Gopher 作为吉祥物? 本地如何配置多个 GitHub/Gitee 账号? 为 Java 开发者准备的 Go 教程 02:Java 有而 Go 无 GitHub 发现了 studygolang 项目依赖的漏洞 Typora 宣布收费后,这款开源 Markdown 编辑器火了 为 Java 开发者准备的 Go 教程 01:漫游了 我的 2021 年终总结 泛型版 singleflight:Go 中如何防止缓存击穿? 2021 年你写了多少代码?这个 Go 工具帮你统计 Go1.18 新特性:TryLock Go 泛型入门教程 程序员瑞士军刀:各种结构的转换工具 终于有 Go 版的 Elasticsearch 了 Go泛型系列:maps 包讲解 Go 1.18 中的 any 是什么? Go1.18 快讯:新的 IP 包 Go编程模式:详解函数式选项模式 Go泛型系列:slices 包讲解 Nginx 竟然也有 playground — Go 语言构建的 Go泛型系列:Go1.18 类型约束那些事 Go1.18 快讯:Module 工作区模式 Go1.18 快讯:新增的 Cut 函数太方便了 Go1.18 快讯:废弃了这个 API Go1.18 快讯:新增字符串 Clone API Go:如何获得项目根目录? Go 如何获取和设置环境变量 重磅变动:更快找到微信公众号里的Go文章 Go 这样设置版本号:我们的项目也可以 假期结束,推荐 2 本 manning 出的 Go 图书 Go Fiber 框架系列教程 04:测试应用 Go Fiber 框架系列教程 03:中间件 Go泛型系列:提前掌握Go泛型的基本使用 推荐一个 Go GUI 实战项目 Go Fiber 框架系列教程 02:详解相关 API 的使用 Go Fiber 框架系列教程 01: 和 Express 对比学习 Go Module:私有不合规库怎么解决引用问题 Go1.17 新特性:go get 变了 Go1.17 新特性:testing 包的相关变化 StackOverflow 上关于 Go select 死锁的问题 新书推荐:用 Gin 框架构建分布式应用 Go 官网要变天。。。 Gin 这是要成为 Go 官方框架? 扬眉吐气:刚刚,Go 已经默认支持泛型了 Go 1.17 新特性:Module 有哪些变化? Go 第三方库推荐:类型转换如此简单 担心密码提交到 GitHub?建议使用这个 Go 开源工具 Go 的时间格式化为什么是 2006-01-02 15:04:05? GitHub 为 Go 社区带来安全支持 Go开源项目推荐:500行代码确认请求时间花在哪 一道关于 len 函数的诡异 Go 面试题解析 厉害了我的 Go:推荐系统都有开源实现 Go1.17 新特性:新版构建约束 这个工具真好:看看你的Go项目依赖有无漏洞 网友很强大,发现了Go并发下载的Bug Rust 劝退系列 09:函数 Go项目实战:一步步构建一个并发文件下载器 这本 Go 新书挺期待的:100 个常见错误 Go 启用新的官方问答社区 这是要干嘛?!微软招 Go 编译器全职开发人员 Go1.17 快报之标准库越来越注重易用性 Go1.17 新特性之切片变数组 回顾 Go 官网的演变史 站长8年前的Go代码竟然进入大厂的项目里了 Go图书翻译:一个好消息,一个坏消息 不怕烂尾!决定组织翻译这本 Go 图书 Rust 劝退系列 08:模式匹配 一本花了2.5年写成的Go免费在线图书 被黑惨了:一句话,说明自己会 Go,咋整? Go1.16 中的新函数 signal.NotifyContext 怎么用? Go 1.17 新特性提前学之测试执行随机化 Rust 劝退系列 07:流程控制 官方的 Go 多版本管理:使用和原理 Rust新书:给你一个劝退的理由 周刊题解:常量表达式这个规则应该了解下 盘点那些使用 Go 语言的国外公司 编写了50万行Go代码是一种什么体验 Rust 劝退系列 06:常量 Uber 使用 Go 的规模这么大?!都自己定制的 Go 编译器了 Go Team Leader — rsc 大神新开源了一个库,增强模板功能 再一次看到了 Go 的节制:int128 类型要不要支持? Rust 劝退系列 05:复合数据类型 「卷」有理论依据:海勒姆定律—Go又是怎么卷的 Go 真的也可以进行 GUI 开发:还有这样的图书呢 Rust 劝退系列 04:基本数据类型 我的 Go 语言书单 Rust 劝退系列 03:变量 我又来推荐免费 Go 新书了:一本用 Go 讲架构的书 注释竟然还有特殊用途?一文解惑 //go:linkname 指令 这个功能,公众号、微信群会不会被玩坏? 一道 Go 闭包题,面试官说原来自己答错了:面别人也涨知识 Rust 劝退系列 02:第一个 Rust 程序 Rust 劝退系列 01:打造开发环境
对 gRPC 的 Rust 和 Go 版本进行基准测试
2020-07-16 · via 文章列表 on polarisxu

背景

如果你计划构建可靠,内存安全 ,高性能的应用程序,那么 Rust&Go 无疑会是你的选择。

如果您希望从内部应用程序中获得更高的性能,则可能还需要考虑使用 gRPC 而不是普通的 REST API。所有这些都是减少您的计算开销的解决方案。

我尝试比较各种库以了解它们的性能,并希望对你有所帮助。

关注的库

  • tower-grpc (Rust)

    高性能 rust 库,尽管已被 tonic 替代

  • grpc-go (Golang)

    grpc 的官方 Go 模块

  • grpc-rust (Rust)

    仍在开发中,另一个 rust grpc 库。看起来很不错

  • tonic (Rust)

    tower-grpc 库的改进更新,支持新的 await 语法

  • grpc-node (NodeJs)

    包含有基准基准点

  • grpc-rs (Rust — C bindings)

    使用 grpc 的 rust 库

基准测试工具

对于基准测试,我将在 gRPC 中使用与 Hey 等效的 ghz

该测试将重点关注如果使用上述每个库将 10,000 个并发请求的相同负载发送到服务器,将有多少开销。我将为每个使用相同的 helloworld greeter。不会为任何测试启用 TLS,因此我们可以大致了解每种测试的原始性能。

grpc-go

Summary:
  Count: 10000
  Total: 229.40 ms
  Slowest: 6.26 ms
  Fastest: 0.11 ms
  Average: 1.04 ms
  Requests/sec: 43591.54Response time histogram:
  0.114 [1]    |
  0.728 [3355] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1.343 [4580] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1.957 [1519] |∎∎∎∎∎∎∎∎∎∎∎∎∎
  2.572 [294]  |∎∎∎
  3.187 [36]   |
  3.801 [11]   |
  4.416 [74]   |∎
  5.030 [52]   |
  5.645 [45]   |
  6.259 [33]   |Latency distribution:
  10 % in 0.46 ms
  25 % in 0.64 ms
  50 % in 0.88 ms
  75 % in 1.24 ms
  90 % in 1.68 ms
  95 % in 2.00 ms
  99 % in 4.77 msStatus code distribution:
  [OK]   10000 responses

tonic

Summary:
  Count: 10000
  Total: 581.81 ms
  Slowest: 6.39 ms
  Fastest: 0.17 ms
  Average: 2.84 ms
  Requests/sec: 17187.66Response time histogram:
  0.174 [1]    |
  0.796 [5]    |
  1.418 [6]    |
  2.040 [167]  |∎
  2.662 [3427] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  3.284 [5074] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  3.906 [1048] |∎∎∎∎∎∎∎∎
  4.528 [217]  |∎∎
  5.150 [29]   |
  5.773 [21]   |
  6.395 [5]    |Latency distribution:
  10 % in 2.35 ms
  25 % in 2.55 ms
  50 % in 2.79 ms
  75 % in 3.07 ms
  90 % in 3.39 ms
  95 % in 3.66 ms
  99 % in 4.22 msStatus code distribution:
  [OK]   10000 responses

grpc-node

Summary:
  Count: 10000
  Total: 589.25 ms
  Slowest: 12.56 ms
  Fastest: 1.21 ms
  Average: 2.88 ms
  Requests/sec: 16970.81Response time histogram:
  1.206 [1]    |
  2.341 [2592] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  3.476 [5516] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  4.612 [1588] |∎∎∎∎∎∎∎∎∎∎∎∎
  5.747 [180]  |∎
  6.882 [42]   |
  8.017 [32]   |
  9.152 [5]    |
  10.288 [20]  |
  11.423 [6]   |
  12.558 [18]  |Latency distribution:
  10 % in 2.14 ms
  25 % in 2.33 ms
  50 % in 2.62 ms
  75 % in 3.24 ms
  90 % in 3.85 ms
  95 % in 4.26 ms
  99 % in 6.41 msStatus code distribution:
  [OK]   10000 responses

tower-grpc

Summary:
  Count: 10000
  Total: 571.88 ms
  Slowest: 10.59 ms
  Fastest: 0.25 ms
  Average: 2.76 ms
  Requests/sec: 17486.12Response time histogram:
  0.246 [1]    |
  1.280 [139]  |∎
  2.314 [2927] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  3.348 [5198] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  4.382 [1390] |∎∎∎∎∎∎∎∎∎∎∎
  5.416 [114]  |∎
  6.450 [61]   |
  7.484 [80]   |∎
  8.518 [47]   |
  9.552 [31]   |
  10.586 [12]  |Latency distribution:
  10 % in 1.80 ms
  25 % in 2.20 ms
  50 % in 2.65 ms
  75 % in 3.13 ms
  90 % in 3.64 ms
  95 % in 4.05 ms
  99 % in 7.18 msStatus code distribution:
  [OK]   10000 responses

grpc-rust

Summary:
  Count: 10000
  Total: 479.30 ms
  Slowest: 8.15 ms
  Fastest: 0.90 ms
  Average: 2.34 ms
  Requests/sec: 20863.64Response time histogram:
  0.901 [1]    |
  1.626 [193]  |∎
  2.351 [5587] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  3.076 [3562] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  3.801 [506]  |∎∎∎∎
  4.526 [119]  |∎
  5.251 [16]   |
  5.976 [5]    |
  6.701 [2]    |
  7.426 [2]    |
  8.151 [7]    |Latency distribution:
  10 % in 1.87 ms
  25 % in 2.03 ms
  50 % in 2.25 ms
  75 % in 2.57 ms
  90 % in 2.90 ms
  95 % in 3.23 ms
  99 % in 4.11 msStatus code distribution:
  [OK]   10000 responses

Grpc-rs

Summary:
  Count: 10000
  Total: 289.82 ms
  Slowest: 4.22 ms
  Fastest: 0.22 ms
  Average: 1.36 ms
  Requests/sec: 34504.74Response time histogram:
  0.222 [1]    |
  0.621 [195]  |∎∎
  1.021 [1829] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1.420 [4059] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1.820 [2625] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  2.219 [972]  |∎∎∎∎∎∎∎∎∎∎
  2.618 [239]  |∎∎
  3.018 [45]   |
  3.417 [18]   |
  3.817 [6]    |
  4.216 [11]   |Latency distribution:
  10 % in 0.87 ms
  25 % in 1.07 ms
  50 % in 1.30 ms
  75 % in 1.62 ms
  90 % in 1.90 ms
  95 % in 2.07 ms
  99 % in 2.56 msStatus code distribution:
  [OK]   10000 responses

汇总概要

总响应时间(以毫秒为单位)。越低越好。

总响应时间(以毫秒为单位)。越低越好。

吞吐量(请求/秒)。越高越好。

吞吐量(请求/秒)。越高越好。

总结

结果表明,在性能方面,rust 与 node 相当,这是一个令人震惊的结果。

Go 库在并发性和最小开销方面均表现出色。

如果有人对 Go 库表现优异有些疑惑,请给留言给出你的看法!

原文链接:https://medium.com/@Rustling_gopher/benchmarking-grpc-in-rust-go-184545e7688a

作者:Rustler

编译:polaris