Introduction to Microservices Architecture-Part 1

Sweta Garai
3 min readNov 26, 2021

--

Monolithic architecture for application development and deployment has been around for a while now. It is a single-tiered application in which the data access code and user interface are combined into one program in a single platform. Due to the lack of modularity in a monolithic architecture, software engineers often find it difficult to manage the services or part maintenance and repair without replacing the whole application.

The concept of microservices was introduced around 2004-2005 in various terms and forms. It was a variant of SOA (Service Oriented Approach). There are some differences between SOA and MS architecture, eg. SOA uses a shared database for all its services but microservices allocate independent databases to each of its services. Microservices replaced heavyweight monolithic and SOW architecture and started gaining popularity around 2011–2012.In February 2020, the Cloud Microservices Market Research report predicted that the global microservice architecture market size will increase at a CAGR of 21.37% from 2019 to 2026 and reach $3.1 billion by 2026.

Benefits and Drawbacks of Microservices Architecture

Benefits

  1. It has modular applications that are smaller and simpler to design.

2. Eliminates long term commitment to a single technology

3. Two levels of architecture facilitate flexibility in deployment: System-level architecture consists of the communication mechanism between service interfaces which is often static and service-level architecture consists of internal architecture each service uses and is very flexible in terms of technology used.

Drawbacks

  1. Due to its granularity, microservices architecture deployment is quite complex
  2. One major drawback is integration testing, if something fails, it might be painstaking to debug

Partition Strategies in Microservices

Microservices follow parallelized development and deployment. Few partition strategies for microservices are,

  1. Partition by a noun, services are partitioned based on their names. eg: catalog services that store catalog for every product in an e-commerce website
  2. Partition by verb, services partitioned based on functionalities, eg: checkout UI.
  3. Partition by subdomain, partition based on a subdomain of features
  4. Single Responsibility Principle, partition based on a single responsibility
  5. Unix Utilities, one focused thing

Major Challenges in the deployment of microservices

  1. Enforcing invariants, features that do not change across partitions as the microservices are independent
  2. Understanding the design due to complexity
  3. Optimize the number of services taking into account runtime, excessive network hops or latency, and difficulty of understanding

One important thing to keep in mind during partition is to avoid anti-pattern. It stands for dependent modules where the change in one module affects the other, anti-pattern holds back the purpose of microservices. components that change for the same reason should be packaged together

Deployment Patterns

While deploying microservices, each module can utilize any relevant technology, language, or framework. Each service can include multiple service instances. Building and deploying services is usually faster due to the breadth of each module. It provides better management since every service can be deployed independently and there exists no dependency among services. One thing to consider is constraining the resources consumed by each service and checking the reliability as well as cost-effectiveness. Few deployment patterns are discussed below:

Multiple Service per host pattern

In this pattern, one server can host multiple services. This pattern is efficient in resource utilization and facilitates fast deployment. The drawback of Multiple service patterns is poor isolation and poor visibility as it is hard to understand which service is consuming what resources. Due to multiple services in one host, dependency version control may occur as different services are packed within the same host.

Service per Virtual Machine Pattern

This is a more modern approach to deploying microservice patterns. Every service is hosted in an independent VM. Netflix uses Service per VM to deploy its 600 services in a lot of ec2 instances. It provides good isolation, manageability, technology encapsulation and allows cloud infrastructure for autoscaling/load balancing. One drawback is less efficient resource utilization leading to slow deployment.

This is part 1 of the introduction to microservices. Please follow the next article where I will talk about various aspects and details of microservices.

--

--

Sweta Garai

Data Scientist seeking solace in the modern chaotic world!!