FAQ: you should run your archive cron every hour .... oh really?


We use Piwik for about 3 years now. 1200 websites are tracked and the database has grown to 35GB by now.
We had constantly the

There is no data for this report

Problem on some sites (not all)

Now that we want to show the Data to our customers and not just to ourselfes this is kind of a problem…

If i follow the FAQ we have to setup our cronjob to hourly Piwik FAQ.
But imho that doesn’t make any sense because as we used apache with mod_php before archive.php took about 12 hours to archive all the data. now that we use nginx with php-fpm it takes about 4 hours. (a big performance plus). We used to archive once a day with 86400s in the piwik settings

Now my question is: How many times should we archive the new data and what would be the best practice? What time should we type into the piwik settings.

Well if it takes you 4 hours per archive there is only a max of 6 a day you could run? I am pretty sure there once an hour recomendation is for what they consider normal use. The amount of sites you track would not fall into that category.

But I would think the real question is why are you not just using cron to run the archive script at your needed internval rate and trying to stick to once an hour? Cron does not have to be run hourly.

On my main install I can only run it every 8 hours

If you want to run a script lets say every four hours.

0 */4 * * * www-data /usr/bin/php5 /path/to/piwik/misc/cron/archive.php -- url=http://example.org/piwik/ > /home/example/piwik-archive.log

This will run the script every 4 hours starting at hour 0 as the user www-data. Of course modify this to suit your personal needs.

Hi vwyonda

Thank you for your response. i know that i could scedule the cronjob the way i want.
My cronjob runned once every night at 1 am.
but there is still the problem with “There is no data for this report”

I think there is a problem with the seconds i typed into the piwik settings. do i have to get a lower number than 86400 (24h in seconds)?
It looks like piwik would flush all daily reports than look which ID hasn’t been archived in the last 24 hours and skip the rest.

if this is true, then it would automaticly skip all high id’s… cause if the archive script takes 4 hours they have been archived 20 hours ago when the next period of archive begins…

So i don’t get what i have to type into the piwik settings…

When you run your archive script every 8 hours, what number of seconds did you type into the piwik settings?

I have 28800 in mine. Also check your PHP memory limit.

hmm… and you never had any problems with the data not shown?

i’ll double checked the configuration of php-fpm… memory limit is high enought, no server errors on that

I guess i’ll try increasing the number of archive runs…

hope that helps. thanks a lot for your reply vwyoda