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

推荐订阅源

The Hacker News
The Hacker News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
Recent Announcements
Recent Announcements
D
DataBreaches.Net
P
Proofpoint News Feed
V
Visual Studio Blog
J
Java Code Geeks
Recorded Future
Recorded Future
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Full Disclosure
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
罗磊的独立博客
Jina AI
Jina AI
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
G
GRAHAM CLULEY
Y
Y Combinator Blog
L
LangChain Blog
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园_首页
A
About on SuperTechFans
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Latest news
Latest news
T
Threatpost
T
Tenable Blog
有赞技术团队
有赞技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
C
Cisco Blogs
C
Check Point Blog
T
Tor Project blog
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
美团技术团队
I
Intezer
S
Securelist
AWS News Blog
AWS News Blog

陈少文的网站

巨变与机遇的未来十年 Kubernetes 平台管理软件压力测试方案 使用镜像部署 Hexo 静态页面 终于等到你 - GitHub 镜像仓库服务(ghcr.io) 一起来学 Go --(6)Interface 一起来学 Go --(5)Goroutine 和 Channel 什么是函数式编程 如何在 Kubernetes 集群集成 Kata 柯里化与偏函数 使用 PyGithub 自动创建 Label 软件产品是团队能力的输出 Helm 2 、Helm 3 比较 IoT 变现 Kubernetes 中的 DNS 服务 国内的 Helm 镜像源 Harbor 使用自签证书支持 Https 访问 DevOps 工具链之 Prow 如何使用 kfctl 安装 Kubeflow VS Code 无法下载 Go 插件的工具包 工程师更应具有服务精神 你不知道的 Docker 使用技巧 使用 Docker 运行 Tensorflow 论中国 什么是左移 如何清空 Git 仓库全部历史记录 一禅小和尚 有风吹过厨房 时间的玫瑰 如何在 CentOS 安装 GPU 驱动 开发 Tips(19) 使用 Velero 备份 Kubernetes 集群 Kubernetes Cheat Sheet 开发 Tips(18) 如何构建一个 Java 工程 开发 Tips(17) KubeSpray 安装 Kubernetes 报错 ip in ansible_all_ipv4_addresses 基于 Kubernetes 和 Jenkins 搭建自动化测试系统 在 Kubernetes 上动态创建 Jenkins Slave 使用 Jenkins 进行服务拨测 开发 Tips(16) Kubernetes 签发 Ingress 证书及日常故障运维 Kubernetes 中 Deployment 的基本操作 Kubernetes 中的证书 如何使用 KubeBuilder 开发一个 Operator Kubernetes 1.6.0 安装问题汇总 镜像管理工具 -- Harbor 开发 Tips(15) Docker 如何拉取镜像 开发 Tips(14) 使用 Helm 安装 harbor 开发 Tips(13) 使用 S2I 构建云原生应用 在 Kubernetes 中使用 emptyDir、hostPath、localVolume 开发 Tips(12) 开发 Tips(11) 代码质量分析工具 SonarQube 使用 Kubeadm 安装 Kubernetes 集群 一起来学 Go --(4)常用函数 Kubernetes 中的 Ceph Kubernetes 之 Volumes Kubernetes 之 Labels、Selectors 开发 Tips(10) 开源正在重构商业模式 Kubernetes 之网络 Kubernetes 之 API 使用 Helm 和 Operator 快速部署 Prometheus Kubernetes 复杂有状态应用管理框架 -- Operator Kubernetes 的包管理器 -- Helm 一起来学 Go --(3)Go Modules 如何一步一步地优化博客方案 kubectl 实用指南 Kubernetes 中的基本概念 搭建远程 Kubernetes 开发环境 大公司和小公司的 ToB 思路 开发 Tips(9) Go 入门指南 一起来学 Go --(2)数据与逻辑结构 如何预防 Web 富文本中的 XSS 攻击 django-xss-cleaner 云工作时代 一起来学 Go --(1)背景与特点 SaaS 开发团队的不同阶段 你不知道的 Git 使用技巧 输出既服务 微服务设计 继续奔跑 开发 Tips(8) 从账户安全到二次验证 Django 性能之数据库查询优化 Django 性能之分库分表 敏捷开发之研发流程 打造一致性的团队 开发 Tips(7) Pytest 进阶学习之 Mock PaaS 部署之 buildpack Go 开发配置 领域输出才是 PaaS 的核心竞争力 Pytest 入门学习 开发 Tips(6) 如何使用 Jenkins、Docker、GitLab 搭建 Django 自动化部署流程
JuiceFS 社区版、企业版、Dragonfly 集成性能测试及对比
微信公众号 · 2024-01-24 · via 陈少文的网站

请注意文中的 --block-size 4096 为 4GB,如果使用 --block-size 4 会更合理,在写数据性能上会更好。

1. 环境准备

  • 进入一个安全目录
1
mkdir -p /data/test && cd /data/test

在这个目录下完成全部的测试任务。

  • 给 Redis 单独建一个目录

建议新建一个目录,因为 Redis 会将当前目录文件的 Owner 改成 systemd-coredump。如果是 HOME 目录下,可能会导致 SSH 验证失败,无法登录机器。

  • 启动 Redis,提供给 JuiceFS 使用
1
nerdctl run -d --name redis --network host -v $PWD/redis-data:/data -e REDIS_PASSWORD=mypassword redis:6
  • 配置 Redis 环境变量
1
2
3
4
export REDIS_IP=x.x.x.x
export REDIS_PORT=6379
export REDIS_USER=default
export REDIS_PASSWORD=mypassword
  • 设置对象存储的环境变量
1
2
3
4
5
export ACCESS_KEY=xxx
export SECRET_KEY=xxx
export BUCKET=xxx
export ENDPOINT=xxx
export BUCKET_ENPOINT=$BUCKET.$ENDPOINT
  • 设置测试用例 ID
  • 本地网络测试状况

Dragonfly Peer 之间的带宽: 25 Gbps

Dragonfly Peer 到对象存储源站的带宽: 20 Gbps,在测试机器能打满

  • 解除 Dragonfly Peer 限速配置
1
2
      perPeerRateLimit: 5120Mi
      totalRateLimit: 10240Mi

2. 本地磁盘

2.1 dd 读写测试

  • 写文件, 速度 967 MB/s
1
2
3
4
5
6
7
time dd if=/dev/zero of=./dd.txt bs=4M count=2500

10485760000 bytes (10 GB, 9.8 GiB) copied, 10.8478 s, 967 MB/s

real	0m11.625s
user	0m0.008s
sys	0m11.442s
  • 首次读,1138 MB/s
1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	0m9.048s
user	0m0.021s
sys	0m4.431s
  • 带缓存读,5120 MB/s
1
2
3
4
5
time cp ./dd.txt /dev/null

real	0m2.015s
user	0m0.004s
sys	0m2.009s

这里直接使用了内存缓存。

2.2 benchmark 测试

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
juicefs bench --block-size 4096 --big-file-size 1024 --threads 30 ./

+------------------+------------------+--------------+
|       ITEM       |       VALUE      |     COST     |
+------------------+------------------+--------------+
|   Write big file |    2067.12 MiB/s | 14.86 s/file |
|    Read big file |    6295.55 MiB/s |  4.88 s/file |
| Write small file |  12358.1 files/s | 2.43 ms/file |
|  Read small file |  17480.9 files/s | 1.72 ms/file |
|        Stat file | 192702.6 files/s | 0.16 ms/file |
+------------------+------------------+--------------+

2.3 fio 测试

  • 安装 OpsCli
1
curl -sfL https://raw.githubusercontent.com/shaowenchen/ops/main/getcli.sh |VERSION=latest sh -
  • 运行
1
opscli task -f ~/.ops/tasks/get-diskio-byfio.yaml --size 10g --filename=/data/test/${TEST_CASE}-fio.txt
Test TypeIOPSBandwidthDuration
Rand_Read_Testing164k639 MiB/s16027 msec
Rand_Write_Testing46.7k182 MiB/s56175 msec
Sequ_Read_Testing7754969 MiB/s10564 msec
Sequ_Write_Testing5055632 MiB/s16203 msec

3. 社区版 JuiceFS

在使用时,应该都会带 Cache,这里就不验证不带 Cache 的情况了。

3.1 挂载文件系统

  • 创建文件系统
1
export REDIS_DIRECTSERVER=redis://${REDIS_USER}:${REDIS_PASSWORD}@${REDIS_IP}:${REDIS_PORT}/1
1
2
3
4
5
juicefs format \
    --storage ks3 \
    --bucket ${BUCKET_ENPOINT}\
    ${REDIS_DIRECTSERVER} \
    ${TEST_CASE}-direct
  • 挂载文件系统
1
juicefs mount -d --buffer-size 2000 --max-uploads 150 ${REDIS_DIRECTSERVER} ./${TEST_CASE}-direct --cache-dir=/data/jfs-${TEST_CASE}

此时,在 ${TEST_CASE}-direct 目录下的操作,都会被同步到桶的 ${TEST_CASE}-direct 文件中。

3.2 dd 读写测试

  • 进入挂载目录
  • 写文件,速度 640 MB/s
1
2
3
4
5
6
7
time dd if=/dev/zero of=./dd.txt bs=4M count=2500

10485760000 bytes (10 GB, 9.8 GiB) copied, 16.3898 s, 640 MB/s

real	0m16.406s
user	0m0.008s
sys	0m8.233s
  • 首次读,速度 84 MB/s
1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	2m2.601s
user	0m0.040s
sys	0m7.424s
  • 带缓存读,速度 1765 MB/s

此时 JuiceFS 已经在本地缓存了数据。

1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	0m5.824s
user	0m0.020s
sys	0m5.684s

3.3 benchmark 测试

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
juicefs bench --block-size 4096 --big-file-size 1024 --threads 30 ./

+------------------+----------------+---------------+
|       ITEM       |      VALUE     |      COST     |
+------------------+----------------+---------------+
|   Write big file |    560.37 MiB/s |  36.55 s/file |
|    Read big file |   1353.06 MiB/s |  15.14 s/file |
| Write small file |   238.0 files/s | 84.02 ms/file |
|  Read small file | 11527.3 files/s |  1.74 ms/file |
|        Stat file | 24699.4 files/s |  0.81 ms/file |
+------------------+----------------+---------------+

通过不断增加 threads,可以得到更好的性能数据,打满对象存储后端的带宽。我在 threads 维度测试了多组数据

ThreadsOperationWrite Speed (MiB/s)Write Time (s/file)Read Speed (MiB/s)Read Time (s/file)
20Write big file1491.9613.731776.8511.53
30Write big file1610.2419.082136.9414.38
40Write big file1689.9724.242803.4914.61
50Write big file1714.9529.863200.1116.00

其他测试用例,选择了 threads = 30 作为统一的测试参数。

3.4 fio 测试

  • 安装 OpsCli
1
curl -sfL https://raw.githubusercontent.com/shaowenchen/ops/main/getcli.sh |VERSION=latest sh -
  • 运行
1
opscli task -f ~/.ops/tasks/get-diskio-byfio.yaml --size 10g --filename=/data/test/${TEST_CASE}-direct/fio.txt
Test TypeIOPSBandwidthDuration
Rand_Read_Testing159k621 MiB/s16486 msec
Rand_Write_Testing47.7k187 MiB/s54906 msec
Sequ_Read_Testing81891024 MiB/s10003 msec
Sequ_Write_Testing5182648 MiB/s15806 msec

3.5 卸载文件系统

1
2
cd ..
juicefs umount ./${TEST_CASE}-direct

4. 企业版 JuiceFS

4.1 挂载

挂载企业版 JuiceFS 需要去控制台获取挂载命令,如下图:

执行挂载命令之后,还需要输入 Bucket 的 AccessKey 和 SecretKey。企业版的 JuiceFS 只是负责存储元数据,数据还是存储在对象存储中。

4.2 dd 读写测试

  • 进入挂载目录
  • 写文件,速度 645 MB/s
1
2
3
4
5
6
7
time dd if=/dev/zero of=./dd.txt bs=4M count=2500

10485760000 bytes (10 GB, 9.8 GiB) copied, 16.2446 s, 645 MB/s

real	0m16.294s
user	0m0.012s
sys	0m8.963s
  • 首次读,速度 853 MB/s
1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	0m12.947s
user	0m0.036s
sys	0m7.715s
  • 带缓存读,速度 1024 MB/s
1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	0m1.969s
user	0m0.020s
sys	0m1.927s

4.3 benchmark 测试

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
juicefs bench --block-size 4096 --big-file-size 1024 --threads 30 ./

+------------------+------------------+----------------+
|       ITEM       |       VALUE      |      COST      |
+------------------+------------------+----------------+
|   Write big file |     349.72 MiB/s |   87.84 s/file |
|    Read big file |     710.07 MiB/s |   43.26 s/file |
| Write small file |     41.7 files/s | 719.14 ms/file |
|  Read small file |    672.3 files/s |  44.62 ms/file |
|        Stat file | 162303.2 files/s |   0.18 ms/file |
+------------------+-----------------+---------------+

4.4 fio 测试

  • 安装 OpsCli
1
curl -sfL https://raw.githubusercontent.com/shaowenchen/ops/main/getcli.sh |VERSION=latest sh -
  • 运行
1
opscli task -f ~/.ops/tasks/get-diskio-byfio.yaml --size 10g --filename=/jfs/${TEST_CASE}-ee/fio.txt
Test TypeIOPSBandwidthDuration
Rand_Read_Testing147k573 MiB/s17864 msec
Rand_Write_Testing45.0k176 MiB/s58244 msec
Sequ_Read_Testing7565946 MiB/s10828 msec
Sequ_Write_Testing5182648 MiB/s15806 msec

5. Dragonfly + 社区版 JuiceFS

默认安装的 JuiceFS 客户端是 Lite 版本,不支持 Dragonfly,需要自行编译最新的客户端。在 https://github.com/juicedata/juicefs/pull/4057 之后的版本中,已经支持了 Dragonfly dfstore 对象存储加速的方式,但 PR https://github.com/juicedata/juicefs/pull/4302 采用的是与镜像同路的代理方式,可以无需修改 manager 的情况下,配置多个 Bucket 进行加速。本节的 client 就是来自此 PR。

5.1 配置 Dragonfly

在 Seed Peer 和 Peer 中添加如下配置:

1
2
3
4
5
proxies:
 - regx: s3.*amazonaws.com.*
 - regx: oss.*aliyuncs.com.*
 - regx: obs.*myhuaweicloud.com.*
 - regx: ks3.*ksyun.com.*

5.2 挂载

  • 创建文件系统
1
export REDIS_DRAGONFLY=redis://${REDIS_USER}:${REDIS_PASSWORD}@${REDIS_IP}:${REDIS_PORT}/2
1
2
3
4
5
juicefs format \
    ${REDIS_DRAGONFLY} \
    ${TEST_CASE}-df \
    --storage dragonfly \
    --bucket "https://${BUCKET_ENPOINT}?proxy=http://127.0.0.1:65001&backendStorage=s3"

在 Kubernetes 集群中,可以在每个节点运行一个代理,也可以在若干缓存节点部署代理,提供区域化加速的能力。

  • 挂载文件系统
1
juicefs mount ${REDIS_DRAGONFLY} ./${TEST_CASE}-df --cache-dir=/data/jfs-${TEST_CASE}-df -d

这里也不验证不带 Local Cache 的情况了。

5.3 dd 读写测试

  • 进入挂载目录
  • 写文件,速度 382 MB/s
1
2
3
4
5
6
7
time dd if=/dev/zero of=./dd.txt bs=4M count=2500

10485760000 bytes (10 GB, 9.8 GiB) copied, 27.422 s, 382 MB/s

real	0m27.434s
user	0m0.012s
sys	0m9.840s
  • 首次读,速度 31 MB/s
1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	5m21.089s
user	0m0.044s
sys	0m8.175s
  • 带缓存读,1463 MB/s 速度
1
2
3
4
5
6
sync && echo 3 > /proc/sys/vm/drop_caches
time cp ./dd.txt /dev/null

real	0m7.077s
user	0m0.048s
sys	0m6.928s

此时的缓存既有 JuiceFS 本地缓存,也有 Dragonfly 的缓存。

5.4 benchmark

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
juicefs bench --block-size 4096 --big-file-size 1024 --threads 30 ./

+------------------+----------------+---------------+
|       ITEM       |      VALUE     |      COST     |
+------------------+----------------+---------------+
|   Write big file |    355.03 MiB/s |  86.53 s/file |
|    Read big file |    110.07 MiB/s | 279.09 s/file |
| Write small file |   347.1 files/s | 86.43 ms/file |
|  Read small file | 14406.9 files/s |  2.08 ms/file |
|        Stat file | 40294.0 files/s |  0.74 ms/file |
+------------------+-----------------+---------------+

此时 /data/dfget/data/ 目录下已经有 39G 的文件了。

5.5 fio 测试

  • 安装 OpsCli
1
curl -sfL https://raw.githubusercontent.com/shaowenchen/ops/main/getcli.sh |VERSION=latest sh -
  • 运行
1
opscli task -f ~/.ops/tasks/get-diskio-byfio.yaml --size 10g --filename=/data/test/${TEST_CASE}-df/fio.txt
Test TypeIOPSBandwidthDuration
Rand_Read_Testing152k592 MiB/s17293 msec
Rand_Write_Testing48.0k187 MiB/s54625 msec
Sequ_Read_Testing82251028 MiB/s9959 msec
Sequ_Write_Testing5171646 MiB/s15840 msec

6. 总结

6.1 dd

bs=4M count=2500

测试环境本地磁盘社区版 JuiceFS企业版 JuiceFS社区版 JuiceFS + Dragonfly
写速度967 MB/s640 MB/s645 MB/s382 MB/s
首次读速度1138 MB/s84 MB/s853 MB/s31 MB/s
缓存读速度5120 MB/s1765 MB/s1024 MB/s1463 MB/s
  • 企业版的 JuiceFS 首次读速度非常快,远超社区版 JuiceFS
  • 在没有缓存命中的情况下,Dragonfly 对社区版 JuiceFS 有明显减速效果,因为 Dragonfly 对文件切分、做种有开销
  • 在缓存命中的情况下,社区版 JuiceFS 的缓存读取速度也非常快

6.2 benchmark

–block-size 4096 –big-file-size 1024 –threads 30

项/环境本地磁盘社区版 JuiceFS企业版 JuiceFS社区版+Dragonfly
写大文件速度2067 MiB/s560 MiB/s350 MiB/s355 MiB/s
读大文件速度6295 MiB/s1353 MiB/s710 MiB/s110 MiB/s
写小文件 IOPS1235823842347
读小文件 IOPS174801152767214406
Stat 文件 IOPS1927032469916230340294
  • Dragonfly 可以大幅提高社区版 JuiceFS 的小文件读写性能,Dragonfly 对小文件有优化处理
  • Dragonfly 对社区版 JuiceFS 读取大文件有明显减速效果
  • 企业版 JuiceFS 相较于社区版 JuiceFS,有明显的全方面加速

6.3 fio

10G 文件

测试项/环境本地磁盘社区版 JuiceFS企业版 JuiceFS社区版+Dragonfly
随机读 IOPS164k159k147k152k
随机读带宽639 MiB/s621 MiB/s573 MiB/s592 MiB/s
随机写 IOPS46.7k47.7k45k48k
随机写带宽182 MiB/s187 MiB/s176 MiB/s187 MiB/s
顺序读 IOPS7.8k8.2k7.6k8.2k
顺序读带宽969 MiB/s1 GB/s946 MiB/s1 GB/s
顺序写 IOPS5.1k5.2k5.2k5.2k
顺序写带宽632 MiB/s648 MiB/s648 MiB/s646 MiB/s

fio 的结果显示,各种情况的差异不大。

6.4 一些思考和建议

  • 关于企业版的 JuiceFS

企业版的 JuiceFS 只是负责存储元数据,类似社区版需要使用 MySQL、Redis 存储元数据一样。但 JuiceFS EE 的部署节点,提供有缓存加速的能力。另外一点是企业级存储软件提供服务质量兜底。

  • Dragonfly + 社区版 JuiceFS 的性能测试结果

上面的测试是基于单机,而 Dragonfly 的优势在于大规模 P2P 组网的加速能力。因此,并不需要简单从性能角度做出选择,而是应该考虑到源站带宽、数据规模等因素。

同时,从上面的结果可以看出,在读文件时,如果命中缓存,Dragonfly + 社区版 JuiceFS 能媲美企业版 JuiceFS。

  • 社区版 JuiceFS 是否应该上 Dragonfly

主要需要根据服务访问对象存储源站的带宽判断。

如果服务访问对象存储源站的带宽足够,那么直接使用社区版 JuiceFS 就行。如果服务访问对象存储源站的带宽不稳定、不够,那么就需要着重考虑缓存加速服务,再来根据具体情况选择企业版 JuiceFS 或 Dragonfly + 社区版 JuiceFS。下面是一个供参考的决策图:

  • 供参考的部署架构

在选择采用哪种方式时,主要考虑的是成本、性能、质量,结合业务的现状、体量做出选择。下面给出两张示意图,以供参考: