{"id":572,"date":"2017-05-01T22:29:01","date_gmt":"2017-05-01T22:29:01","guid":{"rendered":"http:\/\/e6b4b2a746ed40e1af829d1fa82daa10"},"modified":"2017-09-21T15:48:20","modified_gmt":"2017-09-21T07:48:20","slug":"windows-socket-connections","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/572","title":{"rendered":"Windows Socket Connections"},"content":{"rendered":"<h3>\u6700\u5927TCP\u8fde\u63a5\u6570<\/h3>\n<p>[HKEY_LOCAL_MACHINE \\System \\CurrentControlSet \\Services \\Tcpip<br \/>\n\\Parameters] TcpNumConnections = 0x00fffffe (Default = 16,777,214)<\/p>\n<p>\u4ee5\u4e0a\u6ce8\u518c\u8868\u4fe1\u606f\u914d\u7f6e\u5355\u673a\u7684\u6700\u5927\u5141\u8bb8\u7684TCP\u8fde\u63a5\u6570\uff0c\u9ed8\u8ba4\u4e3a 16M\u3002\u8fd9\u4e2a\u6570\u503c\u770b\u4f3c\u5f88\u5927\uff0c\u8fd9\u4e2a\u5e76\u4e0d\u662f\u9650\u5236\u6700\u5927\u8fde\u63a5\u6570\u7684\u552f\u4e00\u6761\u4ef6\uff0c\u8fd8\u6709\u5176\u4ed6\u6761\u4ef6\u4f1a\u9650\u5236\u5230TCP \u8fde\u63a5\u7684\u6700\u5927\u8fde\u63a5\u6570\u3002<\/p>\n<h3>\u6700\u5927\u52a8\u6001\u7aef\u53e3\u6570<\/h3>\n<p>TCP\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u8fde\u63a5\u65f6\uff0c\u5ba2\u6237\u7aef\u5fc5\u987b\u5206\u914d\u4e00\u4e2a\u52a8\u6001\u7aef\u53e3\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u8fd9\u4e2a\u52a8\u6001\u7aef\u53e3\u7684\u5206\u914d\u8303\u56f4\u4e3a 1024-5000 \uff0c\u4e5f\u5c31\u662f\u8bf4\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u6700\u591a\u53ef\u4ee5\u540c\u65f6\u53d1\u8d773977 \u4e2aSocket \u8fde\u63a5\u3002\u6211\u4eec\u53ef\u4ee5\u4fee\u6539\u5982\u4e0b\u6ce8\u518c\u8868\u6765\u8c03\u6574\u8fd9\u4e2a\u52a8\u6001\u7aef\u53e3\u7684\u8303\u56f4<\/p>\n<p>[HKEY_LOCAL_MACHINE \\System \\CurrentControlSet \\Services \\Tcpip \\Parameters] MaxUserPort = 5000 (Default = 5000, Max = 65534)<\/p>\n<h3>\u6700\u5927TCB \u6570\u91cf<\/h3>\n<p>\u7cfb\u7edf\u4e3a\u6bcf\u4e2aTCP \u8fde\u63a5\u5206\u914d\u4e00\u4e2aTCP \u63a7\u5236\u5757(TCP control block or<br \/>\nTCB)\uff0c\u8fd9\u4e2a\u63a7\u5236\u5757\u7528\u4e8e\u7f13\u5b58TCP\u8fde\u63a5\u7684\u4e00\u4e9b\u53c2\u6570\uff0c\u6bcf\u4e2aTCB\u9700\u8981\u5206\u914d 0.5 KB\u7684pagepool \u548c 0.5KB<br \/>\n\u7684Non-pagepool\uff0c\u4e5f\u5c31\u8bf4\uff0c\u6bcf\u4e2aTCP\u8fde\u63a5\u4f1a\u5360\u7528 1KB \u7684\u7cfb\u7edf\u5185\u5b58\u3002<\/p>\n<p>\u7cfb\u7edf\u7684\u6700\u5927TCB\u6570\u91cf\u7531\u5982\u4e0b\u6ce8\u518c\u8868\u8bbe\u7f6e\u51b3\u5b9a<\/p>\n<p>[HKEY_LOCAL_MACHINE \\System \\CurrentControlSet \\Services \\Tcpip<br \/>\n\\Parameters] MaxFreeTcbs = 2000 (Default = RAM dependent, but usual Pro =<br \/>\n 1000, Srv=2000)<\/p>\n<p>\u975eServer\u7248\u672c\uff0cMaxFreeTcbs \u7684\u9ed8\u8ba4\u503c\u4e3a1000 \uff0864M \u4ee5\u4e0a\u7269\u7406\u5185\u5b58\uff09<\/p>\n<p>Server \u7248\u672c\uff0c\u8fd9\u4e2a\u7684\u9ed8\u8ba4\u503c\u4e3a 2000\u3002<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cServer \u7248\u672c\u6700\u591a\u540c\u65f6\u53ef\u4ee5\u5efa\u7acb\u5e76\u4fdd\u63012000\u4e2aTCP \u8fde\u63a5\u3002<\/p>\n<h3>\u6700\u5927TCB Hash table \u6570\u91cf<\/h3>\n<p>TCB \u662f\u901a\u8fc7Hash table \u6765\u7ba1\u7406\u7684\uff0c\u4e0b\u9762\u6ce8\u518c\u8868\u8bbe\u7f6e\u51b3\u5b9a\u4e86\u8fd9\u4e2aHash table \u7684\u5927\u5c0f<\/p>\n<p>HKEY_LOCAL_MACHINE \\System \\CurrentControlSet \\services \\Tcpip<br \/>\n\\Parameters] MaxHashTableSize = 512 (Default = 512, Range = 64-65536)<\/p>\n<p>\u8fd9\u4e2a\u503c\u6307\u660e\u5206\u914d pagepool \u5185\u5b58\u7684\u6570\u91cf\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679cMaxFreeTcbs = 1000 , \u5219 pagepool \u7684\u5185\u5b58\u6570\u91cf\u4e3a 500KB<\/p>\n<p>\u90a3\u4e48 MaxHashTableSize \u5e94\u5927\u4e8e 500 \u624d\u884c\u3002\u8fd9\u4e2a\u6570\u91cf\u8d8a\u5927\uff0c\u5219Hash table \u7684\u5197\u4f59\u5ea6\u5c31\u8d8a\u9ad8\uff0c\u6bcf\u6b21\u5206\u914d\u548c\u67e5\u627e TCP \u8fde\u63a5\u7528\u65f6\u5c31\u8d8a\u5c11\u3002\u8fd9\u4e2a\u503c\u5fc5\u987b\u662f2\u7684\u5e42\uff0c\u4e14\u6700\u5927\u4e3a65536.<\/p>\n<p><b><span style=\"font-size:14px;\">TcpTimedWaitDelay<\/span><\/b><br \/>\n\u5fae\u8edf\u5efa\u8b70\u6700\u4f4e\u53ef\u8a2d\u5b9a\u7e8c\u5b58\u6642\u9593\u70ba 30 \u79d2\uff0c\u800c\u4e14\u4e5f\u63d0\u5230\u8a2d\u5b9a 30 \u79d2\u61c9\u8a72\u4e0d\u6703\u51fa\u554f\u984c\uff0c\u56e0\u6b64\u6211\u5e7e\u4e4e\u90fd\u53ea\u8a2d\u5b9a 30 \u79d2\u800c\u5df2\uff1a<\/p>\n<p>Windows Registry Editor Version 5.00<\/p>\n<p>[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters]<br \/>\n\"TcpTimedWaitDelay\"=dword:0000001e<\/p>\n<h4>\u53c2\u8003\uff1a<\/h4>\n<h4>IBM WebSphere Voice Server \u5728windows server 2003 \u4e0b\u7684\u5178\u578b\u914d\u7f6e<\/h4>\n<p>MaxUserPort = 65534 (Decimal)<\/p>\n<p>MaxHashTableSize = 65536 (Decimal)<\/p>\n<p>MaxFreeTcbs = 16000 (Decimal)<\/p>\n<p>\u8fd9\u91cc MaxHashTableSize \u88ab\u914d\u7f6e\u4e3a\u6bd4MaxFreeTcbs \u59274\u500d\uff0c\u8fd9\u6837\u53ef\u4ee5\u5927\u5927\u589e\u52a0TCP\u5efa\u7acb\u7684\u901f\u5ea6\u3002<\/p>\n<p>Links:<br \/>\n<a href=\"\/network\/538.html\" target=\"_blank\">http:\/\/www.xiaobo.li\/network\/538.html<\/a><\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<h3>\u6700\u5927TCP\u8fde\u63a5\u6570<\/h3>\n<p>[HKEY_LOCAL_MACHINE \\System \\CurrentControlSet \\Services \\Tcpip<br \/>\n\\Parameters] TcpNumConnections = 0x00fffffe (Default = 16,777,214)<\/p>\n<p>\u4ee5\u4e0a\u6ce8\u518c\u8868\u4fe1\u606f\u914d\u7f6e\u5355\u673a\u7684\u6700\u5927\u5141\u8bb8\u7684TCP\u8fde\u63a5\u6570\uff0c\u9ed8\u8ba4\u4e3a 16M\u3002\u8fd9\u4e2a\u6570\u503c\u770b\u4f3c\u5f88\u5927\uff0c\u8fd9\u4e2a\u5e76\u4e0d\u662f\u9650\u5236\u6700\u5927\u8fde\u63a5\u6570\u7684\u552f\u4e00\u6761\u4ef6\uff0c\u8fd8\u6709\u5176\u4ed6\u6761\u4ef6\u4f1a\u9650\u5236\u5230TCP \u8fde\u63a5\u7684\u6700\u5927\u8fde\u63a5\u6570\u3002<\/p>\n<h3>\u6700\u5927\u52a8\u6001\u7aef\u53e3\u6570<\/h3>\n<p>TCP\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u8fde\u63a5\u65f6\uff0c\u5ba2\u6237\u7aef\u5fc5\u987b\u5206\u914d\u4e00\u4e2a\u52a8\u6001\u7aef\u53e3\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u8fd9\u4e2a\u52a8\u6001\u7aef\u53e3\u7684\u5206\u914d\u8303\u56f4\u4e3a 1024-5000 \uff0c\u4e5f\u5c31\u662f\u8bf4\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u6700\u591a\u53ef\u4ee5\u540c\u65f6\u53d1\u8d773977 \u4e2aSocket \u8fde\u63a5\u3002\u6211\u4eec\u53ef\u4ee5\u4fee\u6539\u5982\u4e0b\u6ce8\u518c\u8868\u6765\u8c03\u6574\u8fd9\u4e2a\u52a8\u6001\u7aef\u53e3\u7684\u8303\u56f4<\/p>\n<p>[HKEY_LOCAL_MACHINE \\System \\CurrentControlSet \\Services \\Tcpip \\Parameters] MaxUserPort = 5000 (Default = 5000, Max = 65534)<\/p>\n<h3>\u6700\u5927TCB \u6570\u91cf<\/h3>\n<p>\u7cfb\u7edf\u4e3a\u6bcf\u4e2aTCP \u8fde\u63a5\u5206\u914d\u4e00\u4e2aTCP \u63a7\u5236\u5757(TCP control block or<br \/>\nTCB)\uff0c\u8fd9\u4e2a\u63a7\u5236\u5757\u7528\u4e8e\u7f13\u5b58TCP\u8fde\u63a5\u7684\u4e00\u4e9b\u53c2\u6570\uff0c\u6bcf\u4e2aTCB\u9700\u8981\u5206\u914d 0.5 KB\u7684pagepool \u548c 0.5KB<br \/>\n\u7684Non...<\/p>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/572\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[291],"tags":[267],"class_list":["post-572","post","type-post","status-publish","format-standard","hentry","category-network","tag-c10k"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=572"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/572\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}