Professional Documents
Culture Documents
Performance Tuning 1
Performance Tuning 1
Performance Tuning
and Monitoring
The first article in this series introduces a few utilities that we can use to
generate system hardware reports and plot the obtained data graphically
using gnuplot and MRTG.
____________________________________________________________________________________________________________
How To
| Admin
Collecting hardware
configuration data
There are several tools that you
can use to collect important
information about your machine
hardware. This is very important in
efficient performance tuning.
vmstat
vmstat provides information
about processes, memory, paging,
block I/O, traps, and CPU activity.
It displays either average data or
actual samples. You can enable
the sampling mode when you
additionally provide a sampling
frequency and a sampling duration
to vmstat.
The following command will
display my machines virtual
memory report after a delay of two
seconds, for four times.
# vmstat 2 4
per second)
so Amount of memory
swapped to the disk (KB per
second)
4. IO section
bi blocks sent to a block
device (blocks/s)
bo blocks received from a
block device (blocks/s)
5. System section
in number of interrupts per
second, including the clock
cs number of context
switches per second
6. CPU section
us time spent running
non-kernel code (user time,
including nice time)
sy time spent running
kernel code (system time)
id time spent idle
dmidecode
The dmidecode command reads
the system DMI table to display
hardware and BIOS information
of the system. This command will
give you information on the current
configuration of your system, as
well as the systems maximum
supported configuration. For
example, dmidecode gives both the
current RAM on the system and the
maximum RAM supported by the
system.
To get information about your
motherboard, I can use the following
command:
# dmidecode -t baseboard
Version:
CN486436AI4147
Asset Tag:
Type: Video
Status: Ebabled
Type: Sound
Status: Enabled
sar -r 1 10.
iostat
sar
The sar utility is a part of the sysstat
package, so make sure you have
it installed on your machine. The
command collects and reports
system activity information like
____________________________________________________________________________________________________________
How To
| Admin
# e2label /dev/sda2
/var
Feedback to <davej@redhat.com>.
Found 2 CPUs
x86info
x86info is a very useful tool that can be used to
display a range of information about the CPUs
present in an x86 system. The following is the
output on my system:
Feature flags:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflsh mmx fxsr sse sse2 ht sse3 cmpxchg16b
Extended feature flags:
syscall nx mmxext Fast fxsave/fxrstor rdtscp lm 3dnowext 3dnow lahf/
sahf CMP legacy svm ExtApicSpace LockMovCr0 3DNowPrefetch
The physical package has 2 cores
-------------------------------------------------------------------------WARNING: Detected SMP, but unable to access cpuid driver.
Used Uniprocessor CPU routines. Results inaccurate.
-------------------------------------------------------------------------CPU #1
Family: 15 Model: 11 Stepping: 2
CPU Model : Athlon 64 CH7-CG
Processor name string: AMD Athlon(tm) 64 X2 Dual Core Processor
5000+
Feature flags:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflsh mmx fxsr sse sse2 ht sse3 cmpxchg16b
Extended feature flags:
Feedback to <davej@redhat.com>.
Found 2 CPUs
--------------------------------------------------------------------------
L1 Data cache:
CPU #1
L1 Instruction cache:
5000+
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
--------------------------------------------------------------------------
Errors behavior:
Filesystem OS type:
Inode count:
Block count:
5000+
Continue
Linux
51200
204800
10240
Free blocks:
124082
Feature flags:
Free inodes:
51132
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
First block:
Block size:
1024
Fragment size:
3DNowPrefetch
L1 Data cache:
Filesystem created:
L1 Instruction cache:
Mount count:
53
-1
Last checked:
Check interval:
0 (user root)
0 (group root)
1024
256
8192
8192
2048
0 (<none>)
First inode:
11
Inode size:
128
--------------------------------------------------------------------------
Journal inode:
half_md4
82ccbbea-44f5-491f-b200-1370050b487f
Journal backup:
dumpe2fs
This tool displays very crucial filesystem
information like volume, name, state, block size,
etc. This information is very useful while tuning
RAID and mounting external journals. These topics
will be covered in detail in the upcoming sessions.
The following is the output of dumpe2fs /dev/sda1
which lists the details of my /dev/sda1 file system:
Filesystem volume name: <none>
Last mounted on:
<not available>
Filesystem UUID:
515d8a09-85e4-45a7-bc77-
3f7336234275
Filesystem magic number: 0xEF53
Filesystem revision #:
Filesystem features:
1 (dynamic)
has_journal ext_attr resize_inode
signed_directory_hash
user_xattr acl
clean
Journal size:
inode blocks
4113k
<<output truncated>>
gnuplot
gnuplot is a plotting tool that we can operate in one
of two modes:
1. Interactive mode: Here you issue a command
at the gnuplot prompt to adjust a graph to your
liking.
2. Batch mode: Here you can feed gnuplot the
commands from a file to make it generate
graphs in a batch.
Lets gather some data first using the sar
command. Then well use the gnuplot command
to visualise the data. Run sar -r 2 100 > ~/meminfo
& to collect the data and store it in a file named
meminfo. Remember to set alias sar=LANG=C
sar so that you have outputs in the 24-hour clock
format. Figure 6 shows the output from the ~/
meminfo file.
____________________________________________________________________________________________________________
How To
| Admin
1: /root/.snmp/snmp.conf
Host
Configuring: rocommunity
Description:
a SNMPv1/SNMPv2c read-only access
community name
Select section: 1
e|network/bits] [oid]
Select from:
community name
4: a SNMPv1/SNMPv2c read-write
2: snmptrapd.conf
3: snmp.conf
network.
Allow
Edit /etc/httpd/conf/
mrtg.conf to allow
access from our
.example.com
Step 2
Create a configuration
file to monitor network
traffic on SNMP agents:
____________________________________________________________________________________________________________
/var/www/mrtg
networknuts@server1.example.com >
/etc/mrtg/mrtg.cfg lock-file \
/etc/mrtg/mrtg.cfg
/var/lock/mrtg/mrtg_l
confcache-file /var/lib/mrtg/mrtg.ok \
done
Step 6
/var/lib/mrtg/mrtg.ok
html file:
How To
| Admin
Advt
Network Nuts