Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Best Practices for Serverless Microservice Architecture and Design

115 views

Published on

Microservices are an architectural pattern that utilizes a collection of loosely coupled and independently deployable services to build an application. The benefits can be wide ranging from allowing different languages to be used by different services to helping control data integrity.

In this talk,the following topics will be covered:

Why are microservices useful?
Are microservices right for your application?
What are some common microservice architectures and design patterns?
Can we establish some best practices for microservice architecture and design?
Why serverless microservices?
How to stop worrying and easily deploy awesome APIs?

The goal of this talk is for the audience to understand what benefits microservices provide, and also some associated drawbacks. There will be examples of microservice architectures including some guidelines for best practices.

A simple example application built with microservices (using Node.js and the Serverless framework) will be made available on GitHub.

Published in: Technology
  • Be the first to comment

Best Practices for Serverless Microservice Architecture and Design

  1. 1. Best Practices for Serverless Microservice Architecture and Design Josh Weaver Software Engineer at LendingTree
  2. 2. 1. What is a microservice and why is it useful? 2. Are microservices right for your application? 3. What are some common microservice architectures and design patterns? 4. What are some best practices for microservice architecture and design? 5. Why use serverless microservices?
  3. 3. –Sam Newman “Small Autonomous (independently deployable) Services that work together, modeled around a business domain.”
  4. 4. credit: Sam Newman
  5. 5. Principles of Microservices • Isolate Failure • The failure of a single service should not impact any others • Security breaches can be isolated this way also
  6. 6. Principles of Microservices • Highly Observable • Each service should have easily readable logs and alarms
  7. 7. Principles of Microservices • Modeled Around Business Domain • Products should be handled separately from Users etc Users Products Inventory Shipping
  8. 8. Principles of Microservices • Culture of Automation • Automated Testing • Continuous Delivery
  9. 9. Principles of Microservices • Hide The Implementation Details • A database should be specific to a service and only accessible by that service • A common way to access the service, a simple api call usable by front or backend • Language agnostic • Users shouldn’t see any difference in use
  10. 10. Principles of Microservices • Decentralize Everything • Monoliths always require the entire application • Microservices are packaged separately and can be deployed with or without the rest of the application • Microservices cannot only be deployed independently, but they can be scaled independently as well
  11. 11. Principles of Microservices • Deploy Independently • Each service should be completely self contained and deployable • Deploying a single service should not affect or be affected by the deployment of other services
  12. 12. Benefits of Microservices • Decreased coupling of services • Failure isolation • Simplified security (isolated breaches) • Can code services in different languages*** • Ease in changing and adding functionality at any time • Highly scalable and reusable • Overall system architecture can emerge over time through refactoring • Reduced need for upfront system design • Allows for early and continuous deployment • Independent (autonomous) teams/projects and faster deployment cycles
  13. 13. Uber’s Monolith vs SOA Architechture
  14. 14. Potential Drawbacks of Microservices • Complexity in interaction of services • To work well, teams/projects require more independence and empowerment in technical decision making • Organization and initial deployment can be complex • More HTTP calls and network latency
  15. 15. Other Considerations with Microservices • Migrating from a monolith architecture is expensive in time and resources • The best time to make the switch is when other large infrastructure changes are necessary • It may be useful and possible to start by creating new or updated services as microservices
  16. 16. Are Microservices Right for Your Application? • Are you currently maintaining a large monolithic application with a modern stack? • Are you maintaining a large monolith with an outdated or end of life stack? • Are you planning to make big changes to your stack to your large application? • Are you planning a small scale application? • Are you planning a small scale application that will grow? • Are you planning to build a large scale application?
  17. 17. Are Microservices Right for Your Application? • Startups might benefit massively from microservices if they are building an application that might grow. • Microservices can also be a very inexpensive option for low budget projects.
  18. 18. How You Can Get Started • Your company wants to add a new feature • An AI chat service • An Alexa Skill • A messaging service for account information • A twitter bot for promoting company blog posts • All great opportunities to get started with microservices that can be used alongside your current infrastructure • You don’t need to start by converting your entire stack!
  19. 19. Still Not Convinced? microservices.io/articles/whoisusingmicroservices.html
  20. 20. Basic Microservice Architecture
  21. 21. Microservice Architecture: Web App
  22. 22. Microservice Architecture: Mobile Backend
  23. 23. Microservice Architecture: Tweet Leaderboard
  24. 24. Microservice Architecture: Image Resizing
  25. 25. Microservice Architecture Principles • Reduce Inertia • Choices should favor rapid feedback with reduced dependencies between teams • Eliminate Accidental Complexity • Replace processes, systems, and integrations that are overly complex; focus on essentials for each service • Consistent Data Flows • Eliminate duplication of data by having a single service access any given part
  26. 26. Best Practices for Microservice Design • Structuring applications can be tricky • Designing microservices should be simple • Design around business logic • Each major component should be its own service • e.g. Users should be handled independently of Products • Let the features guide the design
  27. 27. Best Practices for Microservice Design User Interface API Gateway Log In/Auth User Account Products Inventory Checkout/ Payment Messaging can be used for interactions between services
  28. 28. Best Practices for Microservice Design
  29. 29. Why Serverless for Microservices? • No Administration! No instances or operating systems, just deploy your code. • Auto-scaling: Service providers manage scaling challenges. Lulls or bursts? Don’t worry about it! • Pay for what you use: with functions as a service, you pay for the compute time you use and nothing else. This can lead to big cost savings. • Increased velocity: easy deployments and no need to provision instances means fast turnaround from idea to service Focus on Your Business Logic, Not Your Servers
  30. 30. Why Serverless for Microservices? • The Serverless CLI provides tremendous simplification to serverless build, test, and deployment • Avoid vendor lock-in, Serverless can deploy to any cloud provider (or all of them at the same time) • Serverless is widely used, has a lot of resources, and a lot of plugins (Serverless Offline FTW!)
  31. 31. Serverless for Microservices Example • github.com/joshweaver23
  32. 32. More Resources • Building Microservices - Sam Newman • aws.amazon.com/lambda/ • aws.amazon.com/serverless/ • serverless.com • github.com/anaibol/awesome-serverless • github.com/joshweaver23/microservices
  33. 33. Shameless Plug • LendingTree is Hiring! • Charlotte: C#, .NET • Charleston: Node.js, AWS • Interested? Talk to me (or Jay Ivanov) now or have a beer with me at happy hour!
  34. 34. Thanks! • Josh Weaver • Lending Tree • linkedin.com/in/joshweaver23/ • github.com/joshweaver23 • github.com/joshweaver23/microservices

×