[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
- [20200224]windows命令學習筆記.txtWindows筆記
- [20200224]vim小技巧刪除製表符2.txt
- 觀察者模式-將訊息通知給觀察者模式
- 觀察者模式模式
- 記一次觀察者模式的使用模式
- 觀察者Observer模型事件,使用注意情況Server模型事件
- Robotiq 單指觀察
- PHP觀察者模式PHP模式
- 觀察者模式(2)模式
- Unity——觀察者模式Unity模式
- 使用函式式實現觀察者模式模式函式模式
- OC觀察者模式之KVO的使用與思考模式
- keep-alive元件使用Keep-Alive元件
- [20190805]Oracle 12c New Feature – Online Partitioning.txtOracle
- Laravel 的觀察者使用記錄與兩種方式Laravel
- 小白觀察:開源永存
- observer-觀察者模式Server模式
- 重構 - 觀察者模式模式
- 18_觀察者模式模式
- PHP-觀察者模式PHP模式
- 大話--觀察者模式模式
- PHP 之觀察者模式PHP模式
- redux與觀察者模式Redux模式
- 觀察者模式介紹模式
- Omdia觀察:伺服器的使用年限不斷延長伺服器
- 設計模式學習-使用go實現觀察者模式設計模式Go
- 進擊的觀察者模式模式
- 設計模式 —— 觀察者模式設計模式
- 設計模式(觀察者模式)設計模式
- 設計模式----觀察者模式設計模式
- Spring中的觀察者模式Spring模式
- 實驗 21:觀察者模式模式
- 【設計模式】觀察者模式設計模式
- 行為型:觀察者模式模式
- 2023年趨勢觀察:CPaaS
- 設計模式——觀察者模式設計模式
- TCP 的 Keepalive 和 HTTP 的 Keep-Alive 是一個東西嗎?TCPHTTPKeep-Alive