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: shaowenchen/demo-ubuntu
      volumeMounts:
        - mountPath: /data
          name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: myobs-jindo
EOF

2. 性能测试

进入 Pod

1
kubectl exec -it myobs-jindo -- bash

执行

1
curl -sSL https://d.juicefs.com/install | sh -

安装 JuiceFS 客户端

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

Benchmark finished!
BlockSize: 4.0 MiB, BigFileSize: 1.0 GiB, SmallFileSize: 128 KiB, SmallFileCount: 100, NumThreads: 1
+------------------+--------------+----------------+
|       ITEM       |     VALUE    |      COST      |
+------------------+--------------+----------------+
|   Write big file | 389.70 MiB/s |    2.63 s/file |
|    Read big file | 242.28 MiB/s |    4.23 s/file |
| Write small file |  6.4 files/s | 157.08 ms/file |
|  Read small file | 15.5 files/s |  64.39 ms/file |
|        Stat file | 34.9 files/s |  28.62 ms/file |
+------------------+--------------+----------------+

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

3. 清理资源

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

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