-
Notifications
You must be signed in to change notification settings - Fork 127
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
Clinic HeapProfiler reports drastically different heap usage than Clinic Doctor #467
Comments
Self allocated memory is different of memory usage. It counts how much memory allocation happened by the application during the profiling. Clinic doctor counts all the process resident set size.
This is a bug, possibly related to how we match files inside |
Sorry, I'm still confused. Doctor shows allocation occurring within the running application, directly caused by an incoming query. I can trigger it and twist behavior on demand. Doctor tells me memory usage is high -- which it definitely is -- and then tells me to run heapprofiler. But heapprofiler shows an entirely different statistic? The nodejs app only has a single process according to debuggers. Your saying 4+ GB of memory is being allocated in some sort of hidden process? I don't understand. I guess I'm unclear how heapprofiler can be used to help once doctor shows the problem. Is the self allocated static a total? An average for the function? If it is a total, the numbers don't seem to make sense. |
It would help if you did not consider the self-allocated memory from heap-profiler as base of memory usage of your process. That number only tells you the amount of memory allocated by your application during the profiling. If you use a doctor with a different timeframe, the numbers won't match. |
It isn't a different timeframe. I'm running the same exact test over and over. I run the application, make the query, see the same results in doctor. Restart the application, run the query, see the results in
Then why does Maybe I'm misunderstanding the difference between a "hot" function (color) and a "wide" function (width in flame graph)? |
I'll definitely look into this if I have time. |
the 1GB represents 40% of your allocations as shown in the image. The goal of heapprofiler is to tell which functions are allocating more memory during the timeframe - that's why we use flamegraphs for that.
It can be two things:
|
I apologize for my obvious ignorance here. How can you tell 40% is 1GB in Am I just looking right past something in the UI?
Ahh... now that is interesting. This application is using Apollo (GraphQL) server with Koa, and ArangoDB for graph database (arangojs driver) back end. The database driver is just a wrapper on ArangoDB's REST API, so I don't think it uses any custom C/C++ drivers. Not sure about Apollo. I suppose it could be possible a lot of the memory is being somehow allocated on the Node.js network stack, but I thought that would appear under either "Node JS" or "V8" categories. |
One other thing I forgot to mention is this application is actually running out of heap and crashing when I run this query if we don't set a custom |
Right, maybe the
If a object is created in the V8 heap, It might be allocated in those categories yes, but sometimes drivers use pure C for that. |
If that's the case, then the output would make far more sense. And that is surely a bug. |
This is a bug. Decimal point vs Decimal comma unfortunately exists in this world. |
Understood. Locale will never not be annoying. 😄 |
Expected Behavior
I would expect
clinic heapprofiler
to show resulting memory usage similar to that ofclinic doctor
since one recommends you use the other as a "next step".Current Behavior
When I repeat the same test with the two options,
doctor
shows heap usage in line with other tools and OS reporting in terms of overall memory usage.However,
heapprofiler
shows drastically different memory reporting which leads to confusion.Perhaps I am just misinterpreting
heapprofile
output, but the results are confusing when you go from one tool to the other. One says total heap reached over 6GB (which is accurate). The other says 40.31% of overall heap allocation is 1.049MB. The results don't make much sense to me.Environment
doctor
: v11.0.0heapprofiler
: v5.0.0The text was updated successfully, but these errors were encountered: