Please enable Javascript to view the contents

使用 Fluid 对接 OBS 存储及性能测试

 ·  ☕ 1 分钟

1. Jindo 挂载 OBS

  • 配置环境变量
1
2
3
4
export ENDPOINT=obs.cn-north-4.myhuaweicloud.com
export BUCKET=
export AK=
export SK=
  • 创建凭证
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
  name: myobssecret
type: Opaque
stringData:
  fs.obs.accessKeyId: ${AK}
  fs.obs.accessKeySecret: ${SK}
EOF
  • 创建 Dataset
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
kubectl apply -f - <<EOF
apiVersion: data.fluid.io/v1alpha1
kind: Dataset
metadata:
  name: myobs-jindo
spec:
  mounts:
    - mountPoint: obs://${BUCKET}/test2/
      options:
        fs.obs.endpoint: ${ENDPOINT}
      encryptOptions:
        - name: fs.obs.accessKeyId
          valueFrom:
            secretKeyRef:
              name: myobssecret
              key: fs.obs.accessKeyId
        - name: fs.obs.accessKeySecret
          valueFrom:
            secretKeyRef:
              name: myobssecret
              key: fs.obs.accessKeySecret
  accessModes:
    - ReadWriteMany
EOF
  • 创建 JindoRuntime
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
kubectl apply -f - <<EOF
apiVersion: data.fluid.io/v1alpha1
kind: JindoRuntime
metadata:
  name: myobs-jindo
spec:
  replicas: 2
  tieredstore:
    levels:
      - mediumtype: SSD
        path: /cache
        quota: 40960
        low: "0.1"
EOF
  • 创建 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: myobs-jindo
spec:
  containers:
    - name: demo
      image: hub-mirror.wps.cn/sreopen/demo-ubuntu
      volumeMounts:
        - mountPath: /data
          name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: myobs-jindo
EOF

2. 性能测试

进入 Pod 并执行 curl -sSL https://d.juicefs.com/install | sh - 安装 JuiceFS 客户端。

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

BlockSize: 4.0 GiB, BigFileSize: 1.0 GiB, SmallFileSize: 128 KiB, SmallFileCount: 100, NumThreads: 30
+------------------+----------------+-----------------+
|       ITEM       |      VALUE     |       COST      |
+------------------+----------------+-----------------+
|   Write big file |   197.96 MiB/s |   155.19 s/file |
|    Read big file |  1053.03 MiB/s |    29.17 s/file |
| Write small file |   10.7 files/s | 2816.14 ms/file |
|  Read small file |  845.3 files/s |   35.49 ms/file |
|        Stat file | 6218.2 files/s |    4.82 ms/file |
+------------------+----------------+-----------------+

用来分发模型,性能基本足够。

3. 清理资源

1
2
3
kubectl delete secret myobssecret
kubectl delete dataset myobs-jindo
kubectl delete jindoruntime myobs-jindo

微信公众号
作者
微信公众号