close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_repos.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Jan 6, 2017, 11:16:06 AM (8 years ago)
- Author:
-
jazz
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v55
|
v56
|
|
380 | 380 | }}} |
381 | 381 | |
| 382 | * 有時候不見得有安裝 net-tools 套件,沒有 netstat 指令,有沒有辦法透過 procfs 去排查是否有太多 TIME_WAIT 呢? |
| 383 | * 若單純看 TIME_WAIT 的話,可以觀察 /proc/slabinfo |
| 384 | {{{ |
| 385 | cat /proc/slabinfo | grep tw_sock |
| 386 | }}} |
| 387 | * 另一個方式是觀察 /proc/net/tcp 與 /proc/net/tcp6 的 st 欄位 |
| 388 | {{{ |
| 389 | $ cat /proc/net/tcp | awk '{ print $4 }' | sort | uniq -c |
| 390 | 3 01 |
| 391 | 14 06 |
| 392 | 5 0A |
| 393 | 1 st |
| 394 | }}} |
| 395 | * 對應的數值可於 [http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/net/tcp_states.h tcp_states.h] 查到 |
| 396 | {{{ |
| 397 | TCPF_ESTABLISHED = (1 << 1), |
| 398 | TCPF_SYN_SENT = (1 << 2), |
| 399 | TCPF_SYN_RECV = (1 << 3), |
| 400 | TCPF_FIN_WAIT1 = (1 << 4), |
| 401 | TCPF_FIN_WAIT2 = (1 << 5), |
| 402 | TCPF_TIME_WAIT = (1 << 6), |
| 403 | TCPF_CLOSE = (1 << 7), |
| 404 | TCPF_CLOSE_WAIT = (1 << 8), |
| 405 | TCPF_LAST_ACK = (1 << 9), |
| 406 | TCPF_LISTEN = (1 << 10), |
| 407 | TCPF_CLOSING = (1 << 11), |
| 408 | TCPF_NEW_SYN_RECV = (1 << 12), |
| 409 | }}} |
| 410 | |
382 | 411 | == Power Management == |
383 | 412 | |