????TCP????????????????RWIN(TCP Receive Window Size)??????????????????????TCP???????????Sender????ack??????????????????????????????????????Sender??????Receiver??????ack??Sender???????????????????????????????????????????????TCP???????????????????????????????????ж????????????TCP?????????????????????(????????)?????????????????????????????????????????????£?

net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

???????????????????RWIN??????ó???????? * ??·???Sender???buffer??ú?RWIN????????С?????Sender???????????????Receiver???????????????????buffer??С????????????????????????????????????????????????????????????????磬??????????buffer???????????????ack?????Щ?????????????????????磬???????Щbuffer???????????ж???(??????ack)??buffer??????????????????????TCP??????е??????????????????????(???????????????£???????????????) ?????????????????????????????綪???????????С(????????????LAN??)??????????????????????????????buffer???и???????紫??????(????????????????????)??

??????????????????????????????????????????????????????????????????????????????????????????????????????????????UDP????????????????????

????B)UDP????

???????UDP?????????Щ???????????????????MTU???????(??????TCP???????????????·????????)????ν????????????????????·??????????????????????????????70????????????·??????????????????·??????????100??????????????ζ????????????7000???????????????????????????????????????20???????????????2000??????????·???(???????)???????? ???????????????UDP??????????????????????MTU?????????????????????????????????????????????MTU?????????1500??????????4352????802.11????????7981???????????????TCP/UDP????????????????Ч????Payload??????????????IPЭ??????20??????UDP?????8?????(TCP??????)?????????????????????UDP??????????1500-8-20=1472???????????????С?????????????ù??????? ????????????Щ??(??????£??????ЩNB?????????????????????????????????????????????????С??????MTU??????????fragment?????????????????????飬?????????????д?????)

??????????£????Socket???????????????setsockopt() ???? SO_SNDBUF/SO_RCVBUF ???С??TTL??KeepAlive??Щ??????????????????к???????????????Socket?????

??????????UDP??????????????multi-cast??????????????????????????????????????????????Ч?????????????????????????????(?????????????????????)?????????

????C)????????

????????????????????????????????????????????????????????Linux?£??????????ifconfig?????????????????????????overrun??????????????????????????txqueuelen????(???????1000)?????????????Щ???磺ifconfig eth0 txqueuelen 5000??Linux????????????У?ethtool?????????????????????????С????Windows?£?????????????????????е???????е??????????(?磺Receive Buffers?? Transmit Buffer?????????????в???????)????Buffer???????????????????????紫??????Ч??

????D)????????????

?????????·???ü?????????????????????????е?TCP?????????????????????????????select???????????????????1024??????????????poll??????????1024???????????select??poll??????????????????????????????????????????????????O(n)???????????epoll???????epoll???????????????????????????????????????callback?????????????????????????????Linux Kernel 2.6???????(?????2.5.44???????)?????????????е?????????????????????epoll_ctl??????????????????????????????????

?????????????Щ??DNS Lookup?????????С??????磺gethostbyaddr/gethostbyname????????????????????????????????????????????????DNS??????????????????????????????????????????????time out?????????????????hosts?????????????????????????й???????????????????????????????????ζ??顣?????????????棬gethostbyname??????????????????????????????gethostbyname??????????????????????gethostbyname???????????????????????С???(?????????GNU??gethostbyname_r()???????????????Щ) ?????????????????????????磬??????Linux?????NIS??????NFS???Щ?????????????????ú??????????С???