????4.1??????
??????????????????????и???????????????????????????????????????о?????
????????????????????????????????????????????????filter in/out????????????????????У???е????????????????????????????????????????????????????????y??????????????????????????????????????????????50%??
??????????????????????????????????Ч????????????????????????????????????????????????????????????ο?Hash Collision DoS ????????????????????????????????????й?????????????????Ц??“e??????”???Щ????£?????????????????????Ч?????????е?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????150%???????????????????????????StackExchange?????????????hash???????£?
??????????????????????????????????????±??????ζ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????20??????????????????????μ?????????10??С??????SQL????????????????????????????????????????????·?????????????????к????????merge?????????SQL?????????????????????????????磺?????????Select??????????????Select??????????????
????4.2???????
??????????????????????????????????????strcpy??strcat????strlen????????????????????????????????????????????????????????????????N????????е?????????????????????????????磺2012-05-29 08:30:02???????????????select where between????????????????????????????и???°??Щ????????????????????????????????????????????????????????????????????????Щ??????????????????λ??????????????????????????????150K?ε?????????????????????????????????????????????????????30%???????????????????????????μ??????????淶????????????????????а????????????????磺const char fname[]=”functionName()”???????????????????????????????static????????
????????????????????thread is evil??????????????????Щ????????????????????????????????????????????????????л????????????????????????????????????磺??汾????????(MVCC)????????е?????????????????????????????????????ж?д???????????????????????????????????????????????C++?У??????????????????????????AutoPtr???????Щ????????????????????????????????????????????????????????????AutoPtr???????????????????ú???????????????????????????????????ò????AutoPtr????????????????????????????????ü???????????????????50%?????????Java????????ü??????????μ?????????????????????????Java????????????????????????????????????????????????????л??????????£????????????????????????????????????????????к????????
?????????????С?????????????malloc/realloc/calloc???????????????????????????????????????????????????????????????——??????????????????????в?????????GDB????????????hang????malloc???????20????з?????????Щ?????????????????????????????????????STL??????????????????????????С??????????????к?????????????????????????????????????????????·?????Runtime-C???????????????????????????????????????????????????????????????????????в????????????????????????????????????????ж??????????????????????????3????????????????????????????????????Щ????????????http????????????Ч????????????????????????????????????????????????
???????????????????Unix?μ????????????block??non-block???????????Щ?????????block?????磺Socket?μ?select??Windows?μ?WaitforObject??????????????????????????????????????????????????????????????????????????????臨??????????????????У???????е????????????????μ??????????????????????????????????callback??????????Щ????????????????????????????????????????????????????????к????????Throughput???????????????????????latency??????????????????
????????????????????????????????????????????????????磺STL?е???????????????????????????????????????????????????й????????????????????????????磬STL?Щ??????size()==0??empty()??????????????size()??O(n)??????empty()??O(1)???????????С???Java?е?JVM?????????????Щ??????-Xms-Xmx-Xmn-XX:SurvivorRatio-XX:MaxTenuringThreshold??????????JVM??GC??GC????????????????????full GC??????????????????????“?????????????”??????????е?????????????????????
????4.3???????
??????????????????????TCP Tuning???????????????????????????????????£??????????к?????????????????Linux??TCP/IP??????????????????????£??????????Linux?????????????Linux???????????????????????????????????????????TCP/IP????1:Э?頃???顣????????????Щ????????????
????A)TCP????
???????????TCP???????к??????????????????????????????????????棬???????????????????TCP???????????????????????????????TCP?????????????????????????TCP???????????????????????????????????????TCP?????????????????????????SYNC Flood???????????????????????KeepAlive????????????????????????????????????????????????????????????????????????????????????TCP??????????????????????????????????????????????????HTTP???????KeepAlive????????????HTTP???????????????????1-2?????keepalive?????????????????????????DoS???????????漸??????????????Щ????????????ο?????
????net.ipv4.tcp_keepalive_probes = 5
????net.ipv4.tcp_keepalive_intvl = 20
????net.ipv4.tcp_fin_timeout = 30