| 设置Keepalive参数检测中断的客户连接 |
| [ 作者:佚名 转贴自:网络转载 阅读次数:72 更新时间:2007-8-2 14:19:00 录入:刘光勇 ] 热 |
|
|
|
Setting Keepalive to Detect Client Disconnects H . p$W 8D;Z4K@r> SUMMARY: This TechNote describes how to display and alter the keepalive intervals on core platforms. '.-0G84|Q Document ID: 611 Last Revised: 04/19/99 U/DG;Q= Topic: Troubleshooting Document Type: TechNote cK@;|PKiK Product: SQL Server, Adaptive Server Enterprise Version: Not Version Specific < UhNg#S Platform: HP, PC, NCR, Sun, IBM RS/6000, Digital UNIX, Silicon Graphics, DEC OpenVMS Alpha Operating System: AIX, IRIX, UNIX, HP-UX, Solaris, Windows NT, OpenVMS Alpha AiyK!)BU {%=-hr!81 Document: : ?3C Background: TCP/IP keepalive Settings qVf'`e0= p(d-Q6Xn The TCP/IP driver uses operating system keepalive parameters to detect when a client process disconnects. Each parameter comes with a default setting; many parameters are configurable. In general, the parameters: Ro"h r5 %`uMq~9 Determine how long to wait before probing the connection. On most platforms the default is 2 hours. \RY>=8(ydD Determine how long to wait before retrying the probe. 7+ N^p$p= Determine how many times to probe the connection. '{ELO+5vn In some cases, you may wish to decrease the keepalive parameters on the server-side machine to improve detection if the client disconnects. As a result, Adaptive Server stops processing the client query and begins any necessary clean-up before killing the corresponding spid (server process ID). Y=w1V"maS6 <T`,_|~f`O The following section, "Setting keepalive Values" describes how to display and modify the keepalive interval on the operating system server side. hWC*Vu #XK uQnzu Note:Some Sun patches (including 101945-41) cause Adaptive Server to receive a disconnect signal from the client. See TechNote 2530 , "Sun Patch Causes SQL Server Disconnects" for more information and the solution. Additionally, some Sun patches may cause Open Server connections to hang. See TechNote 20133, "Sun TCP/IP Patch Can Cause Open Server to Hang." wbInZ/`m) n Z::]tA For information on server-side disconnects, see TechNote 948 How Adaptive Server Enterprise Rolls Back Transactions When a Client Crashes, as well as the Open Client release bulletin and configuration guides for your platform. L=ff}rd y;|o@ys' Setting keepalive Values ]2*Es@' lqw$>QP You can prevent client-side disconnects by changing the default TCP/IP parameters. tC+6=z2vCK qWq*%.g* Resetting any parameter affects your entire machine and always involves trade-offs. You may wish to reset additional TCP/IP parameters, depending on the overall impact to other TCP/IP parameters. Contact your operating system administrator for help with these values. ,l*k}&3f [ l%L{yLSLW; Table 1: keepalive Parameters by Operating System Operating System YKurK1<e Parameter wait time before probing the connection \0iEGY Parameter interval between probes o0$ oN#COf Parameter maximum time or tries to probe connection before dropping a{OXW$4 Unit of measure /_,GA#]y |yfH[=2 HP-UX 10.10, 10.20 XmQ'W{l]; tcp_keepstart _+2'? tcp_keepfreq jTz/G2=OW tcp_keepstop 628 seconds @<I`?8( zM T[^2 HP-UX 11.0 C b/8w tcp_time_wait_interval 19K|1^yt3 tcp_keepalive_interval ;Q:tE\ tcp_keepalives_kill JFme !B milliseconds n;?}j uDGOCHl AIX 3,2.5, 4.1.4, 4.2 7h7F!H tcp_keepidle ,^;<c/vn tcp_keepintvl *>7`s0gR n/a Yg&#$J, half-seconds LyPqr^[8 ;=p}~p8 Digital Alpha NT 4.0 Z3p@v96sM KeepAliveTime q31:)Y KeepAliveInterval o9X , TcpMaxDataRetransmission Y#o3AQ+ milliseconds bxn@>)^( su_H\904C Digital UNIX 4.0a <_?hhq tcp_keepidle w\M('7 tcp_keepintvl sBnx"8I_ tcp_maxidle* !QCDN:<K+ ticks (half-seconds) YEc& D%0 LY$-p!X NCR MP-RAS 3.0.1.01 and 3.02 Z ;y%p TCP_KEEPIDLE Wo!Nn_ TCP_KEEPINTVL PC|.in TCP_NKEEP 9D P~ka`W seconds OyX2D/u $b/ SGI IRIX 6.2, 6.4, 6.5 iga8Sv]L tcp_keepidle 9w7`} $= tcp_keepintvl iw}`C :6) n/a tnn'lZI half-seconds Se'>z#U ,U63- Solaris 2.5.1, 2.6 Cz8@$tD n/a WLthI# tcp_keepalive_interval /ZF<= n/a 9~?v:j milliseconds | K?j )bf4 jfx6f42@7 Windows NT 4.0 > dE^<1 p KeepAliveTime !5 +\/@ Y KeepAliveInterval Q`}Y-N1Z TcpMaxDataRetransmission Pt4' f?^` milliseconds -+BxXB Z; L$,g}V { >fk^^t JJ The tcp_maxidle parameter is not actually configurable on Digital UNIX. It is calculated automatically based on a constant (TCPTV_KEEPCNT) multiplied by tcp_keepintvl. If you increase the tcp_keepintvl value, the tcp_maxidle value automatically increases. +=9a%&Ji /(hGHY|e9 Note:You cannot alter the Digital OpenVMS default system-wide setting. However, you can change the values for certain inet services, or change application inet values through calls to "setsocket". fTJgt y(`.$Kt The following section describes how to reset keepalive values for specified platform releases. &h+Q"\v#} KllMxO Procedure: Resetting keepalive Values 7Q*Dd$@q KGKVHyW.V Follow these steps to reset the values. 23 h ?QqR -h ?lq Resetting keepalive (by operating system) [0mY[gr Ye#mf 1.Log in as root. 6|O/?w:o h^Z2Q(QX 2.Run help on the network tuning parameter to determine change order. |F6o Fa1 Platform ^Y!D')K >/ Operating System Command Sf!l(u1 W\D;&$X HP-UX 10.10 J=vGdG\ nettune -h 7`M/4sv 02h#+`LX HP-UX 10.20 ^B#V8:2e /usr/contrib/bin/nettune -h ||5eM3& SwltLY [h HP-UX 11.0 |m\YNA (b ndd -h c}? #{Ij >YJr6a i AIX 3.2.5, 4.1.4, 4.2 @|JV no -a 4M*y92 <ig##| Digital Alpha NT 4.0 gQ({_LO You must have the NT Resource Kit installed. From the Start menu, choose Run and enter "Regentry.hlp" and choose "network services" and choose "TCP/IP Transport Entries". giuM2K@yOo 33*=gwW!F Digital UNIX 4.0a ~"xYz D dxkerneltuner | <2=g7 # M-.-2I{P Choose inet and click the Select Subsystem button. A panel displays current values, range of values, and any new settings. R$=Xv"0# u%5vx%qwB NCR MP-RAS 3.0.1.01 and 3.02 !eb+- t( See the MP-RAS product documentation. gn" ?X[ =oI?HF~X SGI IRIX 6.2, 6.4 BZdt@oo See the IRIX Administration: System Configuration and Operation guide. f,'q~N2 B =MBx~d7* SGI IRIX 6.5 ^a Y FYO systune -i ye ]S7 [ 'uZQrq*NF _f=y-e2GY JYN\7Di+72 Updates will be made to running system and /unix.install i<%O9 A BP0"[ Gx3Ec @ _z=tIHYF systune-> net_tcp help <br KT dY! Sun Solaris 2.5.1, 2.6 uqiLkITs5 ndd /dev/tcp \? H<(rtE@X- l^ *\wbt^ Windows NT 4.0 (VzS$7My7 You must have the NT Resource Kit installed. From the Start menu, choose Run and enter "Regentry.hlp" and choose "network services" and choose "TCP/IP Transport Entries". kMhuP|AJ tRnB.V%d Pgy o Note:Digital UNIX's dxkerneltuner is a graphical X windows application. If you normally use telnet or rlogin to connect to systems and don't normally run X applications from remote machines, you may have trouble starting dxkerneltuner. Also, because you'll be running the X-client (dxkerneltuner) as root, you may need to modify your X security settings for your local X server to modified to allow it to connect using the xhost utility. J G( Y AyDo_28 3.Display current settings. jcn4p8 OJF'jE+ Platform C`'C (,=\ Operating System Command 11E $Ld?1z !Ki`ef+ f HP-UX 10.10 ~v?}Z' nettune <tcp_parameter> IUr~XC^~pi X!aX% oHbx HP-UX 10.20 c/],|-~Du /usr/contrib/bin/nettune <tcp_parameter> 4|3>2=+ :Kgl~%!f HP-UX 11.0 |NLPT&` ndd -get /dev/tcp <tcp_parameter> pg\ zVFU 9<YR%Fb AIX 3.25. 4.1.4, 4.2 79~y}s/R no -o<tcp_parameter> sgb1[fM= Y)[msy~S5R Digital Alpha NT 4.0 v=8J_d From the Start menu, choose Run and enter Regedt32 to view the parameter located in the Registry file HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters ra}=E{"9 TT1"[7! Digital UNIX 4.0a @ Re>#p+e dxkerneltuner Hx.Dtgn Mw1=6r 97 Choose inet and click the Select Subsystem button. A panel displays current values, range of values, and any new settings. W&hf"?(i N5!Y L. NCR MP-RAS 3.0.1.01 and 3.02 @gW[1N inconfig <tcp_parameter '[S, d 5mDUZ: To display settings for all parameters, enter P PG<vX5 (^g5.NH6 inconfig -s ~1=1Ga-`' 6+>sJt(Ga SGI IRIX 6.2, 6.4 ZJ[#.R2M View or edit the file /var/sysgen/master.d/bsd K)Et ` H OIkZ% SGI IRIX 6.5 8I}0/"bgx7 systune net_tcp eEYUMQYB yxU|#n:BE You may also run systune interactively to see settings for all tcp parameters. ]gCy~)\ pMn$2qvR Sun Solaris 2.5.1, 2.6 mSD= MELu ndd -get /dev/tcp <tcp_parameter> U'fY ACLK}ov Windows NT 4.0 xY\,Axj From the Start menu, choose Run and enter Regedt32 to view the parameter located in the Registry file HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters 7@#)*wUcY |HVJnF:u Zx]CO.la Note:NT 4.0: You do not need the NT Resource Kit to edit the Registry file. f~ 8\CdZB 4'pMYI%I 4.Display the range of available settings. fW|%e>F& VbMaq=@C Platform ,E/x f Operating System Command $B$f nLL ev;rG>5' / HP-UX 10.10 KQRU$( nettune -l <tcp_parameter> J\Z`"%7} 2s@T|A'A HP-UX 10.20 }{f[:G.U O /usr/contrib/bin/nettune -l <tcp_parameter> (9Xb;(M2h; TsDx .,B. HP-UX 11.0 )HuL This option is not available. 6LNXSc{EO IS?L|_9}Z AIX 3.2.5, 4.1.4, 4.2 Q Jy>s This option is not available. *vXkp BWb_H-0S Digital Alpha NT 4.0 ~ }2 You must have the NT Resource Kit installed. From the Start menu, choose Run and enter "Regentry.hlp" and choose "network services" and choose "TCP/IP Transport Entries". G)f? 7 Wj1@ mUy Digital UNIX 4.0a pzR S19 dxkerneltuner l$vx"<, UJ=E/Y|7 Choose inet and click the Select Subsystem button. A panel displays current values, range of values, and any new settings. <v>|*XW ]o,21L5m NCR MP-RAS 3.0.1.01 and 3.02 c*h[Ixx inconfig -s ]7V MY_ &_HT)1Bl SGI IRIX 6.2,6.4, 6.5 u}w! MC6 This option is not available. TRnV=[u< #kK+y~{ Sun Solaris 2.5.1, 2.6 Xbn@;VmUH^ This option is not available. k/m} hWH PvoU?4X Windows NT 4.0 bwRCP7!" You must have the NT Resource Kit installed. From the Start menu, choose Run and enter "Regentry.hlp" and choose "network services" and choose "TCP/IP Transport Entries". <V0,u/a` <GeNa\M3 /<) oV3P+ 5.Reset keepalive values. 'B=;/ 0 F!)&>kNy8v Platform DUl\\Q% Operating System Command weW[KB{^ 6!H%B=O HP-UX 10.10 igY'# nettune -s <tcp_parameter> <nnn_value> &M{3kvyI 87&S"}^Z/ HP-UX 10.20 2;Vde|M*; /usr/contrib/bin/nettune -s <tcp_parameter> <nnn_value> rC$NR){ Z/ QueArCK HP-UX 11.0 D^(0xv4Q ndd -set /dev/tcp <tcp_parameter> <nnnn_value> U5Gb>O_]5 5a+4c6-F AIX 3.2.5, 4.1.4, 4.2 by.q6`+R2 no -o <tcp_parameter>=<nnn_value> ^JQpPa ,Yv_{5*2^ Digital Alpha NT 4.0 BKV*+Rr8{s Run Regedt32 to edit the Registry file located in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters. ,E u=.;q:V ?cYueYE1 Enter a new value and choose OK. S;(M)kwXgY >! aCBHW Reboot after editing. jN9|$m"f V2LTL%.8/ Digital UNIX 4.0a iR_Zca dxkerneltuner 9/h^9Y ap#RoJM; Choose inet and click the Select Subsystem button. A panel displays current values, range of values, and any new settings. [uq`1;Ey (:-(}{,w1 Enter a new setting and choose "Apply." No reboot is necessary. Q3iU1IiN Yhw!)R'G NCR MP-RAS 3.0.1.01 and 3.02 ntWP^f inconfig <tcp_parameter> <nnnn_value> MY2 Tcr9 Q-5*UN=E SGI IRIX 6.2, 6.4 X$< k$lcN Modify the parameters in /var/sysgen/master.d/bsd q7P ,>)aM r.d*lhr>T$ Execute the modification by entering the following: @zi;Ij> S4gq\_SRP /etc/autoconfig -f `#{e)XdJ XES :)lI SGI IRIX 6.5 b6#8wH4 Run the systune utility interactively by using the -i flag: L^R9t}r;" 0_ 4E,\N systune -i 59 {h+,Ha X,m`oP 2wn systune-> <tcp_parameter> = <nnn_value> ^`PvqQ5t5 `t79M, <tcp_parameter> = old_value (hexadecimal_value) )tU:eI !"i06qj Do you really want to change <tcp_parameter> to <nnn_value (hexadecimal_value)> (y/n) ]<~VSB{ VAlvQkB4} y 3?2vgX;W <(Z:qX4 systune-> quit y?ER^vs6 rB? ? IG Sun Solaris 2.5.1, 2.6 8He}7f9 ndd -set /dev/tcp <tcp_parameter> <nnnn_value> p{mKj. })cwfL)-^ Windows NT 4.0 1zmk-U}qK Run Regedt32 to edit the Registry file located in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters. Z$J Odw :NXF"^22? Enter a new value and choose OK. PZ]f =*< WL<6h([c Reboot after editing. vziZ0'Tg} b%T(ZA {-AG$Mo6 Note:NT 4.0: You do not need the NT Resource Kit to edit the Registry file. Eyf| L/H @GW q6\k Additional Resources s ( 4#I ;f, $KLf Digital UNIX C70AjjM3b 0:_]IL See the Digital UNIX System Tuning and Performance Management guide. yP`.V$!V8n 9 lm~8 IBM AIX 1kRZtzwP. v)0B"CZ5P For information on no, see the AIX Version 4.3 Commands Reference, Volume 4. BaV'"OH 8 fpg,=Sb; For information on tuning buffer parameters, see the chapter "Monitoring and Tuning Communications I/O" in the AIX Versions 3.2 and 4 Performance Tuning Guide. eA(!5wa=R M m"__bp NCR 6P 94biE,l Nc|Te~* NCR product documentation is available, free, at http://www.info.ncr.com/. s5j Ot$R _HHsI3}l Sun Solaris /"6{ftEM 3A#[#E|6jW See the SunSolve InfoDocs article 14227 about tcp_keepalive_interval parameter operation. This and other Sun Microsystems documentation is available at Sun's support web site, http://sunsolve.sun.com/ . You must be registered for contract services to access the documentation. _dSd@F_H (8K<f[ u SGI IRIX u3\}rN0 -gKiE^C{h_ To determine how to rebuild and reboot the new IRIX kernel, see the IRIX Administration: System Configuration and Operation.
|
|
|
|