Interpreting Supabase Grafana CPU charts #27022
TheOtherBrian1
announced in
Troubleshooting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Examples of stressed CPU
Showing high busy kernel CPU (yellow). Symptomatic of extension or connection-related issues.
High busy user CPU (blue). Symptomatic of problematic queries or database overload:
High busy IOWait (red). Even though the amount is relatively low, because disk is so much slower than CPU, a small amount is a sign of inadequate memory or disk IOPS/throughput:
Completely overwhelmed. Symptomatic of misuse and problematic data access patterns
Interpreting charts
The CPU chart shows 4 distinct metrics of interest:
As the CPU peaks towards 100%, queries and database tasks will begin to throttle, as they won't have enough time or access to the CPU.
Identifying problematic queries:
you should review your query performance advisor. Alternatively, you can access pg_stat_statements view. If you query it directly, you should focus on queries that create extremes:
PostgreSQL will produce a lot of activity in the background, so it's preferable to focus only on requests made by your application. This usually means filtering results from just the
postgres
role and, if you're using the DB API, theauthenticator
role, too.Frequently called queries are the most insightful, so you should limit your observations to only the 30 most called. If this number is too narrow, expand as needed.
Special emphasis should be placed on queries that have a higher likelihood of CPU usage:
Besides the query explorer, queries that generate timeout and duration events in the logs can also be of interest. You can go to the Logs Explorer, and run the following query to identify the events:
Optimizing:
Other useful Supabase Grafana guides:
Beta Was this translation helpful? Give feedback.
All reactions