Matomo Archive crashing server

Hello, we are having an issue with our Matomo server. We have a server with 8 core Intel® Xeon® CPU E5-2667 v3 @ 3.20GHz with 10GB memory. We have around 75,000 page views and 500,000 events each month. Our Matomo database is nearing 20GB for 3 years of data. We don’t have an ultra high traffic website, but we do track ad views using events, which is very important to our subscribers.

We are running this crontab as per the documentation:

5 * * * * /usr/local/bin/php /home/analytics/public_html/console core:archive --php-cli-options="-d memory_limit=-1"

Our server continuously fails over and runs out of memory with this command, and if I don’t put memory limit -1 then the command will just run out of memory and not finish process. The command will run for 30+ minutes, and take our server down.

We just need to be able to have the last full month archived, so we don’t need to see what happened last week, yesterday, etc.

Would it be better to run this command once a day with the “day” period? Or once a month with the “month” period? We only need monthly data, so if aggregation is not available up to the minute or day it’s no big deal. As long as we can look at and access last months data. But if the command is not even finishing every 5 minutes, would a month of data never possibly complete? Is 5 minute archiving even necessary, even though it was in the docs?

We are very confused on how to correctly optimize the archive command, and any guidance is appriciated.