From 77a1ad0feecbc822e70ec870c88e4f448cf4f158 Mon Sep 17 00:00:00 2001 From: Altamash Shaikh Date: Wed, 25 Jun 2025 17:06:15 +0530 Subject: [PATCH 1/3] Removed Piwik reference, #PG-4266 --- CHANGELOG.md | 7 +++++-- docs/faq.md | 16 ++++++++-------- plugin.json | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 028370d..89781ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ ## Changelog -5.1.1 - 2021-10-23 +5.1.2 - 2025-10-23 +- Textual changes + +5.1.1 - 2024-10-23 - Fixed fatal error when running queuedtracking:monitor command on Windows -5.1.0 - 2021-10-21 +5.1.0 - 2024-10-21 - Increased number of queue tracking workers to 4096 - Enhance queue monitor and process commands - Added Redis cluster option diff --git a/docs/faq.md b/docs/faq.md index d8f2c1b..cae107e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -12,24 +12,24 @@ for Matomo anyway. __Where can I configure and enable the queue?__ -In your Piwik instance go to "Administration => General Settings". There is a config section for this plugin. +In your Matomo instance go to "Administration => General Settings". There is a config section for this plugin. __When will a queued tracking request be processed?__ First you should know that multiple tracking requests will be inserted into the database at once using -[bulk tracking](http://developer.piwik.org/api-reference/tracking-api#bulk-tracking) as soon as a configurable number +[bulk tracking](http://developer.matomo.org/api-reference/tracking-api#bulk-tracking) as soon as a configurable number of requests is queued. By default we will check whether enough requests are queued during a regular tracking request and start processing them right after sending a response to the browser to make sure a user won't have to wait until the queue has finished to process all requests. Have a look at this graph to see how it works: -![How it works](https://raw.githubusercontent.com/piwik/plugin-QueuedTracking/master/docs/How_it_works.png) +![How it works](https://raw.githubusercontent.com/matomo-org/plugin-QueuedTracking/master/docs/How_it_works.png) __I do not want to process queued requests within a tracking request, what shall I do?__ Don't worry, if this solution doesn't work out for you for some reason you can disable it and process all queued -requests using the [Piwik console](http://developer.piwik.org/guides/piwik-on-the-command-line). Just follow these steps: +requests using the [Matomo console](http://developer.matomo.org/guides/piwik-on-the-command-line). Just follow these steps: -* Disable the setting "Process during tracking request" in the Piwik UI under "Settings => Plugin Settings" +* Disable the setting "Process during tracking request" in the Matomo UI under "Settings => Plugin Settings" * Setup a cronjob that executes the command `./console queuedtracking:process` for instance every minute * That's it * Or, if you have __"non WINDOWS OS"__ you can use the [Supervisor](http://supervisord.org/) as a cron alternative. @@ -42,7 +42,7 @@ queued requests at a time. Example crontab entry that starts the processor every minute: -`* * * * * cd /piwik && ./console queuedtracking:process >/dev/null 2>&1` +`* * * * * cd /matomo && ./console queuedtracking:process >/dev/null 2>&1` Example Supervisor entry that will start 16 processors/workers with 10 loop cycle times and auto restart: @@ -72,7 +72,7 @@ Yes, you can. Just execute the command `./console queuedtracking:monitor`. This __Can I improve the speed of inserting requests from the Redis queue to the database?__ -Yes, you can by adding more workers. By default only one worker is activated at a time and only one worker processes tracking requests from Redis to the database. When inserting tracking requests into the database, at time of writing this, about 80% of the time is spent in PHP and the database might be rather bored. If you have multiple CPUs available on your server you can add more workers. You can do this by going in the Piwik Admin interface to "Plugin Settings". There will be a setting "Number of queue workers". Increase this number to the number of CPUs you want to dedeciate for processing requests. Best practice is to add more workers step by step. So first increase this number to 2 and check if the tracking request insertions is fast enough for you. If not and you have more CPUs available, increase the number again. +Yes, you can by adding more workers. By default only one worker is activated at a time and only one worker processes tracking requests from Redis to the database. When inserting tracking requests into the database, at time of writing this, about 80% of the time is spent in PHP and the database might be rather bored. If you have multiple CPUs available on your server you can add more workers. You can do this by going in the Matomo Admin interface to "Plugin Settings". There will be a setting "Number of queue workers". Increase this number to the number of CPUs you want to dedeciate for processing requests. Best practice is to add more workers step by step. So first increase this number to 2 and check if the tracking request insertions is fast enough for you. If not and you have more CPUs available, increase the number again. When using multiple workers it might be worth to lower the number of "Number of requests to process" to eg 15 in "Plugin Settings". By default 25 requests are inserted in one step by using transactions. This means different workers might have to wait for each other. By lowering that number each worker will block the DB for less time. @@ -92,7 +92,7 @@ We currently write into the Redis default database by default but you can config You can also use a "Redis Cluster" to distribute all tracking requests data across multiple Redis masters/shards, complete with the HA feature. -__Why do some tests fail on my local Piwik instance?__ +__Why do some tests fail on my local Matomo instance?__ Make sure the requirements mentioned above are met and Redis needs to run on 127.0.0.1:6379 with no password for the integration tests to work. It will use the database "15" and the tests may flush all data it contains. Make sure diff --git a/plugin.json b/plugin.json index 3b3717b..569f699 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "QueuedTracking", - "version": "5.1.1", + "version": "5.1.2", "description": "Scale your large traffic Matomo service by queuing tracking requests in Redis or MySQL for better performance and reliability when experiencing peaks.", "theme": false, "keywords": ["tracker", "tracking", "queue", "redis"], From 1a465d99499d5a9b3fb49109dafc1b1104c49edb Mon Sep 17 00:00:00 2001 From: Altamash Shaikh Date: Wed, 25 Jun 2025 17:10:48 +0530 Subject: [PATCH 2/3] Fixes PHPCS error --- Queue/Backend/Redis.php | 9 +++++++-- Queue/Backend/RedisCluster.php | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Queue/Backend/Redis.php b/Queue/Backend/Redis.php index f2f4cf2..e9d6f9c 100644 --- a/Queue/Backend/Redis.php +++ b/Queue/Backend/Redis.php @@ -274,8 +274,13 @@ protected function connect() return $success; } - public function setConfig($host, $port, $timeout, $password) - { + public function setConfig( + $host, + $port, + $timeout, + #[\SensitiveParameter] + $password + ) { $this->disconnect(); $this->host = $host; diff --git a/Queue/Backend/RedisCluster.php b/Queue/Backend/RedisCluster.php index 848d8ab..a9a4d0e 100644 --- a/Queue/Backend/RedisCluster.php +++ b/Queue/Backend/RedisCluster.php @@ -315,8 +315,13 @@ protected function connect() } } - public function setConfig($host, $port, $timeout, $password) - { + public function setConfig( + $host, + $port, + $timeout, + #[\SensitiveParameter] + $password + ) { $this->disconnect(); $this->host = $host; From 2fc7e58286d4b7809d140f9a7e1b001723b31286 Mon Sep 17 00:00:00 2001 From: Altamash Shaikh Date: Thu, 26 Jun 2025 17:07:54 +0530 Subject: [PATCH 3/3] Fixed copy/paste error --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89781ba..6d5da0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Changelog -5.1.2 - 2025-10-23 +5.1.2 - 2025-07-07 - Textual changes 5.1.1 - 2024-10-23