Code Monkey home page Code Monkey logo

Comments (9)

mumustafa avatar mumustafa commented on June 1, 2024 1

Adding to Saar's point, the calculation is correct but expected in Linux if we don't include the available memory, customers will not benefit from this trigger with this current state unless this trigger measures against the host node and not the container. If the Host level is not feasible, below are the results of my testing and proposed calculation:

From the container:

image
As you can see, the free memory is 81/1790 of Total memory, so the number is 95%. we can see that the container is idle because:
1- High amount of allocated memory for buff/cache (expected)
2- Swap memory is not being used, more details in the below image, there is no high si/so operations:
image

In my testing if we can make the calculation 1 - (Free + Available)/Total, it will be close to the actual host memory usage:

image

from applicationinsights-profiler-aspnetcore.

xiaomi7732 avatar xiaomi7732 commented on June 1, 2024 1

@mumustafa, thanks for chiming in. I am considering a simpler calculation of:
1 - available / total

Here are my reasons:

  1. According to the spec:

              MemAvailable %lu (since Linux 3.14)
                     An estimate of how much memory is available for
                     starting new applications, without swapping.
    

    And that's what the user actually cares about - how much memory is available.

  2. It's more accurate, and I believe available already has free considered in it.

    • In a system that is heavily buffered, using your example, there's not too much difference:
      1 - (free + available) / total = 1 - (81 + 532) / 1790 = 66%, compare to:
      1 - available / total = 1 - 532 / 1790 = 70%

    • However, in a system that is not heavily buffered, like this one on a WSL:
      image
      1 - (free + available) / total = 1 - (11906 + 14246) / 15930 = -64% <---- this negative number doesn't make sense. And compare to:
      1 - available / total = 1 - 14246 / 15930 = 11%

The big difference I see, is that available + free might exceed total while available is always less than the total.

Any inputs?

from applicationinsights-profiler-aspnetcore.

mumustafa avatar mumustafa commented on June 1, 2024 1

@xiaomi7732 You're 100% on point, I was looking at it from the free command perspective as well: https://man7.org/linux/man-pages/man1/free.1.html
image
Looking at the commit description: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 also confirms your findings.

from applicationinsights-profiler-aspnetcore.

xiaomi7732 avatar xiaomi7732 commented on June 1, 2024 1

Stable package released:
https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.5.3

from applicationinsights-profiler-aspnetcore.

xiaomi7732 avatar xiaomi7732 commented on June 1, 2024

And here's the proof of it:
image

from applicationinsights-profiler-aspnetcore.

xiaomi7732 avatar xiaomi7732 commented on June 1, 2024

Check this out:
https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.5.3-beta1

As we discussed, memory usage on linux will be computed by 1 - ( available / total ).

from applicationinsights-profiler-aspnetcore.

mumustafa avatar mumustafa commented on June 1, 2024

from applicationinsights-profiler-aspnetcore.

mumustafa avatar mumustafa commented on June 1, 2024

Thank you Saar! this is looking great!
image

image

from applicationinsights-profiler-aspnetcore.

xiaomi7732 avatar xiaomi7732 commented on June 1, 2024

Thank you for bringing this up!

from applicationinsights-profiler-aspnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.