diff options
author | Peter Zhang <peter@innocraft.com> | 2022-11-10 05:46:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 05:46:31 +0300 |
commit | 2fa6bc60650d4e28232f76f3e236e5f8406b0be8 (patch) | |
tree | 7f65412b8704dc3d9e42839cee4a5b156b3cc6b6 | |
parent | b4db64d2b80a4be32eb8e71798e37dd89d2931a0 (diff) |
Set default limit for concurrent archivers (#19959)
* update default to 3 and -1 to unlimited
update default to 3 and -1 to unlimited
* update default
update default
* update tests
update tests
* update max default to 3
update max default to 3
* update tests
update tests
* update concurrent-archivers in change log
update concurrent-archivers in change log
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | core/CronArchive.php | 7 | ||||
-rw-r--r-- | plugins/CoreConsole/Commands/CoreArchiver.php | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4536abff72..d431a1fad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* ### Archiving * When posting the event `Archiving.getIdSitesToMarkArchivesAsInvalidated` started passing date, period ,segment and name parameter along with idSites parameter. +### Updated commands +* The default maximum number of archivers processes to run concurrently has changed from unlimited to three. The `--concurrent-archivers` parameter can be used to increase this limit. A value of -1 will use an unlimited number of concurrent archivers + ## Matomo 4.12.0 ### Breaking Changes diff --git a/core/CronArchive.php b/core/CronArchive.php index 4deeccfeeb..19f1c4e367 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -154,7 +154,7 @@ class CronArchive public $concurrentRequestsPerWebsite = false; /** - * The number of concurrent archivers to run at once max. + * The number of concurrent archivers to run at once max. Default 3 * * @var int|false */ @@ -1366,6 +1366,11 @@ class CronArchive private function hasReachedMaxConcurrentArchivers() { $cliMulti = $this->makeCliMulti(); + + if ($this->maxConcurrentArchivers == "-1") { + return false; + } + if ($this->maxConcurrentArchivers && $cliMulti->supportsAsync()) { $numRunning = 0; $processes = Process::getListOfRunningProcesses(); diff --git a/plugins/CoreConsole/Commands/CoreArchiver.php b/plugins/CoreConsole/Commands/CoreArchiver.php index 25cef83c8f..2f580ed818 100644 --- a/plugins/CoreConsole/Commands/CoreArchiver.php +++ b/plugins/CoreConsole/Commands/CoreArchiver.php @@ -112,7 +112,7 @@ class CoreArchiver extends ConsoleCommand $command->addOption('concurrent-requests-per-website', null, InputOption::VALUE_OPTIONAL, "When processing a website and its segments, number of requests to process in parallel", CronArchive::MAX_CONCURRENT_API_REQUESTS); $command->addOption('concurrent-archivers', null, InputOption::VALUE_OPTIONAL, - "The number of max archivers to run in parallel. Depending on how you start the archiver as a cronjob, you may need to double the amount of archivers allowed if the same process appears twice in the `ps ex` output.", false); + "The number of max archivers to run in parallel. Depending on how you start the archiver as a cronjob, you may need to double the amount of archivers allowed if the same process appears twice in the `ps ex` output.", 3); $command->addOption('max-websites-to-process', null, InputOption::VALUE_REQUIRED, "Maximum number of websites to process during a single execution of the archiver. Can be used to limit the process lifetime e.g. to avoid increasing memory usage."); $command->addOption('max-archives-to-process', null, InputOption::VALUE_REQUIRED, |