Recommended settings for Matomo on high traffic websites with millions of page views
Matomo (Piwik) can scale to millions of page views per month and/or to thousands of registered websites. If you have a few hundreds visits/page views per day, Matomo should work fine « out of the box ».
Learn more about Matomo requirements and server sizing (capacity planning).
Main guide to follow to configure Matomo for speed
Learn more in Configure Matomo for speed
Recommended PHP settings via php.ini
Locate your php.ini
file and set the following values:
memory_limit = 2G
max_execution_time = 0
log_errors = On
display_errors=Off
Recommended MySQL settings via my.cnf
To configure MySQL, please follow the steps below:
Locate your MySQL configuration file called my.cnf and set the following values under the section [mysqld]
; if you track less than 1M actions per month
; you can lower the value below to 512MB
max_allowed_packet = 1G
wait_timeout = 28800
Restart MySQL to apply these changes.
Recommended Matomo settings via common.config.ini.php
Create a new configuration file in path/to/matomo/config/common.config.ini.php
In this common configuration file we set the default, best practises configuration settings:
; <?php exit; ?> DO NOT REMOVE THIS LINE
;
; This common.config.ini.php file is read right before config.ini.php
[General]
; Always use SSL and redirect http->https in Matomo
force_ssl = 1
; Do not allow users to trigger the Matomo archiving process.
; Ensures that no unexpected data processing triggers from UI or API.
enable_browser_archiving_triggering = 0
; Uncomment to make sure that API requests with
; a &segment= parameter will not trigger archiving
; browser_archiving_disabled_enforce = 1
;Uncomment to disable historical archive processing
;when a new plugin is installed and may try process historical data
;rearchive_reports_in_past_last_n_months =
;rearchive_reports_in_past_exclude_segments = 1
; Disable OPTIMIZE TABLE statement which can create dead-locks
; and prevent MySQL backups
enable_sql_optimize_queries = 0
; Enable Matomo application logging to both file and screen
[log]
log_writers[] = "file"
log_writers[] = "screen"
; Matomo logs (WARN, ERROR) are written in matomo/tmp/logs/matomo.log
logger_file_path = tmp/logs/matomo.log
[CustomReports]
custom_reports_max_execution_time = 2700
custom_reports_disabled_dimensions = "CoreHome.VisitLastActionDate"
If you don’t want to manage Matomo on your servers, you can sign up to a free trial of Matomo Cloud and get the experts to manage all the technicalities for you!