Engineering the Future of Software
29–31 Oct 2018: Tutorials & Conference
31 Oct–1 Nov 2018: Training
London, UK

Implementing microservices as a serverless application

Nikhil Barthwal (Google)
14:1515:05 Monday, 29 October 2018
Location: Blenheim Room - Palace Suite
Secondary topics:  Overview, Theoretical
Average rating: ****.
(4.00, 5 ratings)

Who is this presentation for?

  • CTOs and principal engineers

Prerequisite knowledge

  • Familiarity with the serverless application model and microservices architecture

What you'll learn

  • Understand the pros and cons of implementing microservices as a serverless application, what problem sagas solve and how to implement them in serverless, and best practices
  • Learn how to implement various microservices deployment patterns in serverless architecture


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.

Topics include:

  • Advantages: No servers to manage, no need for a separate DevOps team, extremely efficient in scaling, and cheaper to operate
  • Disadvantages: Loss of flexibility, vendor lock-in, deployed functions that are hard to monitor or debug, functions that are limited by available resources, only asynchronous communication is possible between functions, no direct equivalent of a central broker like Kafka in serverless
  • Software engineering issues: Source code repo design, evolving contracts for microservices implemented as serverless application, and managing contracts between functions representing services
  • Best practices for implementing microservices architecture as a serverless application
Photo of Nikhil Barthwal

Nikhil Barthwal


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.