Skip to content

Instantly share code, notes, and snippets.

@cabecada
Created March 21, 2023 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cabecada/47881fadd26aafa5a81250fdb4319ec4 to your computer and use it in GitHub Desktop.
Save cabecada/47881fadd26aafa5a81250fdb4319ec4 to your computer and use it in GitHub Desktop.
lr test
#if i bump number of concurrent subscriptions to 400 my vm freezes :), but otherwise it works fine. so may be some resource bottleneck
#is resulting in the errors
postgres@pg:~/temp$ cat run.sh
#!/bin/bash
for i in {1..3}
do
pg_ctl -D db$i -l db${i}.log stop
rm -rf db$i
done
for i in {1..3}
do
initdb -D db$i
echo "port=800$i" >> db$i/postgresql.auto.conf
echo "wal_level=logical" >> db$i/postgresql.auto.conf
echo "max_logical_replication_workers=100" >> db$i/postgresql.auto.conf
echo "max_replication_slots=100" >> db$i/postgresql.auto.conf
echo "max_worker_processes=100" >> db$i/postgresql.auto.conf
echo "max_wal_senders=100" >> db$i/postgresql.auto.conf
echo "max_connections=100" >> db$i/postgresql.auto.conf
done
for i in {1..3}
do
pg_ctl -D db$i -l db${i}.log start
done
for i in {1..20}
do
psql -p 8001 <<EOF
create table t$i (id int primary key);
insert into t$i select x from generate_series(1, 1000) x;
create publication t$i for table t$i with (publish='insert,update,delete');
EOF
done
for i in {1..20}
do
psql -p 8002 <<EOF1
create table t$i (id int primary key);
EOF1
psql -p 8003 <<EOF2
create table t$i (id int primary key);
EOF2
done
for i in {1..20}
do
psql -p 8002 -c "create subscription x$i CONNECTION 'port=8001 dbname=postgres' PUBLICATION t$i;" &
psql -p 8003 -c "create subscription y$i CONNECTION 'port=8001 dbname=postgres' PUBLICATION t$i;" &
done
#######################
2023-03-21 13:16:13.254 IST [12928] LOG: logical decoding found consistent point at 0/19DEDF8
2023-03-21 13:16:13.254 IST [12928] DETAIL: There are no running transactions.
2023-03-21 13:16:13.254 IST [12928] STATEMENT: START_REPLICATION SLOT "pg_16502_sync_16479_7212902636069310652" LOGICAL 0/19DEE30 (proto_version '2', publication_names '"t20"')
####when i bump to 400 the same script
s/100/400/ pg params
s/20/50/ tables
postgres@pg:~/temp$ cat run.sh
#!/bin/bash
for i in {1..3}
do
pg_ctl -D db$i -l db${i}.log stop
rm -rf db$i
done
for i in {1..3}
do
initdb -D db$i
echo "port=800$i" >> db$i/postgresql.auto.conf
echo "wal_level=logical" >> db$i/postgresql.auto.conf
echo "max_logical_replication_workers=400" >> db$i/postgresql.auto.conf
echo "max_replication_slots=400" >> db$i/postgresql.auto.conf
echo "max_worker_processes=400" >> db$i/postgresql.auto.conf
echo "max_wal_senders=400" >> db$i/postgresql.auto.conf
echo "max_connections=400" >> db$i/postgresql.auto.conf
done
for i in {1..3}
do
pg_ctl -D db$i -l db${i}.log start
done
for i in {1..50}
do
psql -p 8001 <<EOF
create table t$i (id int primary key);
insert into t$i select x from generate_series(1, 1000) x;
create publication t$i for table t$i with (publish='insert,update,delete');
EOF
done
for i in {1..50}
do
psql -p 8002 <<EOF1
create table t$i (id int primary key);
EOF1
psql -p 8003 <<EOF2
create table t$i (id int primary key);
EOF2
done
for i in {1..50}
do
psql -p 8002 -c "create subscription x$i CONNECTION 'port=8001 dbname=postgres' PUBLICATION t$i;" &
psql -p 8003 -c "create subscription y$i CONNECTION 'port=8001 dbname=postgres' PUBLICATION t$i;" &
done
-------------------------------------------------------
2023-03-21 13:21:06.837 IST [13912] FATAL: terminating connection due to unexpected postmaster exit
2023-03-21 13:21:06.852 IST [14012] FATAL: terminating connection due to unexpected postmaster exit
2023-03-21 13:21:06.860 IST [14010] FATAL: terminating connection due to unexpected postmaster exit
2023-03-21 13:21:06.871 IST [13994] FATAL: terminating connection due to unexpected postmaster exit
2023-03-21 13:21:06.889 IST [14002] FATAL: terminating connection due to unexpected postmaster exit
2023-03-21 13:21:07.088 IST [14001] FATAL: terminating connection due to unexpected postmaster exit
2023-03-21 13:21:07.123 IST [13839] FATAL: connection to client lost
2023-03-21 13:21:07.167 IST [13855] FATAL: connection to client lost
2023-03-21 13:21:07.252 IST [13840] FATAL: connection to client lost
2023-03-21 13:21:07.253 IST [13853] FATAL: connection to client lost
2023-03-21 13:21:07.284 IST [13780] FATAL: connection to client lost
2023-03-21 13:21:07.307 IST [13781] FATAL: connection to client lost
2023-03-21 13:21:07.333 IST [13785] FATAL: connection to client lost
ofc resource issues, but otherwise looks ok when i reduce concurrency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment