460 likes | 590 Views
Using netstat for Performance Analysis. Zack Hoffmann. Network vs. Individual System Performance. This system could contain a number of networked subsystems!. System. Completions. Arrivals. Here we have a basic system containing networked subsystems. System A. A a. C a. A b. System B.
E N D
Using netstat for Performance Analysis Zack Hoffmann
Network vs. Individual System Performance This system could contain a number of networked subsystems! System Completions Arrivals
Here we have a basic system containing networked subsystems. System A Aa Ca Ab System B 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!
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.
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.
netstat -i 1 Shows incoming and outgoing packet counts and sizes every second. What we’re looking for here are errors (errs) from either output or input. You won’t have to worry about collisions unless you’re using a hub-based network, but if you are then they can be significant.
netstat -i Can be run without time interval for a more comprehensive history (since last system boot). • Useful benchmarks for analysis using netstat –i: • (Coll+Ierrs+Oerrs)/(Ipkts+Opkts) > 2% • This could indicate problems in your network hardware. • (Coll/Opkts) > 10% • Your hub network should be segmented with additional switches. • (Ierrs/Ipkts) > 25% • Your system or network may be overloaded.
netstat -a Lists all active connections But as you can imagine, our fang machine has a ton of them, so I’ll 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.
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.
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!
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).
So What’s the Point? • When you’re 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.
System Performance using vmstat Adithya A Guruswamy
Synopsis • Analyzing Performance . • Why Analyze Performance ? • Performance Analysis Commands. • Virtual Memory. • Vmstat. • Determining CPU usage with vmstat. • Graphical Representation of vmstat. • Bibliography.
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?
Why Analyze Performance? • To eliminate bottlenecks. • To reduce the Resident Time. • To increase the Throughput. • Increase the overall efficiency of the system.
Performance Analysis Commands • vmstat : VIRTUAL MEMORY STATISTICS. • netstat : NETWORK STATISTICS. • iostat : INPUT/OUTPUT STATISTICS
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.
vmstat • vmstat (Virtual Memory STATistics) is a computer operating system monitoring tool that collects and displays summary information about memory, processes, interrupts, paging and blockI/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.
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 forkssince system startup. • -i Displays the number of interrupts taken by each device since system startup. • -sDisplay the contents of the sum structure, giving the total number of several kinds of paging related events which have occurred since system startup.
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.
DETERMINING CPU USAGE WITH VMSTAT • vmstat output
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)
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.
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.
Graphical Representation • vmstat – by day
Graphical Representation • vmstat – by day
Graphical Representation • vmstat - by week
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
THE END THANK YOU
PERFORMANCE ANALYSISusingIOSTAT Chaitali Barve
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.
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 system’s average CPU utilization since the last reboot.
Syntax for ‘iostat’ • Syntax is iostat <options> 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 - Itis 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.
Analyzing CPU Percentage of time that the CPU or CPUs were idleduring 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 idleduring which the system had outstanding request Executing at the system level (kernel).
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.
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
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.
Iostat Using Time Print the time for each report displayed
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.
Command used to get 2 reports for disk utilization in interval of 2 seconds :- iostat –d 2 2
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