Help In Running send-campaign Cron Job on Distributed Server using limit & offset

pradeep sharma

Active Member
HI @twisted1919

I am exploring options to run the Send campaign command corn job on the following architecture and want to know your input and limitations.

I have 2 Servers where i want to distribute the load of send-campaign cron jobs

Physical Server 1 :

send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=0
send-campaigns --campaigns_type=regular --campaigns_limit=20 --campaigns_offset=10
send-campaigns --campaigns_type=regular --campaigns_limit=30 --campaigns_offset=20


Physical Server 1 :

send-campaigns --campaigns_type=regular --campaigns_limit=40 --campaigns_offset=30
send-campaigns --campaigns_type=regular --campaigns_limit=50 --campaigns_offset=40
send-campaigns --campaigns_type=regular --campaigns_limit=60 --campaigns_offset=50


with PCNTL=YES

Both Phsical Server are connected with the Same application DATABASE
 
Limit has to stay the same, only the offset changes.
You need to use Redis for mutexes and cache in this case, because the locks must synchronise.
Other than this, you could also insert a small pause in between each command call:
Code:
sleep 5 && send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=0
sleep 10 && send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=10
sleep 15 && send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=20
And it should work just fine.
 
Limit has to stay the same, only the offset changes.
You need to use Redis for mutexes and cache in this case, because the locks must synchronise.
Other than this, you could also insert a small pause in between each command call:
Code:
sleep 5 && send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=0
sleep 10 && send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=10
sleep 15 && send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=20
And it should work just fine.
We have deployed full application on 2 physical nodes

Server 1 with

Code:
send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=0

Server 2 with

Code:
send-campaigns --campaigns_type=regular --campaigns_limit=10 --campaigns_offset=10

is there anything special we need to setup.
You need to use Redis for mutexes and cache in this case, because the locks must synchronise.
is this still necessary if we have deployed full app and server 1 process only first 10 campaign and server 2 process next 10 as indicated above!
 
Back
Top