Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Isucon makers casual talks

2,507 views

Published on

Published in: Internet
  • If you want to download or read this book, copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • If you want to download or read this book, copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THI5 BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THI5 BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Isucon makers casual talks

  1. 1. ISUCON1,2のハナシ 問題ふりかえり編 ISUCON Makers Casual Talks 長野雅広 kazeburo
  2. 2. ISUCON1
  3. 3. ISUCON1 • 簡易ブログシステム • インデックスページ(ページングなし) • 記事ページ • 記事投稿とコメント投稿 • サイドバー
  4. 4. ISUCON1
  5. 5. サイドバー 「新着コメントエントリ」をコメントが 投稿される度に全てのページで更新する必要がある
  6. 6. サイドバーの攻略 • 割と重めなクエリをキャッシュしたい SELECT a.id, a.title FROM comment c INNER JOIN article a ON c.article = a.id GROUP BY a.id ORDER BY MAX(c.created_at) DESC LIMIT 10 • ページまるごとキャッシュはNG • 1秒で”どこか”のページに確認が行われる • キャッシュの”単位”を考える
  7. 7. 実際のサービスでは
  8. 8. SSI <!--#include --> 記事/index サイドバー Apache/mod_ssi Plack::Middleware::SSI
  9. 9. SSI + memcached Router memcached App POST時にcache更新 SSI Engine internal request POST requestはバイパス
  10. 10. フロントキャッシュ戦略 • Reverse Proxyでcacheへのアクセスを 行ってSSIを処理すればより高速 • nginx + memcached • varnish(ESI)
  11. 11. ISUCON2
  12. 12. ISUCON2 • チケット販売サイト • 会場と座席の種類を選択し、購入 • 座席表が表示される • サイドバーあり
  13. 13. ISUCON2
  14. 14. ボトルネックは2つ • 座席表のHTML出力 • 購入トランザクション • (サイドバーはそれほど問題にならない)
  15. 15. 座席表 1席1マス 384KB
  16. 16. 座席表HTML出力戦略 • キャッシュは役に立たない • 購入処理は秒間数十~数百件 • 静的書き出し • Workerを別途起動し、1秒毎にHTML を生成し、静的ファイルの配信にする
  17. 17. 座席表HTML出力戦略 nginx App HTML HTML HTML HTML生成 Worker 購入処理 1秒に1回
  18. 18. 購入トランザクション $dbh->begin_work; $dbh->query('INSERT INTO order_request (member_id) VALUES (?)',$member_id); my $order_id = $dbh->last_insert_id; my $rows = $dbh->query( ‘UPDATE stock SET order_id = ? WHERE variation_id = ? AND order_id IS NULL ORDER BY RAND() LIMIT 1', $order_id, $variation_id, ); if ($rows > 0) { my $seat_id = $dbh->select_one( 'SELECT seat_id FROM stock WHERE order_id = ? LIMIT 1', $order_id, ); $dbh->commit; } else { $dbh->rollback; } わざと複雑に書いた
  19. 19. 購入トランザクション 1. 購入履歴テーブルへのinsert。 auto_incrementのidがorder_idとなる 2. 在庫テーブルをORDER BY RAND() LIMIT 1で更新 3. order_idを使い在庫テーブルから席番 号を引く
  20. 20. トランザクションを無くす • Redisを使う 1. order_idは INCR で生成 2. 予めランダムに並べられた席番号リス トから LPOP 3. MySQLの 購入履歴テーブル、在庫テー ブルの更新
  21. 21. ISUCON1,2の問題を ふりかえって
  22. 22. データの量
  23. 23. データの量と難易度 • ISUCON1 • 記事数 3,000、コメント数 16万 • dumpデータが129MB • ISUCON2 • 座席数(=在庫数) 40960 • 同時購入処理 200
  24. 24. データの量と難易度 • データ量が少なければ問題とはならない • 実際のサービスと同じ • データ量を変えながら、問題の難しさをある程度 調整していた • 開催直前にデータ量を変更し、特別賞のライン が想定とずれることも • 参加者の方に楽しんで貰えるように
  25. 25. いじょうです

×