Cookpad and Microservices

44e6e0e9bcc3d8279020aad563f16f34?s=47 taiki45
December 18, 2014

Cookpad and Microservices

at 第1回 えびスタ! ~ 恵比寿スタートアップ勉強会 ~ http://ebista.connpass.com/event/10258/

44e6e0e9bcc3d8279020aad563f16f34?s=128

taiki45

December 18, 2014
Tweet

Transcript

  1. Cookpad and Microservices Why and how we move to Microservices

    architecture style
  2. Taiki Ono • @taiki45 • Joined Cookpad at 2014/3 •

    Dev-Infra group • Working with service integration related things and Web API
  3. Sponsored by

  4. Hi, we are Cookpad

  5. None
  6. over 50M users/month over 1.8M recipes

  7. Not only recipe site…

  8. None
  9. None
  10. None
  11. You can see more products!

  12. To make everyday cooking fun.

  13. Why Microservices?

  14. • Environment changes • Limit of Monolithic

  15. • Environment changes • Limit of Monolithic

  16. Our business changes

  17. User agent changes

  18. • Environment changes • Limit of Monolithic

  19. A huge Rails app +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines |

    LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 46173 | 37194 | 493 | 3754 | 7 | 7 | | Helpers | 14251 | 11687 | 13 | 1367 | 105 | 6 | | Models | 10153 | 7799 | 319 | 1152 | 3 | 4 | | Mailers | 402 | 326 | 16 | 35 | 2 | 7 | | Javascripts | 40217 | 34405 | 36 | 4940 | 137 | 4 | | Libraries | 2341 | 1833 | 112 | 252 | 2 | 5 | | Async_view specs | 247 | 212 | 0 | 0 | 0 | 0 | | Controller specs | 58856 | 48671 | 7 | 121 | 17 | 400 | | Feature specs | 40886 | 33590 | 0 | 196 | 0 | 169 | | Helper specs | 4151 | 3396 | 1 | 10 | 10 | 337 | | Lib specs | 22537 | 18817 | 27 | 128 | 4 | 145 | | Mailer specs | 421 | 346 | 0 | 0 | 0 | 0 | | Model specs | 71128 | 58668 | 4 | 70 | 17 | 836 | | Policy specs | 1487 | 1219 | 0 | 0 | 0 | 0 | | Request specs | 34595 | 29677 | 0 | 12 | 0 | 2471 | | Routing specs | 661 | 533 | 0 | 0 | 0 | 0 | | View specs | 619 | 508 | 0 | 2 | 0 | 252 | | Worker specs | 862 | 715 | 0 | 1 | 0 | 713 | +----------------------+-------+-------+---------+---------+-----+-------+ | Total | 349987 | 289596 | 1028 | 12040 | 11 | 22 | +----------------------+-------+-------+---------+---------+-----+-------+
  20. Slow test issue

  21. RRRSpec solved

  22. Slow deployment

  23. mamiya solved

  24. and some difficulties like scaling, upgrading Rails, etc…

  25. We can’t control our own application.

  26. We've found Microservices while we were challenging these issues.

  27. Microservices

  28. –James Lewis & Martin Fowler “an approach to developing a

    single application as a suite of small services” IUUQNBSUJOGPXMFSDPNBSUJDMFTNJDSPTFSWJDFTIUNM
  29. Build around business capabilities

  30. None
  31. Own process and lightweight messaging

  32. HTTP JSON REST

  33. Decentralization and polyglot

  34. Ruby + MySQL Go + Redshift Java + MySQL

  35. Characteristics of Microservices • Build around business capabilities • Own

    process and lightweight messaging • Decentralization and polyglot
  36. We can handle our own application, by paying cost of

    complexity as a whole.
  37. In Cookpad What we did?

  38. Published service data

  39. Garage Garage Garage Rails app

  40. Garage and garage-client • RESTful hyper-media API • JSON message

    enveloped in HTTP • Implemented as a Rails extension • Standardized communication pattern
  41. Solutions for product common problems

  42. º

  43. ̋

  44. Backend products • Auth server (OAuth2.0) • Personal information server

    • Notification base • Video backend
  45. Data synchronization between products

  46. Pub-Sub Topic

  47. Pub-Sub Topic

  48. Ping • Pub-Sub pattern • Implemented as a Rails extension

    • A thin wrapper of Amazon SNS and fluentd • Receive events via webhook
  49. What we did are… • Published product data with Garage

    • Built some backend products • Built Ping for data synchronization
  50. We are challenging more problems around Microservices

  51. Join us!! http://recruit.cookpad.com/