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

Feature request: Memory usage #104

Open
Floppy opened this issue Oct 31, 2024 · 5 comments
Open

Feature request: Memory usage #104

Floppy opened this issue Oct 31, 2024 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@Floppy
Copy link

Floppy commented Oct 31, 2024

Have you considered tracking memory usage over time? Having a graph of that would be amazing for debugging performance issues like memory leaks!

@igorkasyanchuk
Copy link
Owner

Good idea, perhaps me, you or someone can do it

@igorkasyanchuk igorkasyanchuk added the help wanted Extra attention is needed label Oct 31, 2024
@igorkasyanchuk
Copy link
Owner

but it can be a bit tricky if we consider multiple instances that can be running, also how to collect info when we don't have any requests (some thread/workers started?)

if someone decide to work on it I'm ready to talk and discuss possible solution.

@Floppy
Copy link
Author

Floppy commented Oct 31, 2024

Looks like https://github.com/zombocom/get_process_mem provides an easy way to get the memory usage of the current process; perhaps a minimal version of this could be to store the usage along with each request or sidekiq job. It would then need multiple lines on the graph, one for each process, I guess.

If that works, then a follow up could be to look at adding a monitoring thread for regular measurements, perhaps.

@Floppy
Copy link
Author

Floppy commented Nov 1, 2024

Actually, presumably I could work out if this is viable using custom_data_proc before forking and digging into the code proper... I'll have a go.

@Floppy
Copy link
Author

Floppy commented Nov 1, 2024

So, this code is happily grabbing the PID and memory usage on each request:

config.custom_data_proc = proc do |env|
  {
    pid: Process.pid,
    memory_usage: GetProcessMem.new.bytes
  }
end

And I can see it in the UI:

Screenshot 2024-11-01 at 16 44 01

So, now I need to work out how to add a graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants