Wrong used memory in SLES12

Hi.
I have wrong used memory in my SLES12SP4 server.
Jul  3 13:37:01 2019 version 6.01-0:|::::mem:::1056788356:1033513692:23274664:-1:31266936:1002246756:
in_use_work is 31G, but HTOP show


I find info (https://stackoverflow.com/questions/41224738/how-to-calculate-system-memory-usage-from-proc-meminfo-like-htop) and want correct algorithm memory calculate. I do this, but not see result.

Please, ask in wich strings in /opt/lpar2rrd-agent/lpar2rrd-agent.pl i can make changes?
I make changes in section ###Linux memory###, but cant see result, as ignored it.

[root@stor2rrd new]# cat lpar2rrd-agent.pl | grep -A 10 "#A#"
  #A#
  my $sreclaim        = 0;
--
      #A# add $sreclaim section
      if ( $line =~ m/^SReclaimable/ ) {
        ( undef, $sreclaim ) = split( / +/, $line );
      }
      if ( $line =~ m/^Cached:/ ) {
        #A#
        ##( undef, $in_use_clnt ) = split( / +/, $line );
        ##$in_use_clnt = $in_use_clnt + $buffers;
        ### Buffers must be added to Cached
        ( undef, $in_use_clnt ) = split( / +/, $line );
        $in_use_clnt = $in_use_clnt + $sreclaim - $shared;
      }
--
      #A#
      ##$inuse       = $size - $free - $in_use_clnt;
      ##$in_use_work = $inuse;                         # used mem without the FS cache - FS cache is not here!
      ##$inuse       = $inuse + $in_use_clnt;
      $inuse       = $size - $free;
      $in_use_work = $inuse - $in_use_clnt;          # FS cache is here


P.S. you use $buffers (in $in_use_clnt) before define his value. In this secton (###Linux memory###).

Comments

  • Please, one a moment. I see, you scan output /proc/meminfo string by sting.
    I need time to make algorinthm with this specific.
  • OK, i make this changes and see result as HTOP (maked changes above section ###Linux memory###):

    testdb:/opt/lpar2rrd-agent # cat lpar2rrd-agent.pl | grep -A 10 "#A#"

      #A# add 2 vars
      my $pcached         = 0;
      my $sreclaim        = 0;

    --
          #A# add if{}
          if ( $line =~ m/^SReclaimable:/ ) {
            ( undef, $sreclaim ) = split( / +/, $line );
          }
          if ( $line =~ m/^Cached:/ ) {
            #A#
            ##( undef, $in_use_clnt ) = split( / +/, $line );
            ##$in_use_clnt = $in_use_clnt + $buffers;
            ### Buffers must be added to Cached
            ( undef, $pcached ) = split( / +/, $line );
          }

    --
          #A#
          ##$inuse       = $size - $free - $in_use_clnt;
          ##$in_use_work = $inuse;                         # used mem without the FS cache - FS cache is not here!
          ##$inuse       = $inuse + $in_use_clnt;
          $inuse       = $size - $free;
          $in_use_clnt = $pcached + $sreclaim - $shared;
          $in_use_work = $inuse - $in_use_clnt;          # buffers is here

  • Why i need do this? In my server 1TiB RAM and many Oracle instances, and his can't use only 31GiB memory <span>:smile:</span> 
    I compare output
    # cat /proc/meminfo; free
    and read article (link at top). 

    Can you make changes in Agent Lapr2RRD in future verions?
  • P.S. 
    Need correct code:

          if ( $line =~ m/^Shmem/ ) {
            ( undef, $shared ) = split( / +/, $line ); 

    TO

          if ( $line =~ m/^Shmem:/ ) {
            ( undef, $shared ) = split( / +/, $line ); 

    Because in /proc/meminfo has:
    Shmem
    ShmemHugePages
    ShmemPmdMapped

    Our need only "Shmem:"

  • Hi,

    your right, fixed, do you want to get a rpm with that fix?

    Thanks!
  • Hi, Pavel
    Yes, if it posible, i want RPM with fix.
    For easy update, i have many Linux servers.
    Thanks!
  • Pavel, not for a long time of you, see this articles:
    http://calimeroteknik.free.fr/blag/?article20/really-used-memory-on-gnu-linux
    http://http//nopipi.hatenablog.com/entry/2015/09/13/181026 (translate to you lang)

    Unfortunately, NMON have small of data about memory, and i need modify to $in_use_work value "active". (In my case Oracle RDBMS used Shmem)
  • I do not understand
  • edited July 7
    Hi, Pavel.
    This topic i made when see, what LPAR Agent incorrect display used memory on my server.
    On my server used Oracle RDBMS without HugePages, is used SharedMemory.
    But current algorithm LPAR Agent do not use Shmem in calculation. Why? I search some articles, and find, what any programm calc used memory by any methods.
    More simply it in pictures in articles, what i write links above.

    For Linux, around string "###Linux memory###" LPAR Agent calc:
    UsedMemory = MemTotal - MemFree - Cached - Buffers.

    In articles you can see calc:
    UsedMemory = MemTotal - MemFree - Cached - Buffers - SReclaimable + Shmem.

    Can you analise this, and if it`s good, make changes in LPAR Agent script?

  • edited July 7
    P.S. about NMon part script of LPAR Agent.

    If my application on the server (SLES12) use SharedMemory, NMon too incorect display used memory. And NMon have very small parameters to right calculate UsedMemory.

    In my case, i need use Active parameter, as UsedMemory:

    ( undef, undef, $size, undef, undef, undef, $free, undef, undef, undef, undef, $in_use_clnt, $nactive ) = split( /,/, $mem ); 
    ...
    $inuse = $size - $free;
    $in_use_work = $nactive * 1024;
    $in_use_clnt = $inuse - $in_use_work; 

    How make right calculating UsedMemory by NMon data (if used Shared Memory), i dont know now.
Sign In or Register to comment.