Skip to content

Commit d60b3e3

Browse files
authored
feat: cached egress rollout (supabase#37827)
1 parent 90b2288 commit d60b3e3

31 files changed

Lines changed: 495 additions & 438 deletions

File tree

apps/docs/content/guides/database/extensions/wrappers/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ This approach has several benefits:
9292
1. **On-demand:** analytical data is immediately available within your application with no additional infrastructure.
9393
1. **Always in sync:** since the data is queried directly from the remote server, it's always up-to-date.
9494
1. **Integrated:** large datasets are available within your application, and can be joined with your operational/transactional data.
95-
1. **Save on bandwidth:** only extract/load what you need.
95+
1. **Save on egress:** only extract/load what you need.
9696

9797
### Batch ETL with Wrappers
9898

apps/docs/content/guides/platform/billing-faq.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ If you upgrade your project to a larger instance for 10 hours and then downgrade
6464

6565
Read more about [Compute usage](/docs/guides/platform/manage-your-usage/compute).
6666

67-
#### What is unified egress and how is it billed?
67+
#### What is egress and how is it billed?
6868

69-
Unified egress refers to the total egress quota available to each organization. This quota can be utilized for various purposes such as Storage, Realtime, Auth, Functions, Supavisor, Log Drains and Database. Each plan includes a specific egress quota, and any additional usage beyond that quota is billed accordingly.
69+
Egress refers to the total bandwidth (network traffic) quota available to each organization. This quota can be utilized for various purposes such as Storage, Realtime, Auth, Functions, Supavisor, Log Drains and Database. Each plan includes a specific egress quota, and any additional usage beyond that quota is billed accordingly.
70+
71+
We differentiate between cached (served via our CDN from cache hits) and uncached egress and give quotas for each type and have varying pricing (cached egress is cheaper).
7072

7173
Read more about [Egress usage](/docs/guides/platform/manage-your-usage/egress).
7274

apps/docs/content/guides/platform/manage-your-usage/egress.mdx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,29 @@ Data pushed to the connected log drain.
5555

5656
**Example:** You set up a log drain, each log sent to the log drain is considered egress. You can toggle the GZIP option to reduce egress, in case your provider supports it.
5757

58+
### Cached Egress
59+
60+
Cached and uncached egress have independent quotas and independent pricing. Cached egress is egress that is served from our CDN via cache hits. Cached egress is typically incurred for storage through our [Smart CDN](/docs/guides/storage/cdn/smart-cdn).
61+
5862
## How charges are calculated
5963

6064
Egress is charged by gigabyte. Charges apply only for usage exceeding your subscription plan's quota. This quota is called the Unified Egress Quota because it can be used across all services (Database, Auth, Storage etc.).
6165

6266
### Usage on your invoice
6367

64-
Usage is shown as "Egress GB" on your invoice.
68+
Usage is shown as "Egress GB" and "Cached Egress GB" on your invoice.
6569

6670
## Pricing
6771

68-
<Price price="0.09" /> per GB per month. You are only charged for usage exceeding your subscription plan's
69-
quota.
72+
<Price price="0.09" /> per GB per month for uncached egress, <Price price="0.03" /> per GB per month
73+
for cached egress. You are only charged for usage exceeding your subscription plan's quota.
7074

71-
| Plan | Unified Egress Quota | Over-Usage per month |
72-
| ---------- | -------------------- | ----------------------------- |
73-
| Free | 5 GB | - |
74-
| Pro | 250 GB | <Price price="0.09" /> per GB |
75-
| Team | 250 GB | <Price price="0.09" /> per GB |
76-
| Enterprise | Custom | Custom |
75+
| Plan | Egress Quota (Uncached / Cached) | Over-Usage per month (Uncached / Cached) |
76+
| ---------- | -------------------------------- | ------------------------------------------------------------- |
77+
| Free | 5 GB / 5 GB | - |
78+
| Pro | 250 GB / 250 GB | <Price price="0.09" /> per GB / <Price price="0.03" /> per GB |
79+
| Team | 250 GB / 250 GB | <Price price="0.09" /> per GB / <Price price="0.03" /> per GB |
80+
| Enterprise | Custom | Custom |
7781

7882
## Billing examples
7983

@@ -86,22 +90,24 @@ The organization's Egress usage is within the quota, so no charges for Egress ap
8690
| Pro Plan | 1 | <Price price="25" /> |
8791
| Compute Hours Micro | 744 hours | <Price price="10" /> |
8892
| Egress | 200 GB | <Price price="0" /> |
93+
| Cached Egress | 230 GB | <Price price="0" /> |
8994
| **Subtotal** | | **<Price price="35" />** |
9095
| Compute Credits | | -<Price price="10" /> |
9196
| **Total** | | **<Price price="25" />** |
9297

9398
### Exceeding quota
9499

95-
The organization's Egress usage exceeds the quota by 50 GB, incurring charges for this additional usage.
100+
The organization's Egress usage exceeds the uncached egress quota by 50 GB and the cached egress quota by 550 GB, incurring charges for this additional usage.
96101

97102
| Line Item | Units | Costs |
98103
| ------------------- | --------- | -------------------------- |
99104
| Pro Plan | 1 | <Price price="25" /> |
100105
| Compute Hours Micro | 744 hours | <Price price="10" /> |
101106
| Egress | 300 GB | <Price price="4.5" /> |
102-
| **Subtotal** | | **<Price price="39.5" />** |
107+
| Cached Egress | 800 GB | <Price price="16.5" /> |
108+
| **Subtotal** | | **<Price price="47.5" />** |
103109
| Compute Credits | | -<Price price="10" /> |
104-
| **Total** | | **<Price price="29.5" />** |
110+
| **Total** | | **<Price price="37.5" />** |
105111

106112
## View usage
107113

@@ -118,7 +124,7 @@ You can view Egress usage on the [organization's usage page](https://supabase.co
118124
zoomable
119125
/>
120126

121-
In the Total Egress section, you can see the usage for the selected time period. Hover over a specific date to view a breakdown by service.
127+
In the Total Egress section, you can see the usage for the selected time period. Hover over a specific date to view a breakdown by service. Note that this includes the cached egress.
122128

123129
<Image
124130
alt="Unified Egress"
@@ -128,6 +134,16 @@ In the Total Egress section, you can see the usage for the selected time period.
128134
}}
129135
/>
130136

137+
Separately, you can see the cached egress right below:
138+
139+
<Image
140+
alt="Unified Egress"
141+
src={{
142+
light: '/docs/img/guides/platform/cached-egress--light.png',
143+
dark: '/docs/img/guides/platform/cached-egress.png',
144+
}}
145+
/>
146+
131147
### Custom report
132148

133149
1. On the [reports page](https://supabase.com/dashboard/project/_/reports), click **New custom report** in the left navigation menu
@@ -144,7 +160,7 @@ In the Total Egress section, you can see the usage for the selected time period.
144160

145161
## Debug usage
146162

147-
To better understand your Egress usage, identify what’s driving the most traffic. Check the most frequent database queries, or analyze the most requested API paths to pinpoint high-bandwidth endpoints.
163+
To better understand your Egress usage, identify what’s driving the most traffic. Check the most frequent database queries, or analyze the most requested API paths to pinpoint high-egress endpoints.
148164

149165
### Frequent database queries
150166

apps/docs/content/guides/storage/production/scaling.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ Using the browser cache can effectively lower your egress since the asset remain
2424

2525
You have the option to set a maximum upload size for your bucket. Doing this can prevent users from uploading and then downloading excessively large files. You can control the maximum file size by configuring this option at the [bucket level](/docs/guides/storage/buckets/creating-buckets).
2626

27+
#### Smart CDN
28+
29+
By leveraging our [Smart CDN](/docs/guides/storage/cdn/smart-cdn), you can achieve a higher cache hit rate and therefore lower your egress cached, as we charge less for cached egress (see [egress pricing](/docs/guides/platform/manage-your-usage/egress#pricing)).
30+
2731
## Optimize listing objects
2832

2933
Once you have a substantial number of objects, you might observe that the `supabase.storage.list()` method starts to slow down. This occurs because the endpoint is quite generic and attempts to retrieve both folders and objects in a single query. While this approach is very useful for building features like the Storage viewer on the Supabase dashboard, it can impact performance with a large number of objects.

apps/docs/content/guides/storage/serving/bandwidth.mdx

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,52 @@ sidebar_label: 'Bandwidth & Storage Egress'
88

99
## Bandwidth & Storage egress
1010

11-
Free Plan Organizations in Supabase have a limit of 5 GB of bandwidth. 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.
11+
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.
1212

13-
### Checking Storage egress requests in Logs Explorer:
13+
### Checking Storage egress requests in Logs Explorer
1414

1515
We have a template query that you can use to get the number of requests for each object in [Logs Explorer](/dashboard/project/_/logs/explorer/templates).
1616

1717
```sql
1818
select
19-
r.method as http_verb,
20-
r.path as filepath,
19+
request.method as http_verb,
20+
request.path as filepath,
21+
(responseHeaders.cf_cache_status = 'HIT') as cached,
2122
count(*) as num_requests
2223
from
2324
edge_logs
24-
cross join unnest(metadata) as m
25-
cross join unnest(m.request) as r
26-
cross join unnest(r.headers) as h
27-
where (path like '%storage/v1/object/%' or path like '%storage/v1/render/%') and r.method = 'GET'
28-
group by r.path, r.method
25+
cross join unnest(metadata) as metadata
26+
cross join unnest(metadata.request) as request
27+
cross join unnest(metadata.response) as response
28+
cross join unnest(response.headers) as responseHeaders
29+
where
30+
(path like '%storage/v1/object/%' or path like '%storage/v1/render/%')
31+
and request.method = 'GET'
32+
group by 1, 2, 3
2933
order by num_requests desc
3034
limit 100;
3135
```
3236

3337
Example of the output:
3438

35-
```
39+
```json
3640
[
37-
{"filepath":"/storage/v1/object/sign/large%20bucket/20230902_200037.gif",
38-
"http_verb":"GET",
39-
"num_requests":100
40-
},
41-
{"filepath":"/storage/v1/object/public/demob/Sports/volleyball.png",
42-
"http_verb":"GET",
43-
"num_requests":168
44-
}
41+
{
42+
"filepath": "/storage/v1/object/sign/large%20bucket/20230902_200037.gif",
43+
"http_verb": "GET",
44+
"cached": true,
45+
"num_requests": 100
46+
},
47+
{
48+
"filepath": "/storage/v1/object/public/demob/Sports/volleyball.png",
49+
"http_verb": "GET",
50+
"cached": false,
51+
"num_requests": 168
52+
}
4553
]
4654
```
4755

48-
### Calculating egress:
56+
### Calculating egress
4957

5058
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.
5159
You can also get the size of the file with the following cURL:
@@ -67,6 +75,6 @@ Total Egress = 395.76MB
6775

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

70-
### Optimizing egress:
78+
### Optimizing egress
7179

72-
If you are on the Pro Plan, you can use the [Supabase Image Transformations](/docs/guides/storage/image-transformations) to optimize the images and reduce the egress.
80+
See our [scaling tips for egress](/docs/guides/storage/production/scaling#egress).

apps/docs/content/guides/storage/serving/image-transformations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ response = supabase.storage.from_('bucket').download(
259259

260260
When using the image transformation API, Storage will automatically find the best format supported by the client and return that to the client, without any code change. For instance, if you use Chrome when viewing a JPEG image and using transformation options, you'll see that images are automatically optimized as `webp` images.
261261

262-
As a result, this will lower the bandwidth that you send to your users and your application will load much faster.
262+
As a result, this will lower the egress that you send to your users and your application will load much faster.
263263

264264
<Admonition type="note">
265265

apps/docs/content/guides/telemetry/reports.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ The Storage report provides visibility into how your Supabase Storage is being u
270270
| --------------- | ------------------------------------------ | ------------------------------------------------------ |
271271
| Total Requests | Overall request volume to Storage | Traffic patterns and usage trends |
272272
| Response Speed | Average response time for storage requests | Performance bottlenecks and optimization opportunities |
273-
| Network Traffic | Ingress and egress bandwidth usage | Data transfer costs and CDN effectiveness |
273+
| Network Traffic | Ingress and egress usage | Data transfer costs and CDN effectiveness |
274274
| Request Caching | Cache hit rates and miss patterns | CDN performance and cost optimization |
275275
| Top Routes | Most frequently accessed storage paths | Popular content and usage patterns |
276276

@@ -305,5 +305,5 @@ The API Gateway report analyzes traffic patterns and performance characteristics
305305
| Total Requests | Overall API request volume | Traffic patterns and growth trends |
306306
| Response Errors | Error rates with 4XX and 5XX status codes | API reliability and user experience issues |
307307
| Response Speed | Average API response times | Performance bottlenecks and optimization targets |
308-
| Network Traffic | Request and response bandwidth usage | Data transfer patterns and cost implications |
308+
| Network Traffic | Request and response egress usage | Data transfer patterns and cost implications |
309309
| Top Routes | Most frequently accessed API endpoints | Usage patterns and optimization priorities |

apps/docs/content/troubleshooting/all-about-supabase-egress-a_Sg_e.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ While pointing out the exact cause for egress may not be straightforward, there
3131
- Reduce the number of queries/calls by optimising client code or use caches to reduce the number of requests/queries being done: https://github.com/psteinroe/supabase-cache-helpers/
3232
- In case of update/insert queries, if you don’t need the entire row to be returned, configure your ORM/queries to not return the entire row
3333
- In case of running manual backups through Supavisor, remove unneeded tables and/or reduce the frequency
34-
- For Storage, if you start using the [Smart CDN](https://supabase.com/docs/guides/storage/cdn/smart-cdn) Storage Egress usage can be managed. You can also use the [Supabase Image Transformations](https://supabase.com/docs/guides/storage/image-transformations) to optimize the images and reduce the egress.
34+
- For Storage, if you start using the [Smart CDN](https://supabase.com/docs/guides/storage/cdn/smart-cdn) Storage Egress usage can be reduced. You can also use the [Supabase Image Transformations](https://supabase.com/docs/guides/storage/image-transformations) to optimize the images and reduce the egress.
35+
36+
**Cached vs uncached egress**
37+
38+
We differentiate between cached and uncached egress. Cached egress refers to egress that is served via our CDN and hits the cache. Uncached egress, on the other hand, refers to egress that is not served from the cache and requires a fresh request to the origin server.
39+
40+
Your plan includes a quota for both cached and uncached egress and these are independent. Cached egress is also cheaper in case you exceed your quota.

apps/docs/features/docs/Reference.navigation.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export function RefLink({
214214
<Link
215215
ref={ref}
216216
// We don't use these links because we never do real navigation, so
217-
// prefetching just wastes bandwidth
217+
// prefetching just wastes egress
218218
prefetch={false}
219219
href={href}
220220
className={getLinkStyles(isActive, className)}
63.2 KB
Loading

0 commit comments

Comments
 (0)