Tuning Piwik for performance.

Using Lighttpd or Nginx?

If not start there, our Piwik guide show how to run with Lighttpd.

APC - Duh

Everyone is recommending APC for PHP; including us. Install it now.

The configuration below gives us pretty OK performance on our Piwik system; Processing about 150K hits per week.

extension=apc.so
apc.enabled="1"
apc.shm_segments="1"
apc.shm_size="48M"
apc.mmap_file_mask="/tmp/apcphp5.XXXXXX"
apc.file_update_protection="2"
apc.enable_cli="0"
apc.max_file_size="1M"
apc.stat="0"
apc.write_lock="1"
apc.include_once_override="0"

See the notes on stat at php.net#ini.apc.stat.

Tune MySQL

This includes adjusting, at a minimum, the key_buffer and innodb_buffer_pool_size - upwards. Of course, the MySQL server should also be a dedicated role (that's just common sense).

Disable Unused Features/Plugins

If not in use, disable them

Use cron for Archving, and disable the Browser Trigger

UDPATE piwik_options SET option_value = 0 WHERE option_name = 'enableBrowserTriggerArchiving'

See Also