Let's make your CDN with RUBY

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites & 1 Event

    Let's make your CDN with RUBY - Presentation Transcript

    1. Rubyによるお手軽CDN作成のすすめLet’s make CDN withRuby
      荒木靖宏
      ARAKI Yasuhiro
      <ar@debian.org>
      DebianProject
      First of all, thanks ruby!
      http://wiki.debian.org/DebianGeoMirror
    2. Self introduction
      Name:
      荒木靖宏ARAKI, Yasuhiro
      Debian Project Member
      Ph.D student of Univ. of Tokyo
      Researcher of Hewlett-Packard Labs
      現在求職中です。
      I am seeking a JOB.
      CV is available
      http://wiki.debian.org/DebianGeoMirror
    3. Why CDN?
      ftp.jp.debian.org stopped frequently
      Storage Trouble
      結局ここ二ヶ月くらいで ftp.jp.debian.orgには下記のトラブルが起き,ハードウェア,OS 共に丸ごと入れ替わってしまいました.これ以上トラブルが起きないことを切に願っております・・・.1, サーバのハードウェアが壊れた    -> 代替サーバに交換2, ストレージ(1)のディスクが壊れた    -> ストレージ(1)を切り離して残りのストレージでやりくり3, ストレージ(2)のディスク x 3 が壊れた    -> 予備のディスクに交換4, ストレージ(2)本体が壊れた    -> 新ストレージを手配,ストレージ(2) からデータを移行
      Electricity Shutdown
      [debian-users:45154] ftp.jp.debian.org 障害 現在発生している ftp.jp.debian.orgの障害のため,みなさまにご迷惑をおかけしており申し訳ありません.現状としては,サーバを何度再起動してもすぐに落ちてしまうため,代替機を準備中です.すみませんが,もうしばらくお待ちください.
      fscking!!!!!
    4. cdn.debian.net
      http://wiki.debian.org/DebianGeoMirror
      • Since 2007, Feb
      • 42 countries, more than 120 hosts
      • Keep alive every 2 min
      • Geo routing w/ GeoIP
      • Weighted DNS Round-Robin
    5. cdn.debian.net
      Surrogate@topstudio
      debianprimary
      Surrogate@kyushu-u,hokudai
      Surrogate@Kyoto-u
      Surrogate@naist
      ftp.XX.debian.org
      ftp.us.debian.org
      Japan primary
      = hanzubon.jp
      rsync
      Content Location Manager = deb.cdn.araki.net
      Japan mirrors
      CDN Control Plane
      rsync
      rsync
      rsync
      rsync
      apt-get update &&
      apt-get dist-upgrade
      rsync
    6. Pros
      http://wiki.debian.org/DebianGeoMirror
      Run without server modify
      You can use any server without modify.
      Run for simple client
      cf. No need“REDIRCT”
      ◎ gem use redirect
      × apt
    7. gem use redirect
      http://wiki.debian.org/DebianGeoMirror
      cfardm-2:~/Downloads$ gem source -l
      *** CURRENT SOURCES ***
      http://gems.rubyforge.org/
      cfardm-2:~/Downloads$ curl http://gems.rubyforge.org/
      <html>
      <body>
      <h1>Welcome to the RubyGems distribution website</h1>
      To download the yaml index select <a href="yaml">yaml</a><br><br>
      To view the available gems via your browser select <a href="http://gems.rubyforge.org/gems/">gems</a><br><br>
      To download and install RubyGems please visit <a href="http://rubygems.rubyforge.org">rubygems</a>
      </html>
    8. Cons
      Smart Client does not need this CDN!
      In some case, server rejects HTTP ping.
      http://wiki.debian.org/DebianGeoMirror
    9. Programs
      DNS type CDN based on DNS-Balance
      Original Author: Yokota-san!
      Modify points
      Check HTTP response code
      Temporally ignore slow response server
      use rsynctracefile
      /debian/project/trace/#{tracefile}
      Country and Continent detection by GeoIP.
      http://wiki.debian.org/DebianGeoMirror
    10. Gather surrogate candidates
      Same directory structure (Mandatory)
      Good:
      ftp.XX.debian.org/debian
      Bad:
      ftp.jaist.jp/pub/Linux/Debian
      now changed to “/debian”
      http://wiki.debian.org/DebianGeoMirror
    11. LETS MAKE YOUR CDN
      http://wiki.debian.org/DebianGeoMirror
    12. Prepare script
      • svn co https://osdn.debian.or.jp/repos/cdn/trunk/
      http://wiki.debian.org/DebianGeoMirror
    13. Prepare configuration
      vi JPN_hoge_cdn_araki_net.rb
      $tracefile = 'hanzubon.jp' # hanzubon 2007apr5
      $first_surrogate = '61.115.118.67'
      $surrogates = {
      '203.178.137.175' => '9000', # naist
      '150.65.7.130' => '9', # jaist
      }
      http://wiki.debian.org/DebianGeoMirror
    14. Let’s work
      cdkeepd && ruby ./keepd.rb
      set cron
      */2 * * * * ruby check-surrogates.rb
      ruby ./dns_balance.rb
      or
      /etc/init.d/dns_balance_keepd start
      /etc/init.d/dns_balance start
      http://wiki.debian.org/DebianGeoMirror
    15. Future work
      Now testing..
      SSLDRbfor information sharing and remote control
      Tweet
      Apply others and Code clean
      Available on REQUEST!
      http://wiki.debian.org/DebianGeoMirror
    16. cdn.debian.or.jpの信頼性
      更新頻度
      2分に一度
      DNS cacheは60秒
      1997年2月8日の動作開始以来ノンストップです
      cdn.debian.or.jpはのDNSは3箇所
      ファイルの信頼性は他のdebianミラーと同じ
      md5/sha1 sumを見てaptが選別
    17. Country – Access in 3 month
    18. サーバのえらびかた
      • 世界150カ国、月間100万以上で使われています(誇張あり)
      http://wiki.debian.org/DebianGeoMirror
    19. http://wiki.debian.org/DebianGeoMirror
      fin
      Reference& code
      http://wiki.debian.org/DebianGeoMirror
    20. http://wiki.debian.org/DebianGeoMirror
    21. cdn.debian.or.jpの実装
      動作部分は以下
      サロゲートへのrsync
      ネットワークの情報収集
      ネットワークがボトルネックじゃどうしょうもない
      サロゲートのステータスを管理
      眠ってるサロゲートにはサービスさせない
      クライアントをサロゲートに誘導する
      DNSでcdn.debian.or.jpを解決すると
      cdn.debian.or.jpのリストを返す
    22. approach
      Load balance by DNS+cache
      Why DNS?
      Client Protocol: DNS,HTTPand FTP
      Almost all mirrors provide HTTP only
      apt (Debian client) can not use REDIRECT
      よってDNSに頼ることに
      キャッシュはミラーサーバがあるじゃん
      ミラーサーバには手を入れないことにした
      今あるものに乗っかりたい
    SlideShare Zeitgeist 2009

    + yasuhiro arakiyasuhiro araki Nominate

    custom

    537 views, 2 favs, 1 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 537
      • 522 on SlideShare
      • 15 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 0
    Most viewed embeds
    • 15 views on http://donrails.araki.net

    more

    All embeds
    • 15 views on http://donrails.araki.net

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events