Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add guide on high CPU usage

Long Hoang83e3085f6039
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
index 0e8b4039757..e348d97f767 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
@@ -922,6 +922,10 @@ export const platform = {
name: 'HTTP and Project Issues',
url: '/guides/platform/troubleshooting',
},
+ {
+ name: 'High CPU Usage',
+ url: '/guides/platform/exhaust-cpu',
+ },
],
},
],
diff --git a/apps/docs/pages/guides/platform/exhaust-cpu.mdx b/apps/docs/pages/guides/platform/exhaust-cpu.mdx
new file mode 100644
index 00000000000..c31468d7b93
--- /dev/null
+++ b/apps/docs/pages/guides/platform/exhaust-cpu.mdx
@@ -0,0 +1,48 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+
+export const meta = {
+ id: 'exhaust-cpu',
+ title: 'High CPU Usage',
+ description: 'Learn what high CPU usage could mean for your Supabase instance and what could have caused it.',
+}
+
+Learn what high CPU usage could mean for your Supabase instance and what could have caused it.
+
+## The danger of high CPU usage
+
+Every Supabase project runs in its dedicated virtual machine. Your instance will have a different set of hardware provisioned depending on your [compute add-on](https://supabase.com/docs/guides/platform/compute-add-ons). Your hardware may not be suitable for the intended workload and may experience high CPU usage.
+
+High CPU usage could come with a range of issues:
+
+* slower queries
+* disruption of daily backup routines
+* in rare cases, your instance may become unresponsive
+
+Moreover, your instance might not be able to handle future traffic spikes if it already has a high CPU usage.
+
+## Monitor your CPU
+
+You can check your CPU usage directly on the Supabase Platform. For this go to database health in the reports section or [click here](https://app.supabase.com/project/_/reports/database) and select your project.
+
+![CPU usage reported on Supabase dashboard](/docs/img/guides/platform/exhaust-cpu-report.png)
+
+It is also possible to monitor your resources and set up alerts using Prometheus/Grafana. You can find a guide for this [here](https://supabase.com/docs/guides/platform/metrics).
+
+## Common reasons for high CPU usage
+
+Everything you do with your Supabase project requires compute. Hence, there can be many reasons for high CPU usage. Here are some common ones:
+
+* __Query performance:__ Queries that take a long time to complete (>1 second) as well as excessive amounts of querying can put a strain on the CPU. Check our guide on [examining query performance](https://supabase.com/docs/guides/platform/performance#examining-query-performance).
+* __Missing indexes:__ Your database might have to scan through a large amount of data to find the information it needs. Creating indexes helps your database find data faster. Learn more about indexes [here](https://supabase.com/docs/guides/database/postgres/indexes).
+* __Unsuitable compute:__ The instance size of your Supabase project might not be suitable for your application as you might have more traffic or run resource-intensive operations.
+
+## Solving high CPU usage
+
+There are two ways to solve high CPU:
+
+1. __Optimize performance:__ Get more out of your instance's resources by optimizing your usage. Have a look at our [performance tuning guide](https://supabase.com/docs/guides/platform/performance#examining-query-performance) and our [production readiness guide](https://supabase.com/docs/guides/platform/going-into-prod#performance).
+2. __Upgrade your compute:__ You can get a Compute Add-on for your project. Follow [this link](https://app.supabase.com/project/_/settings/billing/update/pro) and select your project to see your upgrade options.
+
+export const Page = ({ children }) => <Layout meta={meta} children={children} />
+
+export default Page
diff --git a/apps/docs/public/img/guides/platform/exhaust-cpu-report.png b/apps/docs/public/img/guides/platform/exhaust-cpu-report.png
new file mode 100644
index 00000000000..8d62afb6de1
Binary files /dev/null and b/apps/docs/public/img/guides/platform/exhaust-cpu-report.png differ