Configure Matomo for speed

Configure your server for speed

The following recommendations help configure a server for maximum speed:

  • Hosting Matomo on a powerful dedicated server is recommended when tracking medium to high traffic websites of more than 1 million pageviews per month.
  • The server(s) you need (and CPU, RAM, Disk) depend on how many pageviews you are tracking each month. Whether you are tracking 1 million pageviews or less, 10 million pageviews, 100 million pageviews, or even more, you can find our basic recommendations of server sizing in the Matomo Server Requirements user guide.
  • Matomo (php/Mysql) will benefit from significant RAM memory on the server: 1GB memory being the minimum recommended for Matomo to process reports on very large websites, the more RAM the better!
  • Use PHP8, and the latest available stable version. (PHP8 brings performance improvements over PHP7)
  • It is recommended to use light web servers such as Nginx or lighttpd which can be faster and more efficient alternatives to Apache or IIS
  • Do not use Matomo on a shared/cluster/network filesystem such as NFS or glusterfs. Network filesystems are slower, and will create a big overhead on top of Matomo. Please use standard filesystems for all Matomo files.
  • For advanced users, you can setup Matomo to work in a load balanced environment and use multiple servers behind a load balancer.
  • Tracker API: if you manage a high traffic Matomo server, you can easily setup Matomo Tracking API to use a Redis (or MySQL) datastore for extremely fast and scalable Tracking API requests. Learn more about our QueuedTracking plugin in How do I configure Matomo to use Redis for better scalability?
  • Tracker API: if the ‘Provider’ plugin is activated in your Matomo, the Internet provider by doing a reverse DNS lookup which adds a few milliseconds overhead. To track your visitors’ ISPs it will be faster to use either DB-IP IP to ISP database or MaxMind’s ISP database. Read more about installing them here. Alternatively, for optimal performance you may disable the ‘Provider’ plugin (the plugin is disabled by default for all new users since Matomo 2.15.0) and skip the potentially slow reverse DNS lookup.

Configure your database server for speed

Matomo performance are heavily tied to Mysql database server performance as all Matomo data is stored and aggregated using Mysql queries.

  • When possible, use Solid-state drives (SSDs) as they are often faster.
  • A rough estimate of Matomo Mysql database size usage is approximately 1GB for every 5M page views. If your website tracks 100k page views per day (3M page views per month), you can expect a DB size of ~ 7GB after 1 year.
    An important factor for achieving good performance is to keep the number of unique URLs tracked low. Please make sure you setup ignored URL parameters you do not wish to count in the URL (such as session ID parameters). The less unique URLs tracked in Matomo the better!
  • If your DB server is setup as writer/reader replication, configure your reader database server in Matomo for significantly improved performance.
  • We now use Mysql Innodb tables by default (instead of Myisam) which leads to more reliability. Performance can be improved by tuning Mysql innodb settings. You may increase innodb_buffer_pool_size option as long as it fits into the RAM, which will improve general Matomo performance. We recommend to set innodb_buffer_pool_size to at least 80% of the RAM available to MySQL (and even a higher ratio if you have more than 8G of RAM).
  • In MySQL configuration you may also set innodb_flush_log_at_trx_commit=2 (reference), which will increase the tracker throughput significantly.
  • We recommend to configure MySQL and point the tmpdir to a filesystem in the RAM for example using tmpfs, instead using a tmp directory on the disk. As MySQL uses tmpdir to create and store temporary datasets, it brings additional speed when only the RAM needs to be used.
  • If you have limited database space, it may help to delete old logs, for example visitor logs older than 6 months. It helps keep the database size more manageable.
  • To get the most out of MySQL, it is necessary to have the settings optimized to handle the high load and a large database. There are several MySQL settings which can be tuned in order to improve performance. To get a list of suggestions of optimal MySQL settings we recommend to use Mysql Tuning Primer or Mysql Tuner tools.
  • See also optimizing Innodb I/O on mysql.com.
  • The official Matomo Analytics cloud service can support high traffic Matomo servers up to 500 Million actions tracked per month.
  • If your website tracks 100M+ pages per month, Matomo may start to reach php memory limits or other mysql or hardware limitations. Contact us for support. We help customers who successfully track up to 1 billion actions per month in Matomo.

Optimise your website tracking for speed

Resources

Contact us for any advice or problem: we will make sure you make the most of Matomo. If you want us to take care of your Matomo, we can migrate all of your data to our Matomo Cloud service, at no additional cost.