Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DevCon - Microservices

ProdOps
June 22, 2015

DevCon - Microservices

ProdOps

June 22, 2015
Tweet

More Decks by ProdOps

Other Decks in Technology

Transcript

  1. Leading in IT Education .co.il www. Agenda ◦ Intro to

    microservices ◦ Architecture: Monoliths vs. Microservices ◦ MSA best practices
  2. Leading in IT Education .co.il www. MicroServices Loosely coupled service

    oriented architecture with bounded contexts not updated at the same time slideshare.net/adriancockcroft/dockercon-state-of-the-art-in-microservices minimal knowledge of own environment
  3. Leading in IT Education .co.il www. why microservices • smaller

    code easier to change/understand • faster start time / speedier deployments • decoupling of concerns [SOLID] • independent scaling • better fit with infrastructure (mem/cpu) • scaling development teams • fault isolation • flexibility in choosing a technology stack ◦ ↵
  4. Leading in IT Education .co.il www. why NOT microservices •

    developing distributed system complexity • implement inter-process communication • transactions are more difficult to track • integration automated tests a challenge • operational complexity - multiple moving parts • coordination between teams about dependencies
  5. Leading in IT Education .co.il www. MySQL PostgreSQL MongoDB Oracle

    MS-SQL “nosql” database async worker RabbitMQ ActiveMQ Kafka Memcached Redis APC Ruby on Rails Django Spring ASP.NET PHP monolithic application presentation business logic data access request / response relational database cache queue scheduler microservices.io/patterns/monolithic.html
  6. Leading in IT Education .co.il www. Components of Ruby on

    Rails $ rails new myapp create config.ru create Gemfile create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/views/layouts/application.html.erb create config/routes.rb create config/application.rb create config/environment.rb create config/secrets.yml create config/initializers/assets.rb create config/initializers/backtrace_silencers.rb create config/initializers/cookies_serializer.rb create config/initializers/filter_parameter_logging.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/session_store.rb create config/initializers/wrap_parameters.rb create config/locales/en.yml create config/boot.rb create config/database.yml create db/seeds.rb create log create public/404.html create public/422.html create public/500.html create public/robots.txt create tmp/cache create tmp/cache/assets create vendor/assets/javascripts create vendor/assets/stylesheets
  7. Leading in IT Education .co.il www. monitoring configuration router layout

    data access queue cache scheduler micro services infrastructure services authentication authorization form handling file uploads web scraping indexing searching application services e-mail pdf generation payments workflow engine pagination load balancer
  8. Leading in IT Education .co.il www. microservice types ◦ sync,

    in-path request / response ◦ async “enrich” workers ◦ databases ◦ event handlers ◦ encapsulate private database ◦ sharing a database
  9. Leading in IT Education .co.il www. Service Discovery Allows automatic

    detection of devices and services Composed usually of two parts: • service registration • service lookup / discovery
  10. Leading in IT Education .co.il www. Service Registration The process

    of a service registering its location in a central registry: • Authentication credentials • Protocols • Versions numbers
  11. Leading in IT Education .co.il www. Service Discovery The process

    of a client application querying the central registry to learn of the location of services
  12. Leading in IT Education .co.il www. Service Discovery Zookeeper •

    Doozer • Etcd Eureka • Serf • DNS • SkyDNS • Consul Redis • Database (don’t do this) jasonwilder.com/blog/2014/02/04/service-discovery-in-the-cloud/
  13. Leading in IT Education .co.il www. REST API • HTTP

    Transport • HTTP Verbs • Resources • Versioning
  14. Leading in IT Education .co.il www. request types • user

    request endpoints ◦ with layout ◦ api only [mobile, etc…] • inner-service • webhook callbacks
  15. Leading in IT Education .co.il www. ruby rack web application

    run Proc.new { |env| [ 200, {'Content-Type' => 'text/html'}, [ "Hello world!" ] ] } gem install rack && rackup app.rb
  16. Leading in IT Education .co.il www. go web application package

    main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello world!") } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
  17. Leading in IT Education .co.il www. request a web page

    from google/amazon/facebook how many services were involved in its creation?
  18. Leading in IT Education .co.il www. composing ◦ ajax ◦

    iframes ◦ server side includes (Apache/nginx) ◦ edge side includes (Akamai/Varnish) what about json api includes? dejanglozic.com/2014/10/20/micro-services-and-page-composition-problem/
  19. Leading in IT Education .co.il www. go ssi - ssi.go

    func ssi(url string) template.HTML { resp, err := http.Get(url) defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) return template.HTML(body) } func ssiHandler(w http.ResponseWriter, r *http.Request) { funcMap := template.FuncMap { "ssi": ssi, } tmpl, err := template.New("root").Funcs(funcMap).ParseGlob("*.html") err = tmpl.ExecuteTemplate(w, "combiner.html", "") }
  20. Leading in IT Education .co.il www. go ssi - combiner.html

    <!doctype html> <html> <body> <div style="width:50%;float:left"> {{ ssi "http://plus.google.com" }} </div> <div style="width:50%;float:right"> {{ ssi "http://www.facebook.com" }} </div> </body> </html>
  21. Leading in IT Education .co.il www. SOLID principles ◦ Single

    Responsibility - single reason to change ◦ Liskov Substitution - single API, polyglot implementation ◦ Interface Segregation - bounded context, minimum knowledge ◦ Dependency Inversion - api gateway mattstine.com/2014/06/30/microservices-are-solid
  22. Leading in IT Education .co.il www. MSA Patterns • Circuit

    breakers • Dynamic (external) configuration • Automagic service discovery • Data Enrichment
  23. Leading in IT Education .co.il www. Micro Service Skeleton ◦

    communication protocol [REST ProtoBuf MQ] ◦ monitoring / metrics ◦ logging ◦ change management [versioning] ◦ deployment / rollback
  24. Leading in IT Education .co.il www. Micro Service Infrastructure ◦

    server - service fit ◦ multi-tenancy ◦ promise registry ◦ services - ◦ queue ◦ builder / bakery ◦ auto scaling
  25. Leading in IT Education .co.il www. “If you can’t feed

    a team with two pizzas, it’s too large. That limits a task force to five to seven people, depending on their appetites” - Jeff Bezos medium.com/@benorama/the-evolution-of-software-architecture-bd6ea674c477
  26. Leading in IT Education .co.il www. references ◦ martinfowler.com/articles/microservices.html ◦

    infoq.com/articles/microservices-intro ◦ slideshare.net/luksow/microservices-workshopiteratorswarsjawa2014 ◦ blog.xebia.com/2014/07/04/create-the-smallest-possible-docker-container/ ◦ highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html ◦ blog.heroku.com/archives/2013/12/3/end_monolithic_app ◦ youtube.com/watch?v=WwrCGP96-P8
  27. Leading in IT Education .co.il www. Thank you! www.devops.co.il We

    invite you to join Operations Israel Facebook group on on.fb.me/Ops-IL we are hiring at [email protected]
  28. Leading in IT Education .co.il www. http://www.thoughtworks.com/insights/blog/microservices-nutshell http://blog.dataloop.io/2014/12/15/monitoring-for-micro-services/ https://blog.docker.com/2014/12/dockercon-europe-keynote-state-of-the-art-in-microservices-by-adrian-cockcroft-battery-ventures/ http://thenewstack.io/dockercon-europe-adrian-cockcroft-on-the-state-of-microservices/

    http://assets.thoughtworks.com/assets/technology-radar-july-2014-en.pdf http://blog.dataloop.io/2014/04/29/devops-exchange-meetup-april-14-microservices-for-devops/ http://www.slideshare.net/jpetazzo/containers-docker-and-microservices-the-terrific-trio http://tech.gilt.com/post/102628539834/making-architecture-work-in-microservice http://plainoldobjects.com/2014/11/16/deploying-spring-boot-based-microservices-with-docker/ http://java.dzone.com/articles/getting-granular-microservices?mz=62447-cloud http://techblog.realestate.com.au/a-microservices-implementation-retrospective/ http://martinfowler.com/bliki/MicroservicePrerequisites.html http://dius.com.au/2014/05/19/simplifying-micro-service-testing-with-pacts/ http://www.boundary.com/blog/2014/08/microservices-conways-law/ http://thenewstack.io/reactive-frameworks-microservices-docker-and-other-necessities-for-scalable-cloud-native-applications/ http://adetante.github.io/articles/service-discovery-with-docker-1/ http://adetante.github.io/articles/service-discovery-with-docker-2/ http://www.codingthearchitecture.com/2014/07/06/distributed_big_balls_of_mud.html http://martinfowler.com/articles/distributed-objects-microservices.html http://www.slideshare.net/lynxmanuk/microservices-and-the-cloud-devops-cardiff-meetup http://blog.osgi.org/2014/07/the-big-ball-of-mud.html http://contino.co.uk/use-docker-continuously-deliver-microservices-part-1/ http://blog.carbonfive.com/2014/05/29/an-incremental-migration-from-rails-monolithic-to-microservices/?utm_source=rubyweekly&utm_medium=email http://www.brunton-spall.co.uk/post/2014/05/21/what-is-a-microservice-and-why-does-it-matter/ http://blog.carbonfive.com/2014/04/28/micromessaging-connecting-heroku-microservices-wredis-and-rabbitmq/ http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html http://martinfowler.com/articles/microservices.html http://www.slideshare.net/michaelneale/microservices-and-functional-programming
  29. Leading in IT Education .co.il www. http://blog.codescrum.com/2014/12/16/Microservices_with_RabbitMQ_and_Docker/ http://microservices.io/ http://www.toolsjournal.com/integrations-articles/item/3689-interview-wavemaker-ceo-on-api-growth-and-microservices-architecture http://searchsoa.techtarget.com/feature/Microservices-is-more-than-a-buzzword

    http://www.thoughtworks.com/insights/blog/top-technical-content-insights-2014 https://www.voxxed.com/blog/2014/12/exploring-microservices-in-the-enterprise/ http://blog.gopheracademy.com/advent-2014/testing-microservices-in-go/ http://www.thoughtworks.com/insights/blog/microservices-nutshell http://www.infoq.com/news/2014/11/gotober-fowler-microservices http://www.oreilly.com/pub/e/3261 http://www.activestate.com/blog/2014/12/merry-microservices http://java.dzone.com/articles/can-microservices-architecture http://www.slideshare.net/stonse/microservices-at-netflix http://www.slideshare.net/ThoughtWorks/sam-newman-deployingandtestingmicroservices?related=1 http://blogs.jsfcentral.com/JSFNewscast/entry/enterprise_java_newscast_episode_23 http://searchsoa.techtarget.com/answer/Microservices-architecture-101-What-the-heck-is-it http://www.codingthearchitecture.com/2014/07/06/distributed_big_balls_of_mud.html http://www.infoq.com/news/2014/12/netflix-prana http://www.slideshare.net/aahoogendoorn/20141222-growing-a-microservices-landscape-with-smart-use-cases http://searchsoa.techtarget.com/feature/Microservices-is-more-than-a-buzzword http://www.javaadvent.com/2014/12/doing-microservices-with-micro-infra.html#more https://developers.soundcloud.com/blog/building-products-at-soundcloud-part-3-microservices-in-scala-and-finagle http://anders.janmyr.com/2014/12/lambda-javascript-micro-services-on-aws.html?m=1 http://linux.sys-con.com/node/3268704 http://blog.gopheracademy.com/advent-2014/atlas/ http://michaelfeathers.silvrback.com/microservices-until-macro-complexity http://www.toolsjournal.com/integrations-articles/item/3689-interview-wavemaker-ceo-on-api-growth-and-microservices-architecture http://marmelab.com/blog/2014/12/19/microservice-administration-with-ng-admin.html http://java.dzone.com/articles/microservices-and-platform http://searchsoa.techtarget.com/video/Moving-away-from-ESBs-to-microservices http://www.infoq.com/news/2014/12/monoliths-microservices https://github.com/4finance/micro-infra-spring/blob/master/CHANGELOG.md#0721 https://developer.ibm.com/wasdev/blog/2014/08/27/microservices-liberty-netflixoss/ http://www.activestate.com/blog/2014/12/microservices-and-paas-part-vi