Microservices architecture uses an assembly of fine-grained services to deliver functionality. The goal of this architectural style is to innovate by reducing the dependencies between teams, which results in faster code to production. Serverless architecture code is an execution model where server-side logic is run in stateless, event-triggered, ephemeral compute containers that are fully managed by a third party. It is associated with less management overhead (as there are no servers to maintain) and is cheaper to operate since you only pay for what you use. While there are similarities and dissimilarities with both architectural styles, both require an application to be composed of a collection of loosely coupled components, which implement business capabilities. Thus, it is possible to implement microservices architecture as a serverless application.
Nikhil Barthwal elaborates, covering the pros and cons, details of various deployment patterns, and best practices. You’ll learn how to implement distributed sagas as a protocol for coordinating request among multiple functions, how code can be structured in both monorepo and multirepo, and how to leverage Apache Thrift and Google Protocol buffers to manage contracts between functions representing services. You’ll also discover how to use a unique ID attached to every message to gain more visibility during the runtime and prevent the problem of getting stuck in an infinite loop as well as why you need a rollback mechanism (which is needed for sagas anyway) and why you should embrace eventual consistency when designing fault-tolerant business processes.
Nikhil Barthwal is a tech lead in the Google Cloud Platform at Google, working on Knative, a Kubernetes-based platform to build, deploy, and manage modern serverless workloads and is passionate about building distributed systems. He has several years of work experience in big companies and smaller startups and also acts as a mentor to several startups. Outside of work, he speaks at local meetups as well as international conferences on several topics related to distributed systems and programming languages. Learn more via his homepage.
©2018, O’Reilly UK Ltd • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • firstname.lastname@example.org