Please enable Javascript to view the contents

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

 ·  ☕ 1 分钟

1. Jindo 挂载 S3

  • 配置环境变量
1
2
3
4
export ENDPOINT=obs.ap-southeast-3.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: mys3secret
type: Opaque
stringData:
  fs.s3.accessKeyId: ${AK}
  fs.s3.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: mys3-jindo
spec:
  mounts:
    - mountPoint: s3://${BUCKET}/test2/
      options:
        fs.s3.endpoint: ${ENDPOINT}
      encryptOptions:
        - name: fs.s3.accessKeyId
          valueFrom:
            secretKeyRef:
              name: mys3secret
              key: fs.s3.accessKeyId
        - name: fs.s3.accessKeySecret
          valueFrom:
            secretKeyRef:
              name: mys3secret
              key: fs.s3.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: mys3-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: mys3-jindo
spec:
  containers:
    - name: demo
      image: shaowenchen/demo-ubuntu
      volumeMounts:
        - mountPath: /data
          name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: mys3-jindo
EOF

2. 性能测试

进入 Pod

1
kubectl exec -it mys3-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 | 394.04 MiB/s |    2.60 s/file |
|    Read big file | 304.28 MiB/s |    3.37 s/file |
| Write small file |  7.0 files/s | 143.11 ms/file |
|  Read small file | 18.2 files/s |  55.07 ms/file |
|        Stat file | 41.5 files/s |  24.09 ms/file |
+------------------+--------------+----------------+

3. 清理资源

1
2
3
kubectl delete secret mys3secret
kubectl delete dataset mys3-jindo
kubectl delete jindoruntime mys3-jindo

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