Slow down with big list

nemesis82

Member
Hy guys,
i have issue when sending to big list, below some details
List 1:
Subscriber : 775.643
Sending time : 3h55m

List 2:
Subscriber : 1.971.692
Sending time : 16h36m

list1 created from list2 in sending campaign ( copy sub from )
List2 created with csv import process

List2 double the time reguired for sending. I expect 8h for list2 instead take 16h.
Big time less during initial part in send campaign before start sending to su
Have you some info to speed up this process? It’s a limit in big list?

thx
 

nemesis82

Member
@laurentiu , thanks for your reply.
I known that KB, the only missing is temp table usage,today i'll add this parameter and tomorrow i'll check sending status .

send campaign debug ( check timing ):
All work's fine
Code:
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 25 the offset is 4800 and the limit is 200
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 1 the offset is 0 and the limit is 200 took 0.02426 seconds
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 1
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 2 the offset is 200 and the limit is 200 took 0.02504 seconds
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 2
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 3 the offset is 400 and the limit is 200 took 0.02723 seconds
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 3
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 4 the offset is 600 and the limit is 200 took 0.03066 seconds
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 4
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 6 the offset is 1000 and the limit is 200 took 0.04309 seconds
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 6
[2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 5 the offset is 800 and the limit is 200 took 0.05009 seconds               
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 5                                                               [2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 7 the offset is 1200 and the limit is 200 took 0.05098 seconds              
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 7                                                               [2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 8 the offset is 1400 and the limit is 200 took 0.05132 seconds              
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 8                                                               [2020-11-11 01:01:24] - Finding subscribers for campaign with uid px894asxhhd10 and worker 9 the offset is 1600 and the limit is 200 took 0.05311 seconds              
[2020-11-11 01:01:24] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 9                                                               [2020-11-11 01:01:24] - Sync end for subscriber batches for campaign with uid px894asxhhd10 in worker 9 took 0.01049 seconds
[2020-11-11 01:01:24] - This subscribers worker(#9) will process 200 subscribers for this campaign...
[2020-11-11 01:01:24] - Running subscribers cleanup...


Now, after 700K sent ( only few rows just to explain )
Code:
[2020-11-11 06:56:19] - For campaign with uid px894asxhhd10 and worker 25 the offset is 4800 and the limit is 200
[2020-11-11 06:56:19] - Finding subscribers for campaign with uid px894asxhhd10 and worker 25 the offset is 4800 and the limit is 200
[2020-11-11 06:56:37] - Finding subscribers for campaign with uid px894asxhhd10 and worker 6 the offset is 1000 and the limit is 200 took 17.65196 seconds
[2020-11-11 06:56:37] - Sync start for subscriber batches for campaign with uid px894asxhhd10 in worker 6
 

nemesis82

Member
i've forgotten :
VPS conf :
CPU : 12 Core x 2.6 GHz
RAM : 196 GB
HDD : NVMe 2x1TB raid
MySql Tuner --> OK , none warning or critical , some raccomandations due to optimize delivery log table to free some space
 

nemesis82

Member
maybe below row explian better my situation , see time stamp and took time.
at the beginning of campagin
Code:
[2020-11-11 01:01:07] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 1 the offset is 0 and the limit is 200 took 0.02319 seconds
[2020-11-11 01:01:07] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 3 the offset is 400 and the limit is 200 took 0.03874 seconds
[2020-11-11 01:01:07] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 4 the offset is 600 and the limit is 200 took 0.06293 seconds
[2020-11-11 01:01:07] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 2 the offset is 200 and the limit is 200 took 0.06398 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 5 the offset is 800 and the limit is 200 took 0.07080 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 7 the offset is 1200 and the limit is 200 took 0.09437 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 6 the offset is 1000 and the limit is 200 took 0.09772 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 11 the offset is 2000 and the limit is 200 took 0.10067 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 14 the offset is 2600 and the limit is 200 took 0.11424 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 9 the offset is 1600 and the limit is 200 took 0.12653 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 13 the offset is 2400 and the limit is 200 took 0.13237 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 16 the offset is 3000 and the limit is 200 took 0.13202 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 10 the offset is 1800 and the limit is 200 took 0.13812 seconds
[2020-11-11 01:01:08] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 8 the offset is 1400 and the limit is 200 took 0.16951 seconds

at the end of the campaing
Code:
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 1 the offset is 0 and the limit is 200 took 11.53125 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 18 the offset is 3400 and the limit is 200 took 11.52992 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 8 the offset is 1400 and the limit is 200 took 11.55754 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 17 the offset is 3200 and the limit is 200 took 11.55974 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 16 the offset is 3000 and the limit is 200 took 11.56223 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 23 the offset is 4400 and the limit is 200 took 11.61893 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 24 the offset is 4600 and the limit is 200 took 11.65038 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 21 the offset is 4000 and the limit is 200 took 11.69446 seconds
[2020-11-11 03:11:19] - Finding subscribers for campaign with uid ae821ykj697d1 and worker 20 the offset is 3800 and the limit is 200 took 11.70806 seconds
 

twisted1919

Administrator
Staff member
@nemesis82 - the logs that you shown don't actually show nothing wrong.
Through those logs, you have entries that say how much time it takes to communicate with the delivery server(s), can you copy about 10 or 20 of those lines, from various places of the send process and paste them here?
 

nemesis82

Member
@twisted1919, all this log are before communication with delivery server.
With DS i have no issue, below some logs.
Code:
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.03396
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02199
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02187
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.01977
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.03316
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02232
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.01842
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02462
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02404
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02257
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.01983
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.02345
[2020-11-11 12:05:29] - Communication with the delivery server took: 0.03123
[2020-11-11 12:05:30] - Communication with the delivery server took: 0.02496
[2020-11-11 12:05:30] - Communication with the delivery server took: 0.06946

I have tried with the temp queue table options, below some details on the first cycle when the campaign start ( when campaign change from planned to processing, the initial phase ) .

without temp table :
[2020-11-11 01:01:39] - This cycle completed in 38.46 seconds and used 6 MB of memory!

with temp table
send-campaigns index Success 339.45 seconds

subsequent cycle take 40s to end. ( the right time to complete each cycle )

Now i wait the end of actual campaign and check if there are improvement on total time.
 
Last edited:

twisted1919

Administrator
Staff member
all this log are before communication with delivery server.
With DS i have no issue, below some logs.
Awesome, these are perfect timings.

with temp table
send-campaigns index Success 339.45 seconds
That's expected because the first cycle has to populate the temporary table.
subsequent cycle take 40s to end. ( the right time to complete each cycle )
Exactly as expected.

So you get 40 seconds to send with the settings above, right?
So that's 5k emails in 40 seconds (25 batches x 200 subscribers at once) which means 125 emails second.
Isn't that acceptable?

Here's why i think delivery is slower than what you expect.
You're loosing 20 seconds from each minute. Basically the cron job starts at the start of the minute, spends 40 seconds sending the emails, then till next minute when the cron job has to run again, nothing happens.
My advice is to modify your cron jobs, and where you have:
Code:
* * * * * /usr/bin/php -q .... send-campaigns ...
make it:
Code:
* * * * * /usr/bin/php -q .... send-campaigns ...
* * * * * sleep 40 && /usr/bin/php -q .... send-campaigns ...
* * * * * sleep 45 && /usr/bin/php -q .... send-campaigns ...
* * * * * sleep 50 && /usr/bin/php -q .... send-campaigns ...
* * * * * sleep 55 && /usr/bin/php -q .... send-campaigns ...
So basically you add a few more cron jobs so that when the first cron job finishes, sending does not have to wait till the next minute to send, instead it will start right away.
Makes sense?

Please note that adding those cron jobs don't add any pressure on the system when using pcntl, that's because there is a global lock on that command so any successive call to it while it is running will stop right away, it's a noop.
 

nemesis82

Member
hy guys,
with queue temp table i've solved my "slow down" issue but, due to pcntl that lock other send-campaigns command, i have another issue.
During the creation of the temp table for customer A , we lock the send process also for customer B and, if customer A has a big list ( eg. 2M take 40minutes to load ) also customer B take it paused freezed for the same time.
This behavior could be avoided ?
Otherwise, without temp table i have the same "slow down" problem during "Findind subscrbers" process as mentions above ( see bold below )

Finding subscribers for campaign with uid px894asxhhd10 and worker 6 the offset is 1000 and the limit is 200 took 17.65196 seconds

best
 

twisted1919

Administrator
Staff member
Currently we don't have a way to avoid the global pcntl lock BUT the pcntl command supports the --customer_id=x,y,z param from command line where x,y and z are customer ids, so you could split processing for multiple customers that are more sensitive, i.e:
Code:
/usr/bin/php ...send-campaigns --customer_id=1001,2200,2300
/usr/bin/php ...send-campaigns --customer_id=10,20,30
Finding subscribers for campaign with uid px894asxhhd10 and worker 6 the offset is 1000 and the limit is 200 took 17.65196 seconds
Check your database server, i am sure there can be improvements as well.
But keep in mind, when using segmentation, it's expected for this to be slow.
 
Top