class: center, middle, cover, nonumber # .integergreen[Help! I accidentally built a microservice] ## .icon[![Magento Master 2017](images/master.png)] Fabian Schmengler ### .icon[![integer_net GmbH](images/integernet.png)] integer_net GmbH ### .twitter[@fschmengler] ### .emoji[🇧🇪] \#mm17be --- layout: true .footer[.left[Fabian Schmengler /> **Help! I accidentally built a microservice**] .right[@fschmengler]] --- class: center, middle #.huge[Hello .emoji[👋]] --- background-image: url(images/help-google.png) --- background-image: url(images/oh-shit.png) --- # Definition by Martin Fowler & James Lewis https://martinfowler.com/articles/microservices.html >In short, the microservice architectural style is an approach to developing a single application as a **suite of small services**, each **running in its own process** and communicating with lightweight mechanisms, often an HTTP resource API. --- # Definition by Martin Fowler & James Lewis https://martinfowler.com/articles/microservices.html > These services are **built around business capabilities** and **independently deployable** by fully automated deployment machinery. --- # Definition by Martin Fowler & James Lewis https://martinfowler.com/articles/microservices.html > There is a **bare minimum of centralized management** of these services, which may be written in different programming languages and use different data storage technologies. --- class: center # Microservices are hot shit! .emoji.narrow[.huge[🔥]
.huge[.huge[💩]]] .icon[![Netflix](images/netflix.svg) ![eBay](images/ebay.svg) ![Amazon](images/amazon.svg)] --- class: center # Magento by default is not so hot? .emoji.narrow[.huge[ ]
.huge[.huge[💩]]] .big.icon[![Magento](images/magento.png)] --- class: center # Can we turn it into this? .emoji.big[ 🔥
💩
💩💩💩
💩💩💩💩💩
💩💩💩💩💩
💩💩💩💩💩
💩💩💩
💩
] --- class: center # SHOULD we turn it into this? .emoji.big[ 🔥
💩
💩💩💩
💩💩💩💩💩
💩💩💩💩💩
💩💩💩💩💩
💩💩💩
💩
] --- # Martin Fowler again (2015) https://martinfowler.com/bliki/MicroservicePremium.html > So my primary guideline would be **don't even consider microservices unless you have a system that's too complex to manage as a monolith.** > > The majority of software systems should be built as a single monolithic application. Do pay attention to good modularity within that monolith, but don't try to separate it into separate services. --- .big[ > I think Magento should become microservice ***capable***, but not mandate them .right[*-- Alan Kent*] ] - DevBlog: "Should Magento Go Microservices?" [http://bit.ly/2wJhBk8](https://community.magento.com/t5/Magento-DevBlog/Should-Magento-Go-Microservices/ba-p/66547) --- class: middle .big[ > You are not Netflix, stop trying to be them! .right[*-- Russ Miles*] ] --- class: middle .big[ > You are not AOE, stop trying to be them! .right[*-- Fabian Schmengler*] ] --- # Do I need a microservice architecture for my Magento builds? -- - .red[**No.**] -- # Can I still benefit from microservice concepts? -- - .green[**Yes!**] .emoji[😎] --- # Own Process - Speed up web requests with asynchronous workers - Non-blocking processes separated from Magento cronjob --- # Independent Services - Spares huge Magento overhead - New possibilities: - event loop based servers (node.js, ReactPHP) - different database technologies - Vertical scalability per service - you MAY still have common dependencies (database or code) --- # Decoupling, Modularity - Always a good idea - Microservices force it - BUT not a reason to extract something as a service --- class: center, middle .big[.icon[![M](images/m.png)]onolith] .emoji.huge[.huge[ 💩] 💩💩💩💩💩] .big[.icon[![M](images/m.png)]icroservices] --- class: center, middle .big[.icon[![M](images/m.png)]onolith] .emoji.huge[.huge[ 🌟] 🌟🌟🌟🌟🌟] .big[.icon[![M](images/m.png)]icroservices] --- # Non shitty examples ## Fulfilment module - Sander Mangel, FitForMe - presented at MageTitans IT 2016 - Slides: [http://bit.ly/2yfJpOf](https://www.slideshare.net/SanderMangel/scaling-an-ecommerce-environment) -- ## Stock Processing Microservice (PoC) - Ivan Chepurnyi, EcomDev - presented at MageTitans USA 2016 - Slides: [http://bit.ly/2hkWvXu](https://www.slideshare.net/StaceyWhitney1/mage-titans-usa-2016-ivan-chepurnyi-creating-microservices-for-magento-20-performance) --- # Accidental Microservice Search suggestions: ![like this](images/help-google.png) --- class: image-solr background-image:url(images/screen_autosuggest.png) # Accidental Microservice Search suggestions: **.integergreen[IntegerNet_Solr]** --- # Accidental Microservice Search suggestions: **.integergreen[IntegerNet_Solr]** .width50[![no, like this](images/screen_skusearch.png)] --- background-image: url(images/autosuggest_component.png) class: middle, center --- # Microservice characteristics - own process .green[✔️] - lightweight communication (HTTP) .orange[(✔️)] - built around business capabilities .green[✔️] - independently deployable .red[❌] -- Not optimal: a shared database (Solr) --- background-image: url(images/tie-fighter.png) --- class: middle, center .width100[![autosuggest component](images/autosuggest_microservice.png)] --- # Microservice characteristics - own process .green[✔️] - lightweight communication (HTTP) .green[✔️] - built around business capabilities .green[✔️] - independently deployable .green[✔️] -- OK, and still a shared database --- # Advantages - lightning fast - scales better - reusable component for different apps - currently Magento 1 and Magento 2 --- # Accidental Microservices (2) Payment Backend: - SEPA and credit card - No PSP involved - PCI compliant --- background-image:url(images/payment_service.png) --- # Microservice characteristics - own process .green[✔️] - lightweight communication (HTTP) .green[✔️] - built around business capabilities .orange[(✔️)] - independently deployable .green[✔️] --- # Advantages - separated sensitive data from Magento - tailored security measures --- # When to use a Microservice approach? - Do you have special requirements which Magento is not good at? - Do you have the resources to assign separate teams to each service? - Are you hitting scalability limits? - Are you ready to deal with network failures? - 📖 "The Fallacies of Distributed Computing" --- class: middle,center background-image: url(images/all-in.jpg) #.big.white[Do not ...!] .small.layer.bottom[Image: CC-BY-ND 2.0 flickr/worldpokertour/33379990650] --- class: center #.huge[Thank you] -- ##.huge[Questions?] --- background-image: url(images/fs-large.jpg) .popup-contact[ **Contact:** .www[www.integer-net.de] .email[fs@integer-net.de] .twitter[@integer_net] .twitter[@fschmengler] **I'm here, talk to me :-)** ]