Piwik very slow tracking response (25+ seconds!)


#1

I have started seeing this behaviour where it takes 20-30 seconds for piwik to return the tracking request. See attached screenshot.

Here is what I have found so far:

It happens only on initial pageload if the page has not been accessed for some time.
If you wait it out (20-30 seconds) and then reload the page, the response on the second pageload is instant.

There are no slow queries
I checked the mysql slow query log, nothing is output. (I put 5 seconds as the slow query threshold).

Has anyone seen something like this? How do you fix it??

Thanks.


(Matthieu Aubry) #2

That’s probably because the first time it will run the scheduled tasks. to prevent this slow laoding (which should happen only one request per hour at most) then setup the cron: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo


#3

Thanks matt.

I have checked the logs that I collect from Piwik CRON and it has been running at 15 * * * * schedule correctly for months.
Can the CRON somehow lock the data tables? Because it does take 60-120 seconds to run the job each hour.

Also, is there any way I can explicitly disable jobs from running during a tracking request? Like a config flag?

Thanks again!


#4

Hi again, any more ideas regarding this one? Thanks.


(Matthieu Aubry) #5

If you disable in the “Settings > general settings” and set Browser trigger archiving to FALSE then the Tracking API piwik.php requests will not trigger the scheduled tasks. Maybe this will help?


#6

Thanks matt,

“Allow Piwik archiving to trigger when reports are viewed from the browser” was already set to “No” under Settings > General.

I tried changing "Reports for today (or any other Date Range including today) will be processed at most every "
from 10 to 1800 seconds. Could that help with this issue?


(Matthieu Aubry) #7

Another idea: disable the Provider plugin -> this may help a lot if your reverse DNS server is slow


#8

Thanks Matt!

I deactivated the Provider plugin as you suggested. I think the feature is not very useful (what can you do with provider data anyway?) and absolutely not worth incurring a DNS request for every visitor, so thanks for the suggestion!