New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add information about the memory consumption #11816
Conversation
of the archive cronjob. This can be helpfull when you approach the memory limit.
The build is failing for reason that are unrelated to this PR. |
core/CronArchive.php
Outdated
@@ -413,6 +414,7 @@ public function run() | |||
Piwik::postEvent('CronArchive.archiveSingleSite.start', array($idSite)); | |||
|
|||
$completed = $this->archiveSingleSite($idSite, $requestsBefore); | |||
$this->logger->info("Mermory usage: " . $this->getHumanReadableBytesSize(memory_get_usage())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo should be Memory
core/CronArchive.php
Outdated
@@ -460,6 +462,12 @@ public function run() | |||
); | |||
|
|||
$this->logger->info($timer->__toString()); | |||
$this->logger->info("Mermory peak usage: " . $this->getHumanReadableBytesSize(memory_get_peak_usage())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo should be Memory
core/CronArchive.php
Outdated
$this->logger->info("Mermory peak usage: " . $this->getHumanReadableBytesSize(memory_get_peak_usage())); | ||
} | ||
|
||
private function getHumanReadableBytesSize($memoryInBytes, $precision = 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please format the code consistently with our code / PSR notation, ie add line breaks and spacing
Hi @mikeSimonson
In both cases the memory of the archiving script will not raise much as the actual memory hungry processes are in separate threads. Therefore I would say this PR is not needed. Could you clarify whether it was helpful for you at some point, and why? |
This is a little bit crazy but apparently the only way I can answer your questions on my PR are via this commit message. Apparently the owner of the piwik repo restricted comment to only prior contributor. You would think that this would allow you to comment your own PR but apparently not. So abouts yours questions: In my case the archiving tasks is run by a cron job via ```./console core:archive```, because of that it's quite convenient to see in the output if it's the memory constraints that made the cronjob fail. For the conformance to the code format I hope that this commit fix it. Don't hesitate to point me other formatting issue if there are others. Thanks
@mikeSimonson Please see my last comment for questions. For now closing the PR but happy to re-open if it's actually useful 👍 |
@mattab Sorry I thought I had already replied. That commands is also directly called by cronjobs ( from the docs ). |
@mikeSimonson would you mind sending here an example of the archive log output which shows the memory increase/decrease or another interesting use case? Thanks |
|
of the archive cronjob.
This can be helpfull when you approach the memory limit.