Skip to content
Pablo Rodriguez

Architecting Serverless Microservices

  • Independent Development and Deployment: Can be developed and deployed without affecting other microservices
  • Independent Scaling: Scales based on its own demand patterns
  • Code Isolation: Does not share code with other microservices
  • API Communication: Communicates over well-defined APIs using lightweight protocols
  • Single Business Function: Performs one specific business capability solving a particular problem
  • Small Team Ownership: Owned by small development teams who choose their own tools
  • Stateless Design: Should be stateless to ensure fast instantiation and scaling
  • Own Data Store: Has its own dedicated data store for ACID transactions when needed

Example: Breaking a Monolithic Application

Section titled “Example: Breaking a Monolithic Application”

Monolithic Forum Application:

  • Tightly coupled processes for users, topics, and messages
  • Single service deployment
  • Scaling affects entire architecture
  • Complex feature additions as codebase grows
  • High availability risk due to dependent processes

Microservice Forum Application:

  • User Service: Independent user management
  • Topic Service: Separate topic handling
  • Message Service: Dedicated message processing
  • Each service can be updated, deployed, and scaled independently
  • Lightweight API communication between services

Microservices foster small, independent teams with ownership of their services. Teams work within well-understood contexts and can develop more quickly with shorter development cycles.

Dividing software into small, well-defined modules enables teams to use functions for multiple purposes. Services written for specific functions can be reused as building blocks for other features.

Each microservice can be independently scaled to meet demand for specific application features. This enables:

  • Right-sizing infrastructure needs
  • Accurate cost measurement per feature
  • Maintained availability during demand spikes

Development teams have autonomy to make technical decisions and choose the best tools for their specific problems. Teams are responsible for creating, deploying, and maintaining their microservices.

Applications handle service failures through functionality degradation rather than complete system crashes, unlike monolithic applications.

Continuous integration and continuous delivery pipelines simplify trying new ideas and rolling back changes. Low cost of failure enables experimentation and accelerates time-to-market.

  • Architecture: Representational State Transfer requiring stateless compute
  • Implementation: Amazon API Gateway with AWS Lambda
  • Alignment: Matches Lambda’s stateless function design principle
  • Duration Limit: Lambda functions have maximum 15-minute execution time
  • Use Case: When microservices require more than 15 minutes to complete
  • Serverless Option: AWS Fargate deployed behind Application Load Balancer
  • Alternative: Amazon ECS or Amazon EKS if serverless isn’t a requirement
  • Request Flow: Amazon API Gateway → Application Load Balancer → Containers
  • Integration: AWS Lambda integrated with streaming services
  • Services: Amazon Kinesis Data Streams for scalable streaming solutions
  • Scaling: Lambda scales automatically with Kinesis

Microservices operate primarily at the application tier and data tier of a web three-tier architecture:

  • Each API request fulfills a specific business capability
  • Pattern: Amazon API Gateway + AWS Lambda + Amazon DynamoDB = Serverless microservice
  • Lambda Suitability: 15-minute maximum execution time makes Lambda ideal for microservice compute components
Important

Microservices form only part of a three-tier architecture solution and should not be considered a standalone full three-tier architecture solution.

Microservice applications are composed of autonomous, specialized services that provide significant benefits in team agility, code reusability, flexible scaling, technological freedom, resilience, and simplified deployment.