【问题标题】:Performance of IBM Containers VolumesIBM Containers Volumes 的性能
【发布时间】:2016-03-18 17:04:31
【问题描述】:

我正在 IBM Containers 中运行一个 postgres 9.5 数据库。我修改了 DockerHub 映像,以便它可以与 Containers 服务提供的 Volumes 功能一起使用(必须解决与此问题相关的权限问题:Can I change owner of directory that is mounted on volume in IBM containers?)。

但是,我现在看到性能很差。例如,这是运行删除新初始化的 postgres db (~20MB) 的最新输出,但我没有看到任何超过 3 分钟的结果:

/tmp/vol/pgdata $ time rm -rf *

real    18m 1.38s
user    0m 0.00s
sys 0m 0.25s

我是否可能需要在图像/容器中配置一些不同的东西才能获得合理的性能?其他人有幸在卷上运行数据库吗?

【问题讨论】:

    标签: postgresql docker containers ibm-cloud


    【解决方案1】:

    检查为该卷下的文件系统指定的性能。

    例如,对于卷 'pgdata' 执行 cf ic volume inspect pgdata,您将得到如下输出:

    # cf ic volume inspect pgdata
    {
        "fsId": "long-fs-space-uuid-here",
        "hostPath": "/vol/long-fs-space-uuid-here/pgdata",
        "otherSpaceVisibility": [],
        "spaceGuid": "long-fs-space-uuid-here",
        "volName": "pgdata"
    }
    

    然后您可以使用cf ic volume fs-list 获取您的 fs 对象列表,这将为您提供如下输出:

    # cf ic volume fs-list
    Name                          Size   IOPS/GB   Created               State
    long-fs-space-uuid-here       20     0.25      2016-03-04 14:44:49   READY
    

    在这种情况下,我的文件系统对象指定为 0.25 IOPS/GB 和 20GB - 即 4 IOPS。对于像 db 这样的东西,最好在新的更快的 fs 上重新创建它:

    cf ic volume fs-create myfastfs 20 4

    等待新文件空间显示为 READY:

    cf ic volume fs-list

    然后在更快的 fs 上重新创建卷:

    cf ic volume create pgdata myfastfs

    【讨论】:

    • 作为记录,我可以通过cf ic volume fs-list 的输出确认我以 0.25/IOPS 运行。不幸的是,我现在遇到了 Containers 问题,所以我无法测试提议的解决方案以提高到 4IOPS。
    • 我将此标记为已接受的答案,因为 n-fritze 提供了提高性能的正确方法。作为比较,使用原始 0.25IOPS 20GB 文件空间初始化一个 postgres 数据库大约需要 2 小时。使用 4IOPS 20GB 文件空间可显着缩短约 5 分钟。仍然无法使用(在我的 mac book 上大约需要 3 秒),但可能对其他用例有所帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多