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

推荐订阅源

WordPress大学
WordPress大学
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
IT之家
IT之家
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
U
Unit 42
爱范儿
爱范儿
博客园 - 聂微东
F
Fortinet All Blogs
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
雷峰网
雷峰网
B
Blog RSS Feed
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More

陈少文的网站

巨变与机遇的未来十年 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)
Fluid 挂载 S3 为 PVC 以及性能测试
微信公众号 · 2024-05-19 · via 陈少文的网站

1. 创建 Dataset

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
  name: my-s3
type: Opaque
stringData:
  aws.accessKeyId: xxx
  aws.secretKey: xxx
EOF
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
kubectl apply -f - <<EOF
apiVersion: data.fluid.io/v1alpha1
kind: Dataset
metadata:
  name: my-s3
spec:
  mounts:
    - mountPoint: s3://BUCKET/
      name: s3
      options:
        alluxio.underfs.s3.endpoint: ks3-cn-beijing-internal.ksyun.com
        alluxio.underfs.s3.disable.dns.buckets: "false"
      encryptOptions:
      - name: aws.accessKeyId
        valueFrom:
          secretKeyRef:
            name: my-s3
            key: aws.accessKeyId
      - name: aws.secretKey
        valueFrom:
          secretKeyRef:
            name: my-s3
            key: aws.secretKey
  accessModes:
    - ReadWriteMany
EOF

2. 创建 Runtime

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
kubectl apply -f - <<EOF
apiVersion: data.fluid.io/v1alpha1
kind: AlluxioRuntime
metadata:
  name: my-s3
spec:
  tieredstore:
    levels:
      - mediumtype: MEM
        path: /dev/shm
        quota: 50Gi
EOF

3. 创建测试 Pod

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: s3-demo
spec:
  containers:
    - name: demo
      image: shaowenchen/demo:ubuntu
      volumeMounts:
        - mountPath: /data
          name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: my-s3
EOF

4. 性能测试

  • 写入测试,18.1 MB/s
1
2
3
4
5
6
7
8
9
time dd if=/dev/zero of=./dd.txt bs=4M count=250

250+0 records in
250+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 57.8283 s, 18.1 MB/s

real	1m14.210s
user	0m0.000s
sys	0m0.363s
  • 读取测试,72.4 MB/s
1
2
3
4
5
time cp ./dd.txt /dev/null

real	0m13.823s
user	0m0.000s
sys	0m0.386s
  • 带缓存的读取测试,4424.7 MB/s
1
2
3
4
5
 time cp ./dd.txt /dev/null

real	0m0.226s
user	0m0.004s
sys	0m0.221s

5. 清理

1
2
3
4
kubectl delete pod s3-demo
kubectl delete alluxioruntime my-s3
kubectl delete dataset my-s3
kubectl delete secret my-s3

6. 总结

使用 Fluid 直接将 S3 挂载为 PVC 性能不算好,以上的测试桶和集群在一个区域。

  • 已经挂载的 PVC 并不能看到 S3 桶的更新。也就是说,PVC 只是 S3 挂载瞬间的 Snapshort
  • 不要在 PVC 中创建目录,目录不会同步到 S3 桶
  • 不要在 PVC 中创建文件,文件不会同步到 S3 桶
  • 读写速度都很慢

使用 s3fs + ThinRuntimeProfile 的方式应该更好,但目前暂时没有业务需求,另外如果是 OSS 可以使用 JindoRuntime 支持对象存储的加速。