Performance & analysis

Matomo stays fast even with heavy traffic when topology, database, PHP and archiving fit together. I find the bottlenecks, plan the right infrastructure and scale vertically or horizontally. Then I help your team turn the data into solid analysis.

How I work

  1. 01Measure archiving, run times and load
  2. 02Plan the topology, scale vertically or horizontally
  3. 03Tune database and PHP
  4. 04Slim down segments, reports and analyses

Typical causes when Matomo is slow

  • Archiving runs in the browser instead of via cron
  • Too many segments are processed in real time
  • Raw data is kept forever
  • Database and PHP are not sized for the traffic
  • Tracking, archiving and reports share a single server

Scaling Matomo: topology and servers

The right infrastructure depends on traffic, the number of sites and your availability requirements. I plan with your IT team what goes where.

  • Scale vertically More CPU and memory where it helps, usually the database first
  • Scale horizontally Several tracking servers behind a load balancer, tracking requests buffered in a queue (Queued Tracking with Redis or Valkey)
  • Separate roles A dedicated archiving server, reports and UI separated from tracking
  • Relieve the database A replica for read queries, backups without load on the primary

Absorbing traffic peaks with Queued Tracking

Campaigns, newsletters or press coverage can bring many times the usual tracking requests within minutes. With the Queued Tracking plugin, Matomo first only accepts them and puts them into a queue instead of writing every request to the database straight away. Tracking stays fast under load, and the database works through the requests at an even pace.

  • Redis or Valkey Fast storage for the queue, separate from the Matomo database
  • Dedicated workers Systemd services work through the queue continuously, with several workers in parallel if needed, instead of tying processing to individual tracking requests
  • Monitoring Keeping an eye on the queue length so nothing piles up during a peak

As long as the workers keep up, the data reaches Matomo with hardly any delay.

Database and PHP

  • MySQL or MariaDB InnoDB buffer pool and log sizes that fit the data, indexes, queries and table sizes reviewed, old raw data and archives cleaned up
  • PHP A current version, OPcache, memory limit and run time for archiving, PHP-FPM pools sized for the load
  • Archiving Via cron, with sensible intervals and parallel processes where the hardware allows

Analysis

Beyond the technology it is about the questions behind it: where do visitors drop off, which channels bring enquiries, which content works? Together with your team I build reports and dashboards that answer these questions.

FAQ

Frequently asked questions

Scale vertically or horizontally, which is right?

Usually vertically first, meaning more memory and CPU, above all for the database, plus suitable PHP settings and archiving via cron. If that is not enough, I split tracking, archiving and reports onto separate servers and scale tracking horizontally behind a load balancer, with a queue for tracking requests where needed.

When does Matomo need more than one server?

It depends less on the number of page views than on the number of sites, segments and retention periods. Clear signs are archiving that no longer finishes within its window, reports that time out and tracking that slows down during peaks.

When is Queued Tracking worth it?

When tracking responds more slowly during traffic peaks or the database struggles with many simultaneous writes. Requests then land in Redis or Valkey first, and systemd services work through them continuously. Small instances usually do not need it.

What does a second database for read queries bring?

Matomo can send read queries through a separate database connection, for example to a replica. Long report queries and archiving then no longer slow down tracking.

Knowledge on this topic

Guides on this topic

Related

Questions about this?

In an intro call we'll clarify where you stand and whether I'm the right fit.

Your contactPeter Boehlke, Matomo consultant from Munich, 17 years in the Matomo team

Newsletter

Matomo know-how, once a month.

Practical tips on tracking, privacy settings and performance, plus notes on important Matomo updates. No spam, unsubscribe any time.