1. Home
  2. Training Library
  3. Containers
  4. Courses
  5. Mastering Microservices with Python, Flask, and Docker

Microservices Benefits, Challenges & Best Practices

Contents

keyboard_tab
Introduction
1
Course Introduction
PREVIEW2m 39s
Designing & Building Microservices
Deploying Microservices

The course is part of this learning path

Python based Microservices - Go from Zero to Hero
course-steps
3
certification
1
lab-steps
2
description
1
play-arrow
Start course
Overview
DifficultyIntermediate
Duration2h 20m
Students88

Description

Interested in microservices, and how they can be used for increased agility and scalability?

Microservices is an architectural style and pattern that structures an application as a collection of coherent services. Each service is highly maintainable, testable, loosely coupled, independently deployable, and precisely focused.

This course takes a hands-on look at microservices using Python, Flask, and Docker. You'll learn how Flask can be used to quickly prototype and build microservices, as well as how to use Docker to host and deploy them.

We start by looking at various problems associated with monolithic architectures and how microservices address them. We then move on to designing and building a basic shopping cart system, focusing on each of the microservices that make up the overall system.

If you have any feedback relating to this course, feel free to get in touch with us at support@cloudacademy.com.

Learning Objectives

  • Obtain a solid understanding of microservices: the benefits, the challenges, and how using microservices differs from a monolithic approach
  • Learn how to design and build microservices using Python and Flask
  • Learn how to deploy microservices using Docker

Intended Audience

This course is intended for anyone who wants to build and deploy microservices using Python, Flask, and Docker.

Prerequisites

Python 3.x programming experience is required to get the most out of this course. If you want to follow along with this course, you'll need Python 3.7, an IDE (PyCharm Community Edition - free), and Docker (Docker Desktop).

Resources

The complete source code for the project demonstrated within the course is located here:

The repository contains the following 4 projects:

  1. user-service
  2. product-service
  3. order-service
  4. frontend

 

 

Transcript

You can update a service without redeploying the entire application. This makes bug fixes and feature releases more manageable and risk-free. A single development team can build, test, and deploy a microservice. This results in continuous innovation and a faster release cycle.

Teams can focus on one microservice. The smaller scope of microservices ensures the code-base easier to understand. Another benefit is when on-boarding new team members, they can easily get up to speed and become more productive.

If a service goes down, it will not take out the entire application. When change is required in a certain part of the application, the related service has to be modified and redeployed only and there is no need to modify and redeploy the entire application. Developers can use the latest microservices patterns and frameworks.

Technologies such as docker containers, Kubernetes can be used to host microservices. Teams can pick the technology, which are best fit according to their expertise.

Microservices can be scaled independently. Each microservice can be allotted the CPU and memory resources according to its requirement.

Next, we learn about the challenges we face when implementing microservices. Microservices applications have more moving parts than monolithic applications. Each microservice is however simple. But the entire system as a whole becomes more complex when the number of microservices increases.

Data consistency can be a challenge as each microservice is responsible for its own data persistence. Microservices architecture can lead to issues as each microservice can be built using different languages and frameworks. As a result, maintenance becomes difficult. It will be beneficial if you put project-wide standards to follow when building microservices.

In larger projects, the number of APIs increases with the size of the project. As a result, the communication within APIs increases and that could cause latency issues. You can introduce serialization techniques when designing APIs as well as asynchronous communication patterns where applicable.

Microservices require a mature DevOps culture. Updates to some microservices must not break other microservices that depend on it. Without careful design, you might face compatibility issues. Microservices are distributed systems. To be successful, first, evaluate whether the team has the required skills and experience.

Model each microservice around the business domain. Data storage should be private to each microservice. Use the best storage for each microservice. Offload authentication and SSL termination to the gateway. The gateway should handle client requests without any knowledge of the business rules. Otherwise, the gateway becomes a dependency causing coupling between microservices.

Microservices functionalities that are likely to change together should be packaged and deployed together. Otherwise, those microservices end up being tightly coupled as a change in one microservice will require updating the other microservice. Next, we design a basic shipping cart system which will be built later on.

About the Author
Students89
Courses1

Saqib is a member of the content creation team at Cloud Academy. He has over 15 years of experience in IT as a Programmer, with experience in Linux and AWS admin. He's also had DevOps engineer experience in various startups and in the telecommunications sector. He loves developing Unity3D games and participating in Game Jams.