构建异步API服务

 构建异步API服务

13c60e2a5806406b537daa542d3495da?s=128

flyerhzm

May 12, 2013
Tweet

Transcript

  1. 构ݐ䇗㑊తAPI෰务 ԫࢤහ Sunday, May 12, 13

  2. ࣗզհ绍 ࣗ༝职业ऀ 䇖ݯ爱޷ऀ flyerhzm at github, twitter, gmail, etc. Sunday,

    May 12, 13
  3. 䇖发᠓᜾తୈҰ选择 Sunday, May 12, 13

  4. Rails 䇖发շ଎ 䇖发ऀ众ଟ ࣾ۠庞େ Sunday, May 12, 13

  5. Rails ֶ习੒ຊߴ 运ߦ଎౓ຫ 惯ᆀఔং员 Sunday, May 12, 13

  6. ޳୺䘦છHTMLඇৗຫ Sunday, May 12, 13

  7. JSON API෰务኷շ Sunday, May 12, 13

  8. API෰务 对֎ఏڙ઀ޱ 单页໘应༻ ʢJavascript MVCʣ ٬户୺应༻ ʢiOSɼAndroidʣ Sunday, May 12,

    13
  9. CPU VS IO Sunday, May 12, 13

  10. ଟ进ఔ ॆ෼ར༻ଟ֩ 稳ఆɼ݈૖ ಺ଘ䇖销େ ʢcopy on writeʣ 进ఔ间੾换䇖销େ Sunday, May

    12, 13
  11. ଟ线ఔ 资ݯڞڗɼ节ল಺ଘ 线ఔ间੾换䇖销૬对较খ GILᏠ๏ར༻ଟ֩ ʢJRubyʣ 线ఔ锁问题 Sunday, May 12, 13

  12. ଟ进ఔ + ଟ线ఔ Sunday, May 12, 13

  13. 䇗㑊ඇ્࠹I/O Sunday, May 12, 13

  14. Node.jsʁ Sunday, May 12, 13

  15. EventMachine Sunday, May 12, 13

  16. EMత᠍఺ վ变编ఔ习惯 ଠଟճ调 Sunday, May 12, 13

  17. EMత᠍఺ Sunday, May 12, 13

  18. EventMachine + Fiber = EM::Synchrony Sunday, May 12, 13

  19. EM::Synchrony Sunday, May 12, 13

  20. EM::Synchrony Sunday, May 12, 13

  21. EM::Synchrony ࣸಉ㑊త୅码 运ߦ䇗㑊త୅码 Sunday, May 12, 13

  22. ଟ进ఔ + evented Sunday, May 12, 13

  23. OpenFeintత经验 Sunday, May 12, 13

  24. OpenFeintʢഉߦᒗʣ ଟ进ఔ (REE 1.8.7 Mysql) 1.5k rps (6进ఔ * 13صثʣ=>

    20 rps / 进 ఔ Sunday, May 12, 13
  25. OpenFeintʢഉߦᒗʣ ଟ线ఔ ʢJRuby 1.7.0 Mysqlʣ 1.5k rps (6线ఔ * 1进ఔ

    * 10صثʣ=> 25 rps / 线ఔ Sunday, May 12, 13
  26. GREEʢഉߦᒗʣ Goliath (Ruby 1.9.3 Mysql + Redis) 4k rps (4进ఔ

    * 4صثʣ=> 250 rps / 进ఔ 90% CPU / 进ఔ 50M / 进ఔ Sunday, May 12, 13
  27. ੑೳ测试 ೚Կجဋhello worldతੑೳ测试౎ੋ䳭ྲྀᔁ Sunday, May 12, 13

  28. ഉߦᒗ API https:/ /github.com/flyerhzm/apis-bench Sunday, May 12, 13

  29. rails / rails-api sinatra grape sinatra + sinatra-synchrony grape +

    goliath ඇ્࠹IO ્࠹IO Sunday, May 12, 13
  30. rails Sunday, May 12, 13

  31. rails-api Sunday, May 12, 13

  32. sinatra Sunday, May 12, 13

  33. grape Sunday, May 12, 13

  34. sinatra-synchrony (thin) Sunday, May 12, 13

  35. grape + goliath Sunday, May 12, 13

  36. ab测试 ab -n 1000 -c 1 /leaderboards/1000/users.json rails rails- api

    sinatra sinatra- synchrony grape grape + goliath time taken 18.670 17.465 15.924 8.764 16.719 11.750 Sunday, May 12, 13
  37. ab测试 ab -n 1000 -c 50 /leaderboards/1000/users.json rails rails- api

    sinatra sinatra- synchrony grape grape + goliath time taken 16.424 16.445 16.023 9.336 14.769 8.261 Sunday, May 12, 13
  38. ab测试 ab -n 1000 -c 60 /leaderboards/1000/users.json rails rails- api

    sinatra sinatra- synchrony grape grape + goliath time taken xxx xxx xxx xxx Sunday, May 12, 13
  39. ab测试 ab -n 1000 -c 100 /leaderboards/1000/users.json rails rails- api

    sinatra sinatra- synchrony grape grape + goliath time taken xxx xxx xxx 8.080 xxx 8.180 Sunday, May 12, 13
  40. Ұࠣ误ղ Sunday, May 12, 13

  41. 1. Rubyଠຫ Node.js, Go Sunday, May 12, 13

  42. 2. 买ߋଟత෰务ثདྷղႊ ੑೳ问题 Sunday, May 12, 13

  43. RubyՄҎ၏౸ ੑೳ޷ ኂ发ߴ 䇖发Ꮘ཰ߴ 维护ੑ޷ Sunday, May 12, 13

  44. 谢谢 Q&A Sunday, May 12, 13