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

Trace memory usage with logging #2708

Conversation

majamassarini
Copy link
Member

@majamassarini majamassarini commented Feb 7, 2025

Sadly py-spy was only a time profiler and I wasn't able to find something that does not need changes in the code.

I followed mainly this guide and this celery issue suggestions.

Deep profiling will be done just in stg, quicker resource check also in prod.

@majamassarini majamassarini requested a review from a team as a code owner February 7, 2025 11:22
Copy link
Contributor

files/install-deps-worker.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

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

otherwise looks good!

def log_memory_stats(self) -> None:
gc.collect()
memory_usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
logger.error(f"Memory usage: {memory_usage} (kb)")
Copy link
Member

Choose a reason for hiding this comment

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

do we need this as error level? It will end up in Sentry iirc

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I forgot to change it...

@majamassarini majamassarini force-pushed the trace-memory-usage-in-stage branch 2 times, most recently from 93cc3a4 to 57f514f Compare February 7, 2025 12:38
Copy link
Contributor

@majamassarini majamassarini force-pushed the trace-memory-usage-in-stage branch from 57f514f to 7b2593d Compare February 7, 2025 12:50
Copy link
Contributor

@majamassarini majamassarini force-pushed the trace-memory-usage-in-stage branch from 7b2593d to 9509218 Compare February 7, 2025 13:35
Copy link
Contributor

@majamassarini
Copy link
Member Author

recheck

@majamassarini majamassarini force-pushed the trace-memory-usage-in-stage branch from 9509218 to b61b539 Compare February 7, 2025 14:35
@majamassarini
Copy link
Member Author

recheck

@majamassarini majamassarini added the mergeit When set, zuul wil gate and merge the PR. label Feb 7, 2025
Copy link
Contributor

Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/4cf1e986826d401ebbbc777c44288a5b

✔️ pre-commit SUCCESS in 1m 49s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 48862af into packit:main Feb 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants