gpt4 book ai didi

google-compute-engine - Google Compute Engine VM 磁盘非常慢

转载 作者:行者123 更新时间:2023-12-04 11:24:19 26 4
gpt4 key购买 nike

我们刚刚切换到 Google Compute Engine,但在磁盘速度方面遇到了重大问题。它大约是 Linode 的 5% 或更糟。写入从未超过20M/s,读取从未超过10M/s。大多数情况下,写入速度为 15M/s,读取速度为 5M/s。

我们目前正在运行 n1-highmem-4 (4 个 vCPU,26 GB 内存)机器。 CPU和内存不是瓶颈。只需运行一个脚本,从 PostgreSQL 数据库读取行,处理它们,然后写回 PostgreSQL。批量更新数据库行只是一个常见的工作。尝试运行20个进程以利用多核,但总体进展仍然缓慢。

我们认为磁盘可能是瓶颈,因为流量异常低。

最后我们决定做基准测试。我们发现它不仅速度慢,而且似乎有一个可重现的主要错误:

  • 创建并连接到实例
  • 至少运行基准测试 3 次:
    dd if=/dev/zero bs=1024 count=5000000 of=~/5Gb.file

  • 我们发现它变得非常缓慢,根本无法完成基准测试。

    最佳答案

    Persistent Disk 的性能与磁盘本身的大小和它所连接的 VM 的大小成正比。磁盘(或VM)越大,性能就越高,因此本质上,您为磁盘或VM支付的价格不仅是磁盘/CPU/RAM,还有IOPS和吞吐量。

    引用 Persistent Disk documentation :

    Persistent disk performance depends on the size of the volume and the type of disk you select. Larger volumes can achieve higher I/O levels than smaller volumes. There are no separate I/O charges as the cost of the I/O capability is included in the price of the persistent disk.

    Persistent disk performance can be described as follows:

    • IOPS performance limits grow linearly with the size of the persistent disk volume.
    • Throughput limits also grow linearly, up to the maximum bandwidth for the virtual machine that the persistent disk is attached to.
    • Larger virtual machines have higher bandwidth limits than smaller virtual machines.


    页面上还有一个更详细的定价图表,显示您购买的每 GB 空间所获得的 yield (以下数据是截至 2014 年 8 月的最新数据):
                                      Standard disks     SSD persistent disks

    Price (USD/GB per month) $0.04 $0.025
    Maximum Sustained IOPS
    Read IOPS/GB 0.3 30
    Write IOPS/GB 1.5 30
    Read IOPS/volume per VM 3,000 10,000
    Write IOPS/volume per VM 15,000 15,000
    Maximum Sustained Throughput
    Read throughput/GB (MB/s) 0.12 0.48
    Write throughput/GB (MB/s) 0.09 0.48
    Read throughput/volume per VM (MB/s) 180 240
    Write throughput/volume per VM (MB/s) 120 240

    以及页面上特定大小的磁盘将为您提供的具体示例:

    As an example of how you can use the performance chart to determine the disk volume you want, consider that a 500GB standard persistent disk will give you:

    • (0.3 × 500) = 150 small random reads
    • (1.5 × 500) = 750 small random writes
    • (0.12 × 500) = 60 MB/s of large sequential reads
    • (0.09 × 500) = 45 MB/s of large sequential writes

    关于google-compute-engine - Google Compute Engine VM 磁盘非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23683271/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com