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さんのコードではちゃんと記述されていて、ちょっと感動した。いい仕事ありがとうございました。

18 comments:

  1. 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
  2. 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
  3. App Features:- Discover the preaching ministry of Dr. Click here! It looks pretty rough, but the features are promising.

    ReplyDelete
  4. 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
  5. 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
  6. )[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
  7. 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
  8. 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
  9. 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
  10. 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
  11. Currently no configuration of the screensaver itself is available. http://downloadonlinefree.top In Wayfaring, Silf takes readers step-by-step through the Gospels, examining and elucidating the teachings they contain.

    ReplyDelete
  12. Matching game -- This super fun matching game is a great way to keep children and adults engaged in the activity as they practice sounds in words. http://downloadgtasanandreas.me From there, you can sync it with your desktop or laptop computer, or you can email it to any email address.

    ReplyDelete
  13. From Kevin Devine: Download one introductory issue for FREE now. iwanttodownload.gdn Beware This app is designed to be as chill and laid back as possible.

    ReplyDelete
  14. Race Replay Two computer racers replay your previous two races on each track to give you some competition. downloadfreefilesfromhere.gdn A simple interface lets you select your bet amount and tap the table to place your bet.

    ReplyDelete
  15. Manage your tasks conveniently on your home/office PC, and have them synced to your iPhone/iPad and vice versa. awesomedownloadfiles.xyz This Cisco Authorized Exam Prep is the same one that has been used by over 50,000 Cisco and Cisco Partners for their Certification Studies.

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete

Note: Only a member of this blog may post a comment.