Hohe Serverlast durch Suche nach mehreren Tags
Posted: Sat Jan 28, 2023 8:21 pm
Hallo,
in letzter Zeit schlagen bei mir Anfragen auf, die einige Last erzeugen. Diese beziehen sich zumeist auf ältere Beiträge und suchen nach mehreren Tags:
Dabei entsteht eine SQL-Abfrage, die ewig dauert:
Die obige Query benötigte 2494 Sekunden bis zur Beendigung. Da das nicht nur ein Query ist, könnt ihr euch denken, dass der Server manchmal ganz schön ächzt.
Ein Problem erscheint mir, dass plugin/tag mehrfach im Request vorkommt.
Derzeit ist das über einen Eintrag in der .htaccess geblockt:
Habt ihr ähnliches auf euren Seiten gesehen und wie kann man das eventuell mit S9Y-Mitteln beheben?
in letzter Zeit schlagen bei mir Anfragen auf, die einige Last erzeugen. Diese beziehen sich zumeist auf ältere Beiträge und suchen nach mehreren Tags:
Code: Select all
https://…/blog/archives/1999/plugin/tag/tag1/tag2/tag3/plugin/tag/tag4
Code: Select all
SELECT neg.tag AS tag, count(neg.tag) - 14 AS total
FROM serendipity_entrytags AS main LEFT JOIN serendipity_entrytags AS neg ON main.entryid = neg.entryid LEFT JOIN serendipity_entrytags AS sub0 ON main.entryid = sub0.entryid LEFT JOIN serendipity_entrytags AS sub1 ON main.entryid =
sub1.entryid LEFT JOIN serendipity_entrytags AS sub2 ON main.entryid = sub2.entryid LEFT JOIN
serendipity_entrytags AS sub3 ON main.entryid = sub3.entryid LEFT JOIN serendipity_entrytags AS sub4 ON main.entryid = sub4.entryid
LEFT JOIN serendipity_entrytags AS sub5 ON main.entryid = sub5.entryid LEFT JOIN serendipity_entrytags AS sub6 ON main.entryid =
sub6.entryid LEFT JOIN serendipity_entrytags AS sub7 ON main.entryid =
sub7.entryid LEFT JOIN serendipity_entrytags AS sub8 ON main.entryid = sub8.entryid LEFT JOIN serendipity_entrytags AS sub9 ON
+main.entryid = sub9.entryid LEFT JOIN
serendipity_entrytags AS sub10 ON main.entryid = sub10.entryid LEFT JOIN serendipity_entrytags AS sub11 ON main.entryid =
sub11.entryid LEFT JOIN serendipity_entrytags
AS sub12 ON main.entryid = sub12.entryid LEFT JOIN serendipity_entrytags AS sub13 ON main.entryid = sub13.entryid
WHERE (sub0.tag = 'tag1' AND sub1.tag = 'tag2' AND sub2.tag = 'tag3' AND sub3.tag = 'tag4' AND sub4.tag = 'tag5' AND
sub5.tag = 'tag6' AND sub6.tag =
'tag7' AND sub7.tag = 'tag8' AND sub8.tag = 'tag9' AND sub9.tag = 'tag10' AND sub10.tag = 'tag11' AND sub11.tag =
'tag12' AND sub12.tag = 'tag' AND
sub13.tag = 'tag14') AND (neg.tag != 'tag1' AND neg.tag != 'tag2' AND neg.tag != 'tag3' AND neg.tag != 'tag4' AND neg.tag !=
'tag4' AND neg.tag != 'tag5'
AND neg.tag != 'tag7' AND neg.tag != 'tag8' AND neg.tag != 'tag9' AND neg.tag != 'tag10' AND neg.tag != 'tag11' AND
neg.tag != 'tag12' AND neg.tag !=
'tag' AND neg.tag != 'tag14')
GROUP BY neg.tag
LIMIT 45
Ein Problem erscheint mir, dass plugin/tag mehrfach im Request vorkommt.
Derzeit ist das über einen Eintrag in der .htaccess geblockt:
Code: Select all
RewriteRule plugin/tag/.*/plugin/tag - [F]