Server load calculation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alvaro G Vicario

    Server load calculation

    I've seen some sites that display a "Server load" value in percentage. I've
    tried to google out the formula they may be using but I couln't find it.
    I'd like to implement such a thing in a Linux server but the typical values
    returned by "uptime" (number of queued processes) are not as easy to
    understand as a simple %.

    Any idea? Thank you in advance,


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Thank you for not e-mailing me your questions
    --
  • NC

    #2
    Re: Server load calculation

    Alvaro G Vicario wrote:[color=blue]
    >
    > I've seen some sites that display a "Server load" value in[/color]
    percentage.[color=blue]
    > I've tried to google out the formula they may be using but I couln't
    > find it. I'd like to implement such a thing in a Linux server but
    > the typical values returned by "uptime" (number of queued processes)
    > are not as easy to understand as a simple %.[/color]

    How about this:

    $load_info = `top -l 1`;

    Now $load_info contains the output of the 'top' command, which
    lists CPU and memory usage...

    Cheers,
    NC

    Comment

    • Alvaro G Vicario

      #3
      Re: Server load calculation

      *** NC wrote/escribió (24 Feb 2005 09:24:37 -0800):[color=blue]
      > $load_info = `top -l 1`;
      >
      > Now $load_info contains the output of the 'top' command, which
      > lists CPU and memory usage...[/color]

      Not in my version (Red Hat 9). In any case, I don't really want mere CPU
      usage but a sort of average of all resources that gives and idea of how
      busy the system is. 100% CPU doesn't mean the server is collapsed.


      --
      -- Álvaro G. Vicario - Burgos, Spain
      -- Thank you for not e-mailing me your questions
      --

      Comment

      • Daniel Tryba

        #4
        Re: Server load calculation

        Alvaro G Vicario <alvaro_QUITAR_ REMOVE@telecomp uteronline.com> wrote:[color=blue][color=green]
        >> $load_info = `top -l 1`;
        >>
        >> Now $load_info contains the output of the 'top' command, which
        >> lists CPU and memory usage...[/color]
        >
        > Not in my version (Red Hat 9). In any case, I don't really want mere CPU
        > usage but a sort of average of all resources that gives and idea of how
        > busy the system is. 100% CPU doesn't mean the server is collapsed.[/color]

        IOW tops output?

        Comment

        • Alvaro G Vicario

          #5
          Re: Server load calculation

          *** Daniel Tryba wrote/escribió (24 Feb 2005 17:43:34 GMT):[color=blue][color=green]
          >> Not in my version (Red Hat 9). In any case, I don't really want mere CPU
          >> usage but a sort of average of all resources that gives and idea of how
          >> busy the system is. 100% CPU doesn't mean the server is collapsed.[/color]
          >
          > IOW tops output?[/color]

          This is top's output:

          6:45pm up 2:32, 1 user, load average: 0,00, 0,00, 0,00
          64 processes: 63 sleeping, 1 running, 0 zombie, 0 stopped
          CPU states: 0,1% user, 0,3% system, 0,0% nice, 99,4% idle
          Mem: 61676K av, 59836K used, 1840K free, 0K shrd, 5560K
          buff
          Swap: 196520K av, 10552K used, 185968K free 21068K
          cached


          I'm looking for something like:

          0.12%


          I don't know the English word, in Spanish we say "numeros indice" (index
          numbers?). Like those that summarize the health of stock exchange in one
          figure ;-)


          --
          -- Álvaro G. Vicario - Burgos, Spain
          -- Thank you for not e-mailing me your questions
          --

          Comment

          • NC

            #6
            Re: Server load calculation

            Alvaro G Vicario wrote:[color=blue]
            >
            > This is top's output:
            >
            > 6:45pm up 2:32, 1 user, load average: 0,00, 0,00, 0,00
            > 64 processes: 63 sleeping, 1 running, 0 zombie, 0 stopped
            > CPU states: 0,1% user, 0,3% system, 0,0% nice, 99,4% idle
            > Mem: 61676K av, 59836K used, 1840K free, 0K shrd, 5560K[/color]
            buff[color=blue]
            > Swap: 196520K av, 10552K used, 185968K free 21068K[/color]
            cached[color=blue]
            >
            > I'm looking for something like:
            > 0.12%[/color]

            OK, who says you can't make it up? The output above shows that
            the server's CPU load is currently 0.6% (100% - 99.4%), memory
            load is 97.0% (59836 / 61676), and swap space occupation is 5.4%
            (10552 / 196520). If you believe all three resources are
            equlally important for your application, you can compute a
            simple average of the three:

            $load = ($memory_load + $CPU_load + $swap_load) / 3;

            If you think some resources are more important than others, you
            can weigh them accordingly. Say, you think memory is twice as
            important as CPU availability and four times as important as swap
            space. So you can compute a weighted average:

            $load = (4 * $memory_load + 2 * $CPU_load + $swap_load) / (4 + 2 + 1);

            [color=blue]
            > I don't know the English word, in Spanish we say "numeros indice"
            > (index numbers?). Like those that summarize the health of stock
            > exchange in one figure ;-)[/color]

            Same thing, an index. And, just like a stock index, yours can
            be either equally weighted (first example) or capitalization-
            weighted (second example)... :)

            Cheers,
            NC

            Comment

            • Colin McKinnon

              #7
              Re: Server load calculation

              NC wrote:
              [color=blue]
              > Alvaro G Vicario wrote:[color=green]
              >>
              >> I've seen some sites that display a "Server load" value in[/color]
              > percentage.[color=green]
              >> I've tried to google out the formula they may be using but I couln't
              >> find it. I'd like to implement such a thing in a Linux server but
              >> the typical values returned by "uptime" (number of queued processes)
              >> are not as easy to understand as a simple %.[/color]
              >
              > How about this:
              >
              > $load_info = `top -l 1`;
              >
              > Now $load_info contains the output of the 'top' command, which
              > lists CPU and memory usage...
              >[/color]

              Yes, but:

              1) 'top' generates quite a lot of load itself - try `cat /proc/loadavg`
              2) load can't be claculated as a % (CPU utilization, disk & network
              bandwidth can) but is still a better measure of availability
              3) If you've got your webserver properly configured then a useful measure
              might be the # of httpd processes/threads - which should have an upper
              limit set, and therefore % is calculable.

              HTH

              C.

              Comment

              • Alvaro G Vicario

                #8
                Re: Server load calculation

                *** Colin McKinnon wrote/escribió (Fri, 25 Feb 2005 10:07:40 +0000):[color=blue]
                > 3) If you've got your webserver properly configured then a useful measure
                > might be the # of httpd processes/threads - which should have an upper
                > limit set, and therefore % is calculable.[/color]

                That's an excelent idea. It'll try to design my own index number based in a
                weighed average using, among other, the % of httpd processes. Thank you
                everyone.


                --
                -- Álvaro G. Vicario - Burgos, Spain
                -- Thank you for not e-mailing me your questions
                --

                Comment

                Working...