Friday, April 11, 2014

[メモ] Starlet 0.22のリリースに伴いThundering Herd問題を再訪した件

@takezawaさんから、PerlベースのWebアプリケーションサーバであるStarletで複数ポートをlistenできるようにするPRをいただいたのでマージしました。やったね!

で、それに伴いprefork型TCPサーバのThundering Herd問題を再訪したので、その備忘録。なお、Thundering Herd問題については、prefork サーバーと thundering herd 問題 - naoyaのはてなダイアリーや、Starman と Starlet のベンチマークと Accept Serialization - Hateburo: kazeburo hatenablogあたりを参照のこと。

まず、こんなテストスクリプトを書いた: thundering-herd.pl

こいつを書いてあるコメントのとおり実行してみることで、2種類のケースでThundering Herd問題が存在するか調べることができる。

で、こいつを使った結果、以下の結論に達した。
  • accept(2)の呼出によるThundering Herd問題だが、多くの環境で過去の問題になったと考えてよい
  • select(2)で接続を待ち受け、次にaccept(2)を呼ぶようなケースでは、依然としてThundering Herd問題が存在する(当然と言えば当然だが)
とか言ってみたけど、、linux 2.6.32とOS X 10.8.5でしかテストしてないので、補足あれば教えてください m(__)m

あと、複数のポートにbind(2)するTCPサーバを書く際に注意すべき点として、prefork型サーバでselect(2)accept(2)の呼出順序で接続を確立する際は、ソケットをnonblockingモードにしておかないと、ワーカプロセスが余っているのに接続できないといった事態が発生する可能性がある。

この点は、上記のテストスクリプトを書くまでレビューするのを忘れていたんだけど、確認したらtakezawaさんのコードではちゃんと記述されていて、ちょっと感動した。いい仕事ありがとうございました。

16 comments:

  1. If in the advancing years it is added difficult to get a replica, this could be a acceptable affair for the breitling replica name brands. On the added hand, it could drive replica houses to accumulate accepting added and added authentic and accordingly added difficult to alarm out. In either case, the Watch Report for 2007 will become abnormally important for rolex replica consumers who accept something at pale in the development of the industry, for bigger or for worse. It has again taken six ancestors for this watch to evolve, and it is still not absolutely like the absolute thing! Aesthetically, it looks appealing acceptable you accept to admit, but if it was accustomed a absolute examination, it would not pass, no way. Over the year and bisected that it is taken for rolex replica uk this watch to appear this far, it is still got a continued means to go. In fact, I agnosticism that it will anytime be perfect. For one applied acumen if it was 100% accurate, it ability in fact accessible the floodgates for accusation from Panerai. The baby flaws accumulate it in some means as a distinct-enough altered watch they the replica companies could just play dumb, in a acknowledged cloister of law that is. Unfortunately, you accept to accord with some slight discrepancies amid replicas and the absolute thing, that is just how the replica rolex watches change is fit to plan for this industry.

    ReplyDelete


  2. Wonderful blog! I found it while searching on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Many thanks.
    2048 online | tanki online 3

    ReplyDelete
  3. Functies:- Het volledige Sint Jansbrug OWee programma boordevol activiteiten en artiesten, inclusief aanvullende informatie. web site! Never before have people had the freedom to honestly share how they feel about something, until now.

    ReplyDelete
  4. It's simple: log-in and find a meeting posting someone near you has made, or create your own. This is what you want Just create a fence around your office and turn it on in the app.

    ReplyDelete
  5. App Features:- Discover the preaching ministry of Dr. Click here! It looks pretty rough, but the features are promising.

    ReplyDelete
  6. Duckstruction is a highly addictive game in which you throw random stuff at ducks. My page. From Mehmet Akif Acar: The best text editor solution is the one providing you a unique way of expressing your feelings.

    ReplyDelete
  7. We've fixed an issue with the passcode entry fields not working properly. downlodable freeware The above mentioned modules are available for download on-demand.

    ReplyDelete
  8. )[Circle List]- Deleting, Copying, and Repositioning by the Edit button. http://garanttest.ru Players that guess, find and trace the flash card words fastest score huge points and bragging rights with family and friends.

    ReplyDelete
  9. Save decorated photo to camara roll or share it with your friends via Facebook, Twitter and Messangers. download software You have chance to get very lucky number and super lucky number.

    ReplyDelete
  10. ukThis will take you directly to Pauls hugely popular site with 22 pages packed with help and advice. http://joyplays.ru Wanna flip a coin for a hard decision? iHandy Coin Flip let you select your favorite coins to try your luck.

    ReplyDelete
  11. From Naveenium: Foursquare is your ultimate city guide, in your pocket. bestdownloadwarezonline.us Change the transparency ratio between the background image and user's photo! "" that can emphasize the subject.

    ReplyDelete

  12. شركة نقل عفش بالدمام الشرق الاوسط متحصصه فى نقل عفش واثاث بالدمام ونقل العفش بالخبر كما انها توفر شركة نقل عفش بالجبيل والخبر وشركة نقل عفش بالقطيف والاحساء وجميع خدمات نقل العفش والاثاث بالمنطقة الشرقية بارخص اسعار نقل عفش بالدمام وتقدم ايضا شركة تخزين عفش بالدمام والخبر
    نقل عفش بالدمام
    شركة نقل اثاث بالدمام
    شركة نقل اثاث بالخبر
    شركة نقل اثاث بالجبيل

    ReplyDelete
  13. Added Apps2SD - now you can move the app to the SD Card! downlodable ebooks HOW IT WORKS- Create a map and share it with your friends and family.

    ReplyDelete