The time to send a newsletter rises with the number of mails already sent:
newsletter
mails_total
time_sending_total
time_avg_per_mail
16 (fixed)
2655
3121
1.1755
15
2633
44760
16.9996
14 (short special*)
2613
20521
7.8534
13
2608
45780
17.5537
12
2594
41220
15.8905
11
2572
30780
11.9673
10 (short special*)
2540
11280
4.4409
9
2531
25680
10.1462
8 (short special*)
2522
8101
3.2121
7
2519
29340
11.6475
6
2521
13380
5.3074
3
2509
10920
4.3523
2
2492
9059
3.6352
* short special: mailing with ~10 links instead of ~50
SQL to reproduce table (click to open)
~~~ sql
SELECT `newsletter`,
`mails_total`,
`time_end` - `time_start` AS 'time_sending_total',
(`time_end` - `time_start`) / `mails_total` AS 'time_avg_per_mail'
FROM (
SELECT `newsletter`,
COUNT(`uid`) AS 'mails_total',
MIN(`tstamp`) as 'time_start',
MAX(`tstamp`) AS 'time_end'
FROM `tx_luxletter_domain_model_queue`
GROUP BY `newsletter`
) AS `queue_tmp`
ORDER BY `newsletter` DESC
~~~
SQL to reproduce data (click to open)
~~~ sql
SELECT `newsletter`, COUNT(`uid`) AS 'mails_total', `tstamp`
FROM `tx_luxletter_domain_model_queue`
GROUP BY `newsletter`, `tstamp`
ORDER BY `tstamp` ASC
~~~
How to reproduce
number of entries in tx_luxletter_domain_model_link > 500.000
send more newsletters
Root cause
Slow db query to check if a link entry already exists - taking up to 0.5 s for each link:
SELECT `tx_luxletter_domain_model_link`.* FROM `tx_luxletter_domain_model_link` `tx_luxletter_domain_model_link`
WHERE (`tx_luxletter_domain_model_link`.`hash` = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')
AND (`tx_luxletter_domain_model_link`.`sys_language_uid` IN (0, -1)) AND ((`tx_luxletter_domain_model_link`.`hidden` = 0) AND (`tx_luxletter_domain_model_link`.`starttime` <= 9999999999) AND ((`tx_luxletter_domain_model_link`.`endtime` = 0) OR (`tx_luxletter_domain_model_link`.`endtime` > 1111111111)) AND tx_luxletter_domain_model_link.deleted=0) ORDER BY `tx_luxletter_domain_model_link`.`crdate` DESC LIMIT 1
E.g. a newsletter has:
50 links
2.400 recipients
This results in 2.400 * 50 = 120.000 total link checks
Total time for link checks: 120.000 * 0,5 s = 60.000 s or ~17 h
How to fix
PR follows.
System
luxletter: 2.3.0
TYPO3-Version: 9.5.26
Webserver: Apache
PHP-Version: 7.3.28
Database (Default): MySQL 5.5.5-10.0.38-MariaDB
Application Context: Production
Composer Mode: active
Operating System: Linux 3.10.0-693.11.6.el7.x86_64
The time to send a newsletter rises with the number of mails already sent:
* short special: mailing with ~10 links instead of ~50
SQL to reproduce table (click to open)
~~~ sql SELECT `newsletter`, `mails_total`, `time_end` - `time_start` AS 'time_sending_total', (`time_end` - `time_start`) / `mails_total` AS 'time_avg_per_mail' FROM ( SELECT `newsletter`, COUNT(`uid`) AS 'mails_total', MIN(`tstamp`) as 'time_start', MAX(`tstamp`) AS 'time_end' FROM `tx_luxletter_domain_model_queue` GROUP BY `newsletter` ) AS `queue_tmp` ORDER BY `newsletter` DESC ~~~SQL to reproduce data (click to open)
~~~ sql SELECT `newsletter`, COUNT(`uid`) AS 'mails_total', `tstamp` FROM `tx_luxletter_domain_model_queue` GROUP BY `newsletter`, `tstamp` ORDER BY `tstamp` ASC ~~~How to reproduce
tx_luxletter_domain_model_link
> 500.000Root cause
Slow db query to check if a link entry already exists - taking up to
0.5 s
for each link:E.g. a newsletter has:
This results in
2.400 * 50 = 120.000
total link checksTotal time for link checks:
120.000 * 0,5 s = 60.000 s
or~17 h
How to fix
PR follows.
System