Many medium-high traffic websites successfully use Piwik to track and analyse their website behavior and performance. See this FAQ for general information about high traffic Piwik.
If you want to provide high reliability and better performance in your Piwik setup, you can load balance Piwik services on various servers. It is pretty easy to do so, but make sure you read the following documentation.
Piwik stores all tracking data, reports, users, settings, etc. in the shared mysql database. Piwik also needs to read/create files to store information, caches, temporary files:
- config/config.ini.php is used by every request to Piwik. It contains db access, plugins enabled, various settings, etc. The file is only modified when the Super User changes some settings in the Admin interface (activating plugins, changing smtp settings, etc.). This file must be synchronized on every Piwik server.
- tmp/* contains temporary and cached files such as: compiled templates, generated PDFs, tracking caches, etc. This directory tmp/ content can be safely deleted and Piwik will automatically recompile templates and recreate caches.
- by default, Piwik uses file session storage, which are usually stored in tmp/sessions, or in the global sessions directory (see php.ini). There is a config setting to enable database session storage, see this faq
When Piwik is used behind a load balancer, here are the steps to follow:
- synchronize config/config.ini.php on all servers – make sure the file config/config.ini.php is the same on all servers (using rsync for example).
- setup a cron to delete the tracker cache every 5 minutes on all servers: rm piwik/tmp/cache/tracker/*
- enable database session storage
- we highly recommend to enable SSL in Piwik
Piwik should then work as expected in a load balanced environment. For example, a common way to load balance Piwik on 3 servers: Load balancer in front of (2x) webservers which are tracking/querying the (1x) Master mysql DB server. For further optimization, a (1x) UI webserver can be added, to handle all API requests, UI requests, and run the cron archiving. This server can also be doubled and load balanced.
Typically, webserver boxes would be cheap to operate (trackers, frontends and archivers), and the Master DB server would be larger (eg. multiple cores, 16G memory, fast disk access), which could scale to a certain point (1M+ pages per day). Contact Piwik & Scalability Experts if you need professional assistance.
Learn more: How to configure Piwik for speed.