[20200224]觀察使用TCP keep-alive feature特性.txt
[20200224]觀察使用TCP keep-alive feature特性.txt
--//前幾天測試,提到觀察使用TCP keep-alive feature特性,可以執行netsta -npo | grep <程式號>確定,這是一種簡單快捷的方式。
--//實際上可以ss -nop觀察可以獲得一樣的效果.
1.環境:
--//服務端設定:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
# echo /proc/sys/net/ipv4/tcp_keepalive* | xargs -n 1 strings -1 -f
/proc/sys/net/ipv4/tcp_keepalive_intvl: 75
/proc/sys/net/ipv4/tcp_keepalive_probes: 9
/proc/sys/net/ipv4/tcp_keepalive_time: 7200
$ grep SQLNET.EXPIRE_TIME $ORACLE_HOME/network/admin/sqlnet.ora
#SQLNET.EXPIRE_TIME = 1
2.測試:
# netstat -ntop 2>/dev/null
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name Timer
tcp 0 0 192.168.100.78:59597 192.168.100.78:1521 ESTABLISHED 52283/ora_pmon_book off (0.00/0/0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp 0 0 192.168.100.78:22 192.168.98.6:58436 ESTABLISHED 52769/sshd keepalive (3359.89/0/0)
tcp 0 0 192.168.100.78:22 192.168.98.6:51182 ESTABLISHED 51346/sshd keepalive (2884.83/0/0)
tcp 0 0 192.168.100.78:33066 192.168.xx.xxx:1521 ESTABLISHED 53413/sqlplus off (0.00/0/0)
tcp 0 0 192.168.100.78:1521 192.168.100.78:59597 ESTABLISHED 52834/tnslsnr keepalive (3507.32/0/0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--//sqlplus 程式沒有使用 ENABLE=BROKEN連線,可以發現它的keepalive timer狀態是off.
--//有點奇怪的是ora_pmon_book程式也是off,我已經重啟監聽的情況下再啟動資料庫的情況下也是一樣.
--//自己還有一個疑問,如果不起監聽程式,ora_pmon_book看到是什麼情況呢?
--//注意看下劃線內容,ora_pmon_book程式與tnslsnr程式的網路連線是配對的.留在以後測試.
--//實際上還可以使用ss -ntop命令。
# ss -ntop| expand
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 192.168.100.78:59597 192.168.100.78:1521 users:(("oracle",52283,10))
ESTAB 0 0 192.168.100.78:22 192.168.98.6:58436 timer:(keepalive,54min,0) users:(("sshd",52769,3))
ESTAB 0 0 192.168.100.78:22 192.168.98.6:51182 timer:(keepalive,47min,0) users:(("sshd",51346,3))
ESTAB 0 0 192.168.100.78:33066 192.168.xx.xxx:1521 users:(("sqlplus",53413,7))
ESTAB 0 0 192.168.100.78:1521 192.168.100.78:59597 timer:(keepalive,57min,0) users:(("tnslsnr",52834,12))
--//ss -ntop顯示如果時間很大,顯示的單位是min.後面users還記錄的很多資訊,第1個引數是程式名,第2個引數是程式號,第3個引數是
--//socket對應的檔案控制程式碼.
--//修改如下:
# echo /proc/sys/net/ipv4/tcp_keepalive* | xargs -n 1 strings -1 -f
/proc/sys/net/ipv4/tcp_keepalive_intvl: 10
/proc/sys/net/ipv4/tcp_keepalive_probes: 4
/proc/sys/net/ipv4/tcp_keepalive_time: 33
SCOTT@78> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
--- ------- --------- --------- ----- --- ---------- -------------------------------------------
1 99 4328:3512 DEDICATED 53495 24 33 alter system kill session '1,99' immediate;
# seq 40 | xargs -IQ bash -c "ss -ntop | expand | grep 53495;sleep 1"
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,614ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,9.569ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,8.508ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,7.449ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,6.388ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,5.329ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,4.268ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,3.209ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,2.149ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,1.090ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,028ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,21sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,20sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,19sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,18sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,17sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,16sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,15sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,14sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,13sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,12sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,11sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,10sec,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,9.249ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,8.188ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,7.129ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,6.068ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,5.009ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,3.948ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,2.887ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,1.828ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,767ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,9.724ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,8.664ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,7.604ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,6.543ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,5.484ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,4.425ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,3.362ms,0) users:(("oracle",53495,13))
ESTAB 0 0 192.168.100.78:1521 192.168.98.6:61642 timer:(keepalive,2.302ms,0) users:(("oracle",53495,13))
--//看到的與netstat看到一樣,你可以發現keepalive分成2部分,1部分10秒,1部分23秒?.
--//使用netstat看到的情況如下.
# seq 40 | xargs -IQ bash -c "netstat -nop | grep 53495;sleep 1"
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (1.72/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (0.69/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (9.68/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (8.66/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (7.63/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (6.61/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (5.58/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (4.56/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (3.53/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (2.51/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (1.48/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (0.46/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (22.44/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (21.42/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (20.39/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (19.37/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (18.34/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (17.32/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (16.29/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (15.27/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (14.24/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (13.22/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (12.20/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (11.17/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (10.15/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (9.12/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (8.10/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (7.07/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (6.05/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (5.03/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (4.00/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (2.98/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (1.95/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (0.93/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (9.92/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (8.89/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (7.87/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (6.84/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (5.82/0/0)
tcp 0 0 192.168.100.78:1521 192.168.98.6:61642 ESTABLISHED 53495/oraclebook keepalive (4.80/0/0)
--//windows下有什麼工具或者命令列觀察keealive timer呢?那位知道...
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2677064/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20200225]觀察使用TCP keep-alive feature特性2.txtTCPKeep-Alive
- http keep-alive與tcp keep-aliveHTTPKeep-AliveTCP
- 版本新特性(new feature)
- 關於 Http 協議中的 keep-alive 與 Tcp keep-aliveHTTP協議Keep-AliveTCP
- [20200224]windows命令學習筆記.txtWindows筆記
- oracle11g flashback archive feature新特性OracleHive
- keep-alive元件使用Keep-Alive元件
- TCP 的 Keepalive 和 HTTP 的 Keep-Alive 是一個東西嗎?TCPHTTPKeep-Alive
- vue的keep-alive中使用EventBusVueKeep-Alive
- WAS V7.0 Feature Pack for Java Persistence API 2.0 新特性介紹JavaAPI
- 從一起丟包故障來談談 nginx 中的 tcp keep-aliveNginxTCPKeep-Alive
- allure功能使用-feature&story
- 聊聊keep-alive元件的使用及其實現原理Keep-Alive元件
- Vue中keep-alive的深入理解和使用VueKeep-Alive
- vue中動態化的按需使用keep-aliveVueKeep-Alive
- vue中keep-alive保持使用過的狀態VueKeep-Alive
- vue <keep-alive>VueKeep-Alive
- vue keep-aliveVueKeep-Alive
- [20170504]Linux TCP keepalive timers.txtLinuxTCP
- ??TCP協議:超時重傳、流量控制、keep-alive和埠號,你真的瞭解嗎?TCP協議Keep-Alive
- [20130817]Oracle 12c new feature In-Database Archiving.txtOracleDatabase
- TCP Wrapper 特殊使用TCPAPP
- c#使用Modbus TCPC#TCP
- zt_楊老師yangtingkun_11g new feature新特性系列文章
- 在移動端使用vue-router和keep-aliveVueKeep-Alive
- java new featureJava
- [20190805]Oracle 12c New Feature – Online Partitioning.txtOracle
- 使用tcpdump觀察DNS通訊過程TCPDNS
- tcp和udp使用總結TCPUDP
- Kubernetes叢集部署Node Feature Discovery元件用於檢測叢集節點特性元件
- 使用wireshark分析TCP/IP協議中TCP包頭的格式TCP協議
- 7.89 FEATURE_DETAILSAI
- Feature homophily metric
- node http keep-alive demoHTTPKeep-Alive
- 【SQL Performance Analyzer】Oracle 11g SQL Performance Analyzer feature使用SQLORMOracle
- 觀察者Observer模型事件,使用注意情況Server模型事件
- 記一次觀察者模式的使用模式
- 使用觀察者模式處理異常資訊模式