Skip to content

Instantly share code, notes, and snippets.

@hsinhoyeh
Last active August 29, 2015 14:26
Show Gist options
  • Save hsinhoyeh/9e8386acef8f2a79ed92 to your computer and use it in GitHub Desktop.
Save hsinhoyeh/9e8386acef8f2a79ed92 to your computer and use it in GitHub Desktop.
[tunning] performance tunning
===dstat
apt-get install dstat
```
dstat -h
Usage: dstat [-afv] [options..] [delay [count]]
Versatile tool for generating system resource statistics
Dstat options:
-c, --cpu enable cpu stats
-C 0,3,total include cpu0, cpu3 and total
-d, --disk enable disk stats
-D total,hda include hda and total
-g, --page enable page stats
-i, --int enable interrupt stats
-I 5,eth2 include int5 and interrupt used by eth2
-l, --load enable load stats
-m, --mem enable memory stats
-n, --net enable network stats
-N eth1,total include eth1 and total
-p, --proc enable process stats
-r, --io enable io stats (I/O requests completed)
-s, --swap enable swap stats
-S swap1,total include swap1 and total
-t, --time enable time/date output
-T, --epoch enable time counter (seconds since epoch)
-y, --sys enable system stats
--aio enable aio stats
--fs, --filesystem enable fs stats
--ipc enable ipc stats
--lock enable lock stats
--raw enable raw stats
--socket enable socket stats
--tcp enable tcp stats
--udp enable udp stats
--unix enable unix stats
--vm enable vm stats
--plugin-name enable plugins by plugin name (see manual)
--list list all available plugins
-a, --all equals -cdngy (default)
-f, --full automatically expand -C, -D, -I, -N and -S lists
-v, --vmstat equals -pmgdsc -D total
--float force float values on screen
--integer force integer values on screen
```
===iostat
```
>> iostat -x 2 5
Linux 3.16.0-0.bpo.4-amd64 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
9.22 0.00 3.35 9.28 0.00 78.14
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.01 162.50 0.02 304.47 0.70 2708.98 17.80 0.84 2.77 6.70 2.77 0.72 21.87
```
==lsof -p <pid>
```
>> lsof -p 15265
lsof: WARNING: can't stat() ext4 file system /var/lib/docker/aufs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
etcd 15265 csiuser cwd DIR 8,1 4096 1050225 xxxx
etcd 15265 csiuser rtd DIR 8,1 4096 2 /
etcd 15265 csiuser txt REG 8,1 8687648 1182520 yyyy
```
reference:
http://serverfault.com/questions/212661/determining-which-process-is-causing-heavy-disk-i-o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment