日頃の学習メモ。

WEBサーバにてAPP用待ち受けポートのステータスが「CLOSE_WAIT」の状態になり、システムへのアクセス不可になる状況が発生。


# netstat -a | grep .80
otss7901_eri0.80 172.20.56.3.42622 32768 0 33580 0 CLOSE_WAIT
otss7901_eri0.80 172.20.56.2.61909 32768 0 33580 0 CLOSE_WAIT
otss7901_eri0.80 172.20.56.3.42624 32768 0 33580 0 CLOSE_WAIT

「CLOSE_WAIT」とは?

  • ハーフクローズ。
  • 通信相手側から「FIN」を受信し(先に送った方=アクティブクローズ)、相手がCloseしている状態だが自分自身は送信できる状態。
⇒本来であれば自分も相手側へ「FIN」を送り通信を完了させるが、何らかの原因でその処理を行わず「CLOSE_WAIT」の状態となっている。

tcp_keepalive_interval

  • CLOSE_WAITは tcp_keepalive_interval 秒後に(デフォルトは2時間)、接続が有効かどうかを確認する(keep-aliveプローブを送信)。
  • 到達不能な相手に対してのKeepAliveは、tcp_keepalive_intervalで設定した値では検出しない。
⇒キープアライブプローブを送信しても、応答する相手が居ないため、75秒おきに8つのプロープを送信して応答を得ようとする。そして、最初のプローブから11分15秒経過しても応答が得られない場合は、あきらめて、クローズする。
  1. 相手側がFIN_WAIT2で待っている場合は、ACKが返ってきて接続が維持される。
  2. 相手側が tcp_fin_timeout によってクローズ済みの場合、リセット(RST)が返ってきて、こちら側もクローズになる。
  3. 断線などで相手まで到達できなかった場合、 tcp_keepalive_intvl (デフォルト75)秒置きに、tcp_keepalive_probes (デフォルト10)回プローブを送信する。

keepaliveの必要性

  • ネットワーク接続の相手側が接続を維持している(接続が生きている)状態かどうか活性をチェックする。
  • 送信側では、接続の切断はデータ送信を試行するとすぐに検出されるため、この活性チェックは、データの受信を待機している接続の終端側にのみ適用されます。
  • 活性チェックを行わなければ、サーバは失われた接続に対して、まだ接続が生きていると誤解して非常に多くのリソースを使うことになります。

Sun Solaris で活性チェックの間隔を設定する方法

  • ndd ユーティリティを使用して、tcp_keepalive_interval (Ti)をミリ秒単位で設定します。次のように指定すると、値がデフォルトの2 時間に設定されます。
ndd -set /dev/tcp tcp_keepalive_interval 7200000
現在の値は次のようにして調査できます。
ndd -get /dev/tcp tcp_keepalive_interval

&color(){}

WeblogicTCP推奨値一覧

値 default値 推奨値 説明 
/dev/ip ip_ignore_redirect01ICMP リダイレクトを無視するかどうか。
/dev/tcp tcp_conn_grace_period0 msec500コネクション確立過程で SYN を送信するとき、タイマーイン間隔に追加される時間。
/dev/tcp tcp_conn_req_max_q1288096 (*)待機中の TCP コネクションの最大値。
/dev/tcp tcp_conn_req_max_q010248096 (*)TCP リスナに対して、未完了(3way-handshake が完了していない)のコネクション待ち最大数。
/dev/tcp tcp_conn_req_min11最大待機コネクション数の最小値。
/dev/tcp tcp_cwnd_max104857665534輻輳ウィンドウ(cwnd,Congestion Window)の最大値。
/dev/tcp tcp_fin_wait_2_flush_interval675000 msec16000アプリケーション終了後、エンドポイントがどのくらいで FIN_WAIT_2 状態にとどまるかを設定する値。
/dev/tcp tcp_ip_abort_cinterval180000 msec60000コネクション時(確立後)の(トータル再転送)タイムアウト時間。
/dev/tcp tcp_ip_abort_interval8 min(480000 msec)60000トータルの再送タイムアウト(RTO)の値(msec)。この値の間再送し続け、一方のエンドポイントから ACK が帰ってこない場合はコネクションをクローズ。
/dev/tcp tcp_keepalive_interval7200000 ms (2 hours)90000デフォルトの keepalive タイマ値。
/dev/tcp tcp_rexmit_interval_initial3 sec3000再送タイムアウト(RTO)の初期値(msec)。
/dev/tcp tcp_rexmit_interval_max3 sec10000再送タイムアウト(RTO)の最大値(msec)。
/dev/tcp tcp_rexmit_interval_min400 msec3000再送タイムアウト(RTO)の最小値(msec)。
/dev/tcp tcp_slow_start_initial42TCP コネクションにおける MSS での最大輻輳ウィンドウサイズの初期値。
/dev/tcp tcp_time_wait_interval4 min60000 (**)TCP コネクションが TIME_WAIT 状態にとどまる時間。
/dev/tcp tcp_xmit_hiwat1638432768バイト単位のデフォルトの送信ウィンドウサイズ。
/dev/tcp tcp_recv_hiwat2457632768バイト単位のデフォルトの受信ウィンドウサイズ。

http://homepage2.nifty.com/BASH/sol/ndd.html
# /usr/sbin/ndd /dev/tcp \?
? (read only)
tcp_time_wait_interval (read and write)
tcp_conn_req_max_q (read and write)
tcp_conn_req_max_q0 (read and write)
tcp_conn_req_min (read and write)
tcp_conn_grace_period (read and write)
tcp_cwnd_max (read and write)
tcp_debug (read and write)
tcp_smallest_nonpriv_port (read and write)
tcp_ip_abort_cinterval (read and write)
tcp_ip_abort_linterval (read and write)
tcp_ip_abort_interval (read and write)
tcp_ip_notify_cinterval (read and write)
tcp_ip_notify_interval (read and write)
tcp_ipv4_ttl (read and write)
tcp_keepalive_interval (read and write)
tcp_maxpsz_multiplier (read and write)
tcp_mss_def_ipv4 (read and write)
tcp_mss_max_ipv4 (read and write)
tcp_mss_min (read and write)
tcp_naglim_def (read and write)
tcp_rexmit_interval_initial (read and write)
tcp_rexmit_interval_max (read and write)
tcp_rexmit_interval_min (read and write)
tcp_deferred_ack_interval (read and write)
tcp_snd_lowat_fraction (read and write)
tcp_sth_rcv_hiwat (read and write)
tcp_sth_rcv_lowat (read and write)
tcp_dupack_fast_retransmit (read and write)
tcp_ignore_path_mtu (read and write)
tcp_rcv_push_wait (read and write)
tcp_smallest_anon_port (read and write)
tcp_largest_anon_port (read and write)
tcp_xmit_hiwat (read and write)
tcp_xmit_lowat (read and write)
tcp_recv_hiwat (read and write)
tcp_recv_hiwat_minmss (read and write)
tcp_fin_wait_2_flush_interval (read and write)
tcp_co_min (read and write)
tcp_max_buf (read and write)
tcp_strong_iss (read and write)
tcp_rtt_updates (read and write)
tcp_wscale_always (read and write)
tcp_tstamp_always (read and write)
tcp_tstamp_if_wscale (read and write)
tcp_rexmit_interval_extra (read and write)
tcp_deferred_acks_max (read and write)
tcp_slow_start_after_idle (read and write)
tcp_slow_start_initial (read and write)
tcp_co_timer_interval (read and write)
tcp_sack_permitted (read and write)
tcp_trace (read and write)
tcp_compression_enabled (read and write)
tcp_ipv6_hoplimit (read and write)
tcp_mss_def_ipv6 (read and write)
tcp_mss_max_ipv6 (read and write)
tcp_rev_src_routes (read and write)
tcp_ndd_get_info_interval (read and write)
tcp_rst_sent_rate_enabled (read and write)
tcp_rst_sent_rate (read and write)
tcp_use_smss_as_mss_opt (read and write)
tcp_wroff_xtra (read and write)
tcp_extra_priv_ports (read only)
tcp_extra_priv_ports_add (write only)
tcp_extra_priv_ports_del (write only)
tcp_status (read only)
tcp_bind_hash (read only)
tcp_listen_hash (read only)
tcp_conn_hash (read only)
tcp_acceptor_hash (read only)
tcp_host_param (read and write)
tcp_time_wait_stats (read only)
tcp_host_param_ipv6 (read and write)
tcp_1948_phrase (write only)
tcp_reserved_port_list (read only)
tcp_close_wait_interval(obsoleted- use tcp_time_wait_interval) (no read or write)

TCP統計情報の取得

# netstat -s -P tcp
TCP
tcpRtoAlgorithm = 4 tcpRtoMin = 400
tcpRtoMax = 60000 tcpMaxConn = -1
tcpActiveOpens =184884 tcpPassiveOpens =180292
tcpAttemptFails = 1666 tcpEstabResets = 904
tcpCurrEstab = 35 tcpOutSegs =12123178
tcpOutDataSegs =9885623 tcpOutDataBytes =3260466403
tcpRetransSegs = 9253 tcpRetransBytes =2046536
tcpOutAck =2237525 tcpOutAckDelayed =1270574
tcpOutUrg = 0 tcpOutWinUpdate = 1466
tcpOutWinProbe = 1 tcpOutControl =729858
tcpOutRsts = 760 tcpOutFastRetrans = 392
tcpInSegs =12456465
tcpInAckSegs =9497451 tcpInAckBytes =3260671114
tcpInDupAck =543250 tcpInAckUnsent = 0
tcpInInorderSegs =8856466 tcpInInorderBytes =2342992835
tcpInUnorderSegs = 393 tcpInUnorderBytes =555777
tcpInDupSegs = 116 tcpInDupBytes = 10596
tcpInPartDupSegs = 3 tcpInPartDupBytes = 1975
tcpInPastWinSegs = 4 tcpInPastWinBytes = 12008
tcpInWinProbe = 2 tcpInWinUpdate = 1

tcpInClosed = 26 tcpRttNoUpdate = 4097
tcpRttUpdate =9134664 tcpTimRetrans = 6947
tcpTimRetransDrop = 205 tcpTimKeepalive = 10348
tcpTimKeepaliveProbe= 1904 tcpTimKeepaliveDrop = 13
tcpListenDrop = 0 tcpListenDropQ0 = 0
tcpHalfOpenDrop = 0 tcpOutSackRetrans = 982

このページへのコメント

sVBRup Thank you ever so for you post.Thanks Again. Keep writing.

0
Posted by check it out 2014年01月23日(木) 08:05:02 返信

n2eX75 I really like and appreciate your blog article.Thanks Again. Much obliged.

0
Posted by awesome things! 2014年01月20日(月) 17:02:24 返信

YxAtu9 Thanks a lot for the post.Much thanks again. Want more.

0
Posted by check this out 2013年12月20日(金) 09:10:07 返信

yRxqPQ <a href="http://ctrjtgraerxg.com/">ctrjtgraerxg</a>, [url=http://klcfaeddyhum.com/]klcfaeddyhum[/url], [link=http://zqafotzfbogs.com/]zqafotzfbogs[/link], http://jtnxocjzzkil.com/

0
Posted by beooowq 2013年11月20日(水) 19:37:01 返信

68nhuf <a href="http://ofwxhrmyqnhz.com/">ofwxhrmyqnhz</a>, [url=http://cifudbicgewn.com/]cifudbicgewn[/url], [link=http://hijmxtngswix.com/]hijmxtngswix[/link], http://hfkjazuythus.com/

0
Posted by bjpgty 2013年11月15日(金) 02:47:28 返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

Menu

ここは自由に編集できるエリアです。

管理人/副管理人のみ編集できます