High Disk I/O
理解磁盘 IO 和磁盘 IO 预算 #
🌐 Understanding disk IO and disk IO budget
磁盘 IO 指两个指标:以每秒兆字节 (MB/s) 为单位的吞吐量,以及每秒输入/输出操作次数 (IOPS)。吞吐量衡量你每秒能传输多少数据,而 IOPS 衡量你每秒能进行多少次读写操作。根据你实例的计算附加组件,你会有不同的基础性能 。
🌐 Disk IO refers to two metrics: throughput in Megabytes per second (MB/s) and IOPS which are Input/Output Operations per Second. Throughput measures how much data you can move each second, while IOPS measures how many read/write operations you can perform each second. Depending on the compute add-on of your instance you will have different baseline performances.
较小的计算实例每天可以短时间内突发并超过其基础性能。这表现为你的磁盘 IO 预算,一旦你的磁盘 IO 预算被消耗完,你的实例就会回到基础性能水平。了解更多关于选择合适的计算实例以获得稳定磁盘性能的信息。
🌐 Smaller compute instances can burst and exceed their baseline performance for a short period of time every day. This is represented as your Disk IO Budget and once your Disk IO Budget is consumed, your instance reverts back to its baseline performance. Learn more about choosing the right compute instance for consistent disk performance.
耗尽你的磁盘IO额度 #
🌐 Depleting your disk IO budget
用完磁盘 IO 配额意味着你的实例正在使用的磁盘比它的计算附加功能能处理的更多,本质上会被限制。这可能会带来各种影响:
🌐 Running out of Disk IO Budget means that your instance is using more disk than its compute add-on can handle and essentially gets throttled. This could have a wide range of implications:
监控你的磁盘 IO 预算 #
🌐 Monitor your disk IO budget
要在 Supabase 平台上查看你的磁盘 IO 预算,请前往可观测性部分的数据库健康。
🌐 To check your Disk IO Budget on the Supabase Platform, head over to Database Health in the Observability section.
你也可以使用 Prometheus/Grafana 来监控你的资源并设置警报。通过 Grafana,你可以准确找出潜在原因,并查看更细致的指标,比如有多少 RAM 被用于缓存以及 Swap 的使用情况。阅读 指标指南 了解更多信息。
🌐 It is also possible to monitor your resources and set up alerts using Prometheus/Grafana. With Grafana you will be able to pinpoint potential causes and see more fine-grained metrics like how much of your RAM is used for caching and your Swap usage. Read the Metrics Guide to learn more.
磁盘IO使用率高的常见原因 #
🌐 Common reasons for high disk IO usage
你在 Supabase 项目上的大多数操作都会以某种形式涉及磁盘 IO。因此,磁盘 IO 使用高的原因可能有很多。以下是一些常见的原因:
🌐 Most operations on your Supabase project require disk IO in some form. Hence, there can be many reasons for high disk IO usage. Here are some common ones:
- 高内存使用: 每个 Supabase 项目都有 1GB 的磁盘用于交换。当你的内存使用量很高时,操作系统可能会频繁地将内存的一部分在磁盘的交换空间中来回移动。
- 低缓存使用率: 如果你的缓存命中率很低,许多数据库请求可能会直接访问硬盘。访问缓存命中率指南了解更多信息。
- 查询性能: 需要很长时间才能完成的查询(>1 秒)可能在低效地使用你的磁盘。查看我们关于检查查询性能的指南。
- 高人气: 恭喜!你的副项目真的很成功,收到的请求比它能处理的还多。
怎么修 #
🌐 How to fix