Skip to content
Storage

带宽与存储出口

Bandwidth & Storage Egress

带宽和存储出口 #

🌐 Bandwidth & Storage egress

Supabase 的免费计划组织有 10 GB 带宽限制(5 GB 缓存 + 5 GB 非缓存)。这个限制是通过从 Supabase 服务器传输到客户端的所有数据总和来计算的。包括从数据库、存储和函数传输的所有数据。

🌐 Free Plan Organizations in Supabase have a limit of 10 GB of bandwidth (5 GB cached + 5 GB uncached). This limit is calculated by the sum of all the data transferred from the Supabase servers to the client. This includes all the data transferred from the database, storage, and functions.

在日志浏览器中检查存储出口请求 #

🌐 Checking Storage egress requests in Logs Explorer

我们有一个模板查询,你可以用它来获取 日志浏览器 中每个对象的请求数量。

🌐 We have a template query that you can use to get the number of requests for each object in Logs Explorer.

1
select
2
request.method as http_verb,
3
request.path as filepath,
4
(responseHeaders.cf_cache_status = 'HIT') as cached,
5
count(*) as num_requests
6
from
7
edge_logs
8
cross join unnest(metadata) as metadata
9
cross join unnest(metadata.request) as request
10
cross join unnest(metadata.response) as response
11
cross join unnest(response.headers) as responseHeaders
12
where
13
(path like '%storage/v1/object/%' or path like '%storage/v1/render/%')
14
and request.method = 'GET'
15
group by 1, 2, 3
16
order by num_requests desc
17
limit 100;

输出示例:

🌐 Example of the output:

1
[
2
{
3
"filepath": "/storage/v1/object/sign/large%20bucket/20230902_200037.gif",
4
"http_verb": "GET",
5
"cached": true,
6
"num_requests": 100
7
},
8
{
9
"filepath": "/storage/v1/object/public/demob/Sports/volleyball.png",
10
"http_verb": "GET",
11
"cached": false,
12
"num_requests": 168
13
}
14
]

计算出口 #

🌐 Calculating egress

如果你已经知道那些文件的大小,你可以通过将请求次数乘以文件大小来计算外发流量。你也可以用下面的 cURL 来获取文件的大小:

🌐 If you already know the size of those files, you can calculate the egress by multiplying the number of requests by the size of the file. You can also get the size of the file with the following cURL:

1
curl -s -w "%{size_download}\n" -o /dev/null "https://my_project.supabase.co/storage/v1/object/large%20bucket/20230902_200037.gif"

这将返回文件的字节大小。
在这个例子中,假设 20230902_200037.gif 的文件大小是 3 兆字节,而 volleyball.png 的文件大小是 570 千字节。

🌐 This will return the size of the file in bytes. For this example, assume that 20230902_200037.gif has a file size of 3 megabytes and volleyball.png has a file size of 570 kilobytes.

现在,我们必须把所有文件的出口流量加起来,才能得到总出口流量:

🌐 Now, we have to sum all the egress for all the files to get the total egress:

1
100 * 3MB = 300MB
2
168 * 570KB = 95.76MB
3
Total Egress = 395.76MB

你可以看到这些数值可能会很大,所以跟踪出口量并优化文件很重要。

🌐 You can see that these values can get quite large, so it's important to keep track of the egress and optimize the files.

优化出站 #

🌐 Optimizing egress

查看我们关于出口扩展的技巧

🌐 See our scaling tips for egress.