Comments (13)
Update of root cause, from SO:
The most common reason why the PostgreSQL WAL backlogs is because the connector is monitoring a database or a subset of tables from your database change much more infrequent compared to the other tables or databases in your environment and therefore the connector isn't acknowledging the LSNs frequent enough to avoid the WAL backlog.
This seems to be caused on DO and AWS because they have their own background processes running.
- Slot 1 - DO replication gets triggered on every change
- Slot 2 - Supabase replication only gets triggered if a specified table gets changed
Because Supabase is only receiving infrequent events, it never has a chance to "acknowledge" the latest lsn
. When some new data is inserted though, the acknowledgement goes through and the storage is cleared:
from realtime.
You're becoming a real power user @retendo , thanks for digging up all these niche issues. We saw this once, but it was due to a rogue query. Can you try a few things?
- Run
pg_stat_activity
and check if there are a few long-running queries? - Confirm if you are dumping a large amount of updates/inserts each day? (which will trigger a huge amount of changes to the WAL)
- check the size of the WAL
- Send through the details of the active replication slots: https://www.postgresql.org/docs/current/view-pg-replication-slots.html
If you also use slack, I can add you to our internal slack and we can debug together. Send me an email if you want a slack invite: copple[at]supabase[dot]io
from realtime.
It might also be worth disconnecting everything from the database (including Realtime) and see if this is still happening, to help isolated the root cause
from realtime.
It might also be worth disconnecting everything from the database (including Realtime) and see if this is still happening, to help isolated the root cause
I already did that, and it was only happening when realtime server was connected. I have 3 services running and I tried almost every combination. It's only happening when realtime is connected, no matter which other services are connected or not.
If you also use slack, I can add you to our internal slack and we can debug together.
Sure, I'll drop you a mail.
from realtime.
Copying my message from Slack:
Hey @retendo, can you tell me how you set up Realtime with DO’s managed Postgres? IIUC you don’t have superuser access in managed Postgres [0], which means you can’t do
ALTER SYSTEM
andCREATE PUBLICATION
, which means Realtime doesn’t work with it [1]
[0] https://www.digitalocean.com/docs/databases/postgresql/#postgresql-limits
[1] https://supabase.io/docs/realtime/about#setting-up-replication
from realtime.
I was able to replicate this on both DO and AWS. From AWS:
Unlike DO, the disk space doesn't get freed once it's full. Looking at another monitor, it seems like transaction log is the culprit:
This was an idle Postgres database (aside from a few queries for sanity check). I'm not sure what filled up the transaction log, but I saw these queries keep happening on DO:
So assuming it's some managed DB services that make these transactions (because there's no such problem AFAIK in Supabase Postgres), it could be that unvacuumed WAL blows up the disk space.
Not sure how to fix this yet.
from realtime.
Workaround while we solve this:
1. Create a table in your database called "heartbeat"
create table public.heartbeat (
updated_at timestamp
);
*2. Add this table to the publication
CREATE PUBLICATION supabase_realtime FOR ALL TABLES;
-- if you can't do this on your server, try create it for just the table:
CREATE PUBLICATION supabase_realtime FOR TABLE heartbeat
3. Every so often, update this table
update heartbeat set updated_at = now();
If you trigger 3
every minute or so, the database will clear the data stored for the slot.
We will add a function to this server where we can send an acknowledgement every few seconds without this workaround
from realtime.
HI there i am still facing this issue with supabase/postgres:14.1.0.21 its consuming disk space without any usease.
from realtime.
HI there i am still facing this issue with supabase/postgres:14.1.0.21 its consuming disk space without any usease.
@AshaBhasker are you using Realtime at all?
from realtime.
@w3b6x9 Actually i just followed the steps as per this doc: https://www.vultr.com/docs/how-to-install-supabase-on-ubuntu-20-04/
with in 2 days, without any use 60GB were consumed.
from realtime.
I configured Supabase on digitalocean Droplet using this documentation:
https://www.vultr.com/docs/how-to-install-supabase-on-ubuntu-20-04/
after 1week I saw that all the disk space is consumed. I saw var/log/postgresql/postgresql.csv file consumed all disk space. So i disabled the logging. and re-configure the supabase. Now this file size is not increasing but server disk space is still consumed.
Please help me fix this issue.
from realtime.
@w3b6x9 I'm experiencing the same issue with supabase/postgres:14.1.0.21
.
Did you fix it?
from realtime.
you can disable logging in the postgres config by setting the log_level = fatal
from realtime.
Related Issues (20)
- log_min_messages requires elevated privileges HOT 1
- Docker hub `latest` image tag is very old HOT 3
- What version of realtime is hosted Supabase using? HOT 1
- Add region to all Logger metadatas
- Realtime: Self Hosting - Docker Swarm mode HOT 6
- Docker-compose file appears to be broken HOT 40
- Unable to use null filters like 'parent IS NULL' in supabase realtime. HOT 3
- How is postgres binary data serialized?
- > Does supabase have null filters? HOT 1
- Self hosted : failed to connect: ** (Postgrex.Error) ssl not available HOT 1
- Startup error running migrations: table identifier does not refer to an existing ETS table HOT 8
- Erroneous public.test_tenant file from Supabase Realtime Migrations HOT 5
- Supabase Realtime Subscript Fails With Undefined Error (Possibly: `Auth error: tenant 'realtime-dev' not found` HOT 15
- supabase realtime not working HOT 26
- Seeds broken in latest docker image HOT 2
- horizontal scaling for self-hosted realtime servers, for broadcast and presence features HOT 5
- HTTP 431 & Realtime Subscriptions Failing HOT 11
- Realtime event broadcasting through REST calls does not work HOT 8
- Excessive logs being printed to STD OUT/ERR HOT 1
- [Broken] Custom primary keys (nanoids) breaks realtime listeners
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realtime.