Skip to content
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

perf: Log requests using high amount of memory as warning #48738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Oct 16, 2024

Should help us finding candidates to optimize more easily.

Signed-off-by: Julius Knorr <jus@bitgrid.net>
@juliushaertl juliushaertl requested review from nickvergessen, a team, icewind1991, skjnldsv and yemkareems and removed request for a team October 16, 2024 16:12
@juliushaertl juliushaertl added this to the Nextcloud 31 milestone Oct 16, 2024
register_shutdown_function(function () {
$memoryPeak = memory_get_peak_usage();
if ($memoryPeak > 300_000_000) {
$message = 'Request used more than 300 MB of ram: ' . Util::humanFileSize($memoryPeak);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$message = 'Request used more than 300 MB of ram: ' . Util::humanFileSize($memoryPeak);
$message = 'Request used more than 300 MB of RAM: ' . Util::humanFileSize($memoryPeak);

if ($memoryPeak > 300_000_000) {
$message = 'Request used more than 300 MB of ram: ' . Util::humanFileSize($memoryPeak);
$logger = \OCP\Server::get(LoggerInterface::class);
$logger->warning($message, ['app' => 'core']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants