Announcement

Collapse
No announcement yet.

Knowing your System Performance and State

Collapse
X
Collapse
  •  

  • Knowing your System Performance and State

    Here are a few command line tools that will help you estimate your system usage and performance.
    There is a lot more information on this in the man pages so take a look there also. If you dont know your average system load you will not be able to determine if the load is in a peaking state or if the host is able to handle more load.
    Note that some commands might require installation of a few packages.

    Below gives a nice simple performance view of a HDU. Ofcourse running this on a fully loaded system will lower the values. Do this verification just after installation. I usually only use it if I think the system is running slow and I want to see if the disk load is too high. And yes.., this is an old laptop so dont comment on the measurements.

    # hdparm -gTt /dev/hda1
    /dev/hda1:
    geometry = 65535/16/63, sectors = 13671252, start = 63
    Timing cached reads: 518 MB in 2.04 seconds = 254.40 MB/sec
    Timing buffered disk reads: 66 MB in 3.00 seconds = 21.99 MB/sec

    Below present a report on CPU usage. But even more useful is the I/O statistics for devices and partitions.
    It is also able to display I/O for NFS but I dont have any mounted in this example.

    # iostat
    Linux 2.6.26-2-686 (testbox) 02/17/2010 _i686_

    avg-cpu: %user %nice %system %iowait %steal %idle
    30.61 0.00 3.57 4.62 0.00 61.20

    Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    hda 6.99 156.13 81.45 3618343 1887544
    hda1 5.73 81.70 69.33 1893342 1606784
    hda2 0.00 0.00 0.00 6 0
    hda5 0.06 1.63 3.88 37765 89960
    hda6 1.19 72.80 8.23 1687014 190800
    hdc 2.30 533.78 0.00 12370344 0

    Below will display a usefull compact overall report of the system state. This clearly indicate an overloaded host.
    Some information is trivial. You can see that in many ways. Pick whatever you like best.

    # vmstat
    procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
    r b swpd free buff cache si so bi bo in cs us sy id wa
    1 0 12128 215028 520 114336 1 2 346 40 369 1476 31 4 61 5

    The description of each field from the man page is as following:
    Procs
    r: The number of processes waiting for run time.
    b: The number of processes in uninterruptible sleep.
    Memory
    swpd: the amount of virtual memory used.
    free: the amount of idle memory.
    buff: the amount of memory used as buffers.
    cache: the amount of memory used as cache.
    inact: the amount of inactive memory. (-a option)
    active: the amount of active memory. (-a option)
    Swap
    si: Amount of memory swapped in from disk (/s).
    so: Amount of memory swapped to disk (/s).
    IO
    bi: Blocks received from a block device (blocks/s).
    bo: Blocks sent to a block device (blocks/s).
    System
    in: The number of interrupts per second, including the clock.
    cs: The number of context switches per second.
    CPU
    These are percentages of total CPU time.
    us: Time spent running non-kernel code. (user time, including nice time)
    sy: Time spent running kernel code. (system time)
    id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
    wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
    st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.


    Below is generating a rapport of CPU related information. Load for both applications and kernel, idle time etc.
    This is very handy on a host with more CPUs installed. Unfortunately below is from a host with one CPU having only one core. Ill try to redo this later.

    # mpstat
    Linux 2.6.26-2-686 (testbox) 02/17/2010 _i686_

    02:58:27 AM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
    02:58:27 AM all 30.58 0.00 3.04 4.62 0.46 0.07 0.00 61.23 368.12


    Below will display used and free memory. Though this rapport do not tell the whole truth. Some of the memory stated as used might not be. It might be reserved for buffers etc. The amount of free memory will always be rounded down.

    # free -ml
    total used free shared buffers cached
    Mem: 472 354 117 0 10 240
    Low: 472 354 117
    High: 0 0 0
    -/+ buffers/cache: 103 368
    Swap: 1349 7 1341


    Below will display a summery of disk space usage. You can find information on your mounts in the /etc/mtab file.
    You might modify this file yourself from time to time or when mounting a device. If you insert a CD into your cd drive and your system is set to auto mount, below rapport will include this as a ISO9660 type aswell.

    # df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/hda1 6.5G 4.7G 1.5G 76% /
    tmpfs 237M 0 237M 0% /lib/init/rw
    udev 10M 752K 9.3M 8% /dev
    tmpfs 237M 0 237M 0% /dev/shm
    /dev/hda6 29G 19G 9.1G 68% /home

    Another way of verifying the usage of a HDU, partition or directory tree is to use below command.
    I cut off much of the output because it will display a lot. You might want to filter or sort the output using grep or the like.
    Check out the man page for this one aswell. Using this command is a handy way of finding large files if you are running low on diskspace. below is often used in shell scripts.

    # du -ch
    ...
    176M ./.cache/google-chrome
    176M ./.cache
    8.0K ./.putty/sessions
    12K ./.putty
    1.4M ./Downloads
    8.0K ./.icons
    12K ./.licq/history
    164K ./.licq/users
    4.0K ./.licq/qt-gui
    224K ./.licq
    4.0K ./GNUstep/Library
    8.0K ./GNUstep
    4.0K ./.opensync-0.22/engines
    8.0K ./.opensync-0.22
    36K ./Vocabularies
    396K ./.gstreamer-0.10
    699M .
    699M total
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    Latest Articles

    Collapse

    • Testing your Mail Server
      by Resheph
      Telnet to your smtp server using the following:
      "telnet example.com 25". The number "25" is the default portnumber for outging mail, defined by IANA.
      Substitute the address with your own address or ip number.
      Even though this might very well be possible to do on your ISP mail server, dont!!
      This will give you the SMTP server banner. I hope this has been changed or spoofed to protect from banner grabbing.
      In my example, it gives me "220 example.com...
      08-06-2016, 10:38 PM
    • Knowing your System Performance and State
      by Resheph
      Here are a few command line tools that will help you estimate your system usage and performance.
      There is a lot more information on this in the man pages so take a look there also. If you dont know your average system load you will not be able to determine if the load is in a peaking state or if the host is able to handle more load.
      Note that some commands might require installation of a few packages.

      Below gives a nice simple performance view of a HDU. Ofcourse running...
      08-06-2016, 10:35 PM
    • Browsing your Hardware in Linux
      by Resheph
      Sometimes it can be quite a challenge to find out what hardware you have but it is actually quite easy.
      Here are a few commands and some sample output for you.

      USB devices are usually easy to identify because you can just pick them up and look at them.
      Below will help you out with the few that just say NoName on it. Often those noname ones are the same as the named ones just with another wrapping. Below display a list of detected USB devices.

      # lsusb
      Bus...
      08-06-2016, 10:34 PM
    • Keeping an Eye on Logfiles
      by Resheph
      If you want to watch a log file and have it update when ever new content is added the "tail" command is an easy on-the-fly tool to use.
      Ofcourse for long term use other implementations of log file analyzers or syslog services would be better.
      Here is a short example and some sample output showing a failed root login attempt.

      # tail -n 20 -f -s 5 /var/log/auth.log
      Feb 17 04:11:09 testbox login[4822]: pam_unix(login:auth): authentication failure; logname=LOGIN...
      08-06-2016, 10:31 PM
    • Learn which Libraries Programs Call
      by Resheph
      Sometimes it comes in handy to know what libraries and what versions of those libraries some software is depending on.
      This is quite easy and is done with the "ldd" command.

      Here are the dependencies that the "ls" command has. Remark that you have to use the absolute path as ldd does not support the use of the search path stated in the environment variable PATH.

      # ldd /bin/ls
      linux-gate.so.1 => (0xb7fd4000)
      librt.so.1 => /lib/i686/cmov/librt.so.1...
      08-06-2016, 10:29 PM
    Working...
    X