Assumption is you have a pubdb, subdb and physical standby created already.
And physical slot created on primary has the name 'standby_test'. If not, 
then please change 'standby_slot_names' and 'primary_slot_name' accordingly
in below configurations.

Recommended postgresql.conf settings for the tests:
--------
pub conf:
--------
port = ....
wal_level=logical
standby_slot_names='standby_test'
synchronize_slot_names='*'
max_wal_senders=500
max_worker_processes=1000
max_replication_slots=500

-------
standby conf:
--------
port = ....
wal_level=logical
synchronize_slot_names='*'
primary_slot_name = 'standby_test'
max_slot_sync_workers=1
max_wal_senders=500
max_worker_processes=1000
max_replication_slots=500

---------
sub conf:
--------
port = ....
max_wal_senders=500
max_worker_processes=1000
max_replication_slots=500
max_logical_replication_workers=500

-----------------------





--Start pub,sub,standby now and create metadata on pub and sub by running below scripts:
pub_schema.sql
sub_schema.sql --change the script to use your pub's port# for 'create subscription' commands

--Then run workload.sh (please set path, pub_port, db_path as per your setup in this script) and parallely start slot-lag.bash script
--to take lag between standby and primary slots, it will log the lags in slot_lag table on primary
workload.sh        (It will restart standby and will run workload on primary and will shutdown standby)
slot-lag.bash 600  (this script takes 1 argument: duration in seconds. 600 will run this script for 10 mins, need to be started in parallel with workload.sh)

--run this on primary to see average lag  for that configuration of 'max_slot_sync_workers':
select avg(lag) from slot_lag;



--change 'max_slot_sync_workers' configuration in standby conf as needed and rerun workload.sh and slot-lag.bash.
--But copy and truncate slot_lag table first.
create table slot_lag_worker<n>_90slots as select * from slot_lag;
truncate slot_lag;

--since workload tables might have gone huge, truncate those as well.
trun.sql

--now run workload for next conf of 'max_slot_sync_workers', run these 2 in parallel.
workload.sh
slot-lag.bash 600

