High swap usage #33289
High swap usage
#33289
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article.
Learn what high Swap usage means, what can cause it, and how to solve it.
What is swap for?
Every Supabase project runs on its own dedicated virtual machine. The machine's underlying specs and hardware depend on your compute add-on. If your hardware isn't suitable for your workload, you might experience high Swap usage.
Swap is a portion of your instance's disk that is reserved for the operating system to use when the available RAM is used. As it uses the disk, Swap is slower to access and is generally used as a last resort.
Swap can be used even if your instance has plenty of RAM. If this is the case, do not worry. Your instance might try to "preemptively swap" by swapping background processes to make space for your traffic in RAM.
When is high swap concerning?
High Swap is concerning if your instance is using all of the available RAM (i.e. consistently using more than 75%).
High Swap usage can affect your database performance. For example, you might see:
Monitor your swap
You can monitor your resources and set up alerts using Prometheus/Grafana. See the metrics guide for more information.
An example repository to ingest metrics and visualize them with Grafana is provided in the linked guide, where we maintain a list of the exported metrics.
Some useful metrics to monitor are (this is not an exhaustive list):
node_memory_SwapFree_bytes- The total amount of Swap available in bytes.node_disk_io_time_seconds_totalandnode_disk_io_now- The amount of time spent on disk I/O. An increase might be an indirect sign of excessive swapping, but not always.node_memory_MemTotal_bytesandnode_memory_MemFree_bytes- The total RAM and available RAM.node_vmstat_pswpinandnode_vmstat_pswpout- The number of pages that have been swapped in or out (monitoring this for spikes means that your instance is swapping).Common reasons for high swap usage
Everything you do with your Supabase project requires compute. Hence, there can be many reasons for high Swap usage. Here are some common ones:
Solving high swap usage
If you find that your RAM and Swap usage are high, you have three options:
Beta Was this translation helpful? Give feedback.
All reactions