Using netstat for Performance Analysis - PowerPoint PPT Presentation

1 / 44
About This Presentation
Title:

Using netstat for Performance Analysis

Description:

In individual systems we track the progress of jobs, from their arrival to their ... b: The number of processes in uninterruptible sleep. Memory ... – PowerPoint PPT presentation

Number of Views:204
Avg rating:3.0/5.0
Slides: 45
Provided by: bib103
Category:

less

Transcript and Presenter's Notes

Title: Using netstat for Performance Analysis


1
Using netstat for Performance Analysis
  • Zack Hoffmann

2
Network vs. Individual System Performance
This system could contain a number of networked
subsystems!
System
Completions
Arrivals
3
Here we have a basic system containing networked
subsystems.
System A
Aa
Ca
System B
Ab
Cb
Cn
An
Ac
Cc
System C
A switching or broadcasting device
Now, in addition to worrying about individual
system performance, we have to worry about
network performance!
4
Tracking Network Traffic
  • In individual systems we track the progress of
    jobs, from their arrival to their completion, to
    determine performance.
  • In a network we can not do this. Entire jobs are
    not moved in and out of systems on a network.
  • Instead, packets of information pass through
    those systems. We can monitor these packets to
    analyze performance.

5
Introducing netstat
6
About netstat
  • Netstat has options for viewing your network data
    in many different formats.
  • Some used to measure throughput.
  • Others used to diagnose network problems.
  • Many may require a deeper level of network
    hardware knowledge than is applicable to this
    course.

7
netstat -i 1
Shows incoming and outgoing packet counts and
sizes every second.
What were looking for here are errors (errs)
from either output or input.
You wont have to worry about collisions unless
youre using a hub-based network, but if you are
then they can be significant.
8
netstat -i
Can be run without time interval for a more
comprehensive history (since last system boot).
  • Useful benchmarks for analysis using netstat i
  • (CollIerrsOerrs)/(IpktsOpkts) gt 2
  • This could indicate problems in your network
    hardware.
  • (Coll/Opkts) gt 10
  • Your hub network should be segmented with
    additional switches.
  • (Ierrs/Ipkts) gt 25
  • Your system or network may be overloaded.

9
netstat -a
Lists all active connections
But as you can imagine, our fang machine has a
ton of them, so Ill specify pTCP to limit it to
TCP connections.
This indicates that the receiving system can not
get these packets fast enough. This is a problem
with the network (either yours or theirs) and NOT
your system. (However, sending queues with sizes
this small are typical.)
Keep an eye here, too. If a connection gets hung
up in a waiting state, it may be a sign of
problems in your protocol handling.
Large, ongoing spikes here would indicate
a bottleneck on your system, as this queue is for
packets to be used by a job on this machine.
10
Deeper Analysis
  • netstat -s
  • Historical statistics, by protocol.
  • Diagnose protocol handling/routing issues.
  • spray
  • Separate tool, sends bursts of meaningless
    packets.
  • Great for determining levels of congestion.
  • Send absurd amount of packets, see how many get
    dropped.
  • Same technique can be used between two networked
    machines to determine if an issue is the product
    of congestion or due to a slow receiving machine.

11
Measuring Individual Throughput with netstat
  • You could use netstat -i 1, pick an interval of
    time, and see how much data gets pushed out in
    that interval.
  • However, packet input and output are not in a
    1-to-1 correspondence like job acceptance and
    completion.
  • If a remote system is uploading a large file to
    your system, your packets in will be vastly
    greater than your packets out!

12
Using Goodput Instead
  • Goodput is simply throughput which takes in to
    account protocol overhead and retransmitted
    packets.
  • It measures only bits useful on the application
    level.
  • If you know how much data from each packet is NOT
    overhead, this is calculated the same as
    throughput by simply multiplying by the
    percentage of non-overhead bits afterwards.
  • Must also remember to exclude retransmitted
    packets (netstat -s provides this information).

13
So Whats the Point?
  • When youre trying to estimate performance on a
    network level, you have to consider factors
    OUTSIDE of your system.
  • netstat can tell you whether or not your poor
    performance is caused by network elements, and
    can give you some indication of how much it may
    be slowing you down.

14
System Performance using vmstat
  • Adithya A Guruswamy

15
Synopsis
  • Analyzing Performance .
  • Why Analyze Performance ?
  • Performance Analysis Commands.
  • Virtual Memory.
  • Vmstat.
  • Determining CPU usage with vmstat.
  • Graphical Representation of vmstat.
  • Bibliography.

16
Analyzing Performance
  • Performance Analysis is the Process of analyzing
    performance bottlenecks in the system.
  • It Involves a number of steps
  • Identify the problem.
  • Is the problem CPU oriented or I/O related ?
  • CPU Problem - What is the Load Average ?
  • I/O problem is it paging or normal disk I/O?

17
Why Analyze Performance?
  • To eliminate bottlenecks.
  • To reduce the Resident Time.
  • To increase the Throughput.
  • Increase the overall efficiency of the system.

18
Performance Analysis Commands
  • vmstat VIRTUAL MEMORY STATISTICS.
  • netstat NETWORK STATISTICS.
  • iostat INPUT/OUTPUT STATISTICS

19
Virtual Memory
  • Memory, often as simulated on a hard disk, that
    emulates RAM, allowing an application to operate
    as though the computer has more memory than it
    actually does.

20
Computer Hierarchy
                                                                                                                        

21
vmstat
  • vmstat (Virtual Memory STATistics) is a computer
    operating system monitoring tool that collects
    and displays summary information about memory,
    processes, interrupts, paging and block I/O
    information.
  • Also vmstat command reports statistics about
    kernel threads, virtual memory, disks, traps and
    CPU activity.
  • Reports generated by the vmstat command can be
    used to balance system load activity.

22
vmstat
  • Syntax
  • vmstat -a -n delay count vmstat -f
    -s -m vmstat -S unit vmstat -d vmstat -p
    disk partition vmstat -V
  • -f Reports the number of forks since system
    startup.
  • -i Displays the number of interrupts taken by
    each device since system startup.
  • -s Display the contents of the sum structure,
    giving the total number of several kinds of
    paging related events which have occurred since
    system startup.

23
vmstat
  • -a switch displays active/inactive memory .
  • -m displays slab info.
  • -n switch causes the header to be displayed only
    once rather than periodically.
  • -d reports disk statistics .
  • -p followed by some partition name for detailed
    statistics.
  • -V switch results in displaying version
    information.

24
DETERMINING CPU USAGE WITH VMSTAT
  • vmstat output

25
Description
  • 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)

26
Description
  • 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.
  • cs The number of context switches per second.

27
Description
  • CPU
  • These are percentages of total CPU time.
  • us Time spent running non-kernel code.
  • sy Time spent running kernel code.
  • id Time spent idle.
  • wa Time spent waiting for io.
  • st Time stolen from a virtual machine.

28
Graphical Representation
  • vmstat by day

29
Graphical Representation
  • vmstat by day

30
Graphical Representation
  • vmstat - by week

31
Bibliography
  • References obtained from
  • http//en.wikipedia.org/wiki/Main_Page
  • http//www.redhat.com
  • http//www.freebsd.org
  • http//www.linuxcommand.org/man_pages/vmstat8.html
  • http//www.linuxjournal.com

32
THE END
  • THANK YOU

33
PERFORMANCE ANALYSISusingIOSTAT
  • Chaitali Barve

34
What is Performance Analysis?
  • Whenever CPU is occupied by a process, it is
    unavailable for processing other requests. This
    becomes a bottleneck in the system.
  • To troubleshoot CPU performance finding CPU
    utilization is one of the important tasks.

35
iostat
  • iostat reports CPU statistics and Input/Output
    statistics for devices and partitions.
  • The reports generated can be used to change
    system configuration to better balance the
    input/output load between physical disks.
  • It can be used to find systems average CPU
    utilization since the last reboot.

36
Syntax for iostat
  • Syntax is iostat ltoptionsgt interval count
  • options - Lets you specify the device for which
    information is needed like disk , cpu or
    terminal. (-d , -c , -t  or -tdc ). x options
    gives the extended statistics.
  • Interval - It is time period in seconds between
    two samples. iostat 4 will give data at each 4
    seconds interval.
  • count  - It is the number of times the data is
    needed. iostat 4 5   will give data at 4
    seconds interval 5 times.

37
Analyzing CPU
Percentage of time that the CPU or CPUs were
idle during which the system did not have
outstanding request
Percentage of CPU utilization
Executing at the user level with nice priority.
Percentage of time that the CPU or CPUs were
idle during which the system had outstanding
request
Executing at the system level (kernel).
38
Report
  • The report generated by the iostat command is
    the CPU Utilization Report.
  • The report consists of a tty and CPU header row
    followed by a row of tty and CPU statistics.
  • Also, the I/O wait state is defined system-wide
    and not per processor.

39
Analyzing Disk
number of transfers per second
total number of blocks written
amount of data read from the drive
amount of data written to the drive
total number of blocks read
40
Report
  • The second report generated by the iostat is
    the Disk Utilization Report.
  • The device report provides statistics on a
    per physical device or partition basis.

41
Iostat Using Time
Print the time for each report displayed
42
Report
  • The first report contains statistics for the time
    since system start up (boot).
  • Each subsequent report contains statistics
    collected during the interval since the previous
    report.

43
  • Command used to get 2 reports for disk
    utilization in interval of 2 seconds -
  • iostat d 2 2

44
Putting it Together
  • iostat is basically used for CPU statistics
    input/output statistics for devices and
    partitions.
  • iostat command can be specifically used to get
    reports either for CPU or for Input/Output.
  • The time at which a certain was generated can
    also be captured.
  • Thus, iostat helps us to find out which process
    is using how much CPU or Input/Output.
  • Likewise system configuration steps can be
    ammended to make necessary changes for CPU and
    Input/Output usage
Write a Comment
User Comments (0)
About PowerShow.com