Microservices Architecture: Mehmet Özkaya
Microservices Architecture: Mehmet Özkaya
icroservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Microservices Architecture
Mehmet Özkaya Follow
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 1/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
By the end of the article, you will Learn where and when to apply
Microservices Architecture with designing system with high availability,
high scalability, and low latency with microservices architectures.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 2/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 3/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 4/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Microservices;
have their own technology stack, included the database and data
management model;
Microservices Characteristics
Microservices are small, independent, and loosely coupled. A single small
team of developers can write and maintain a service. Each service is a
separate codebase, which can be managed by a small development team.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 5/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Services are responsible for persisting their own data or external state. This
differs from the traditional model, where a separate data layer handles data
persistence.
Again if we referring the Martin Fowler article, There are some common
characteristics for microservices architectures that fit the label.
by business capability.
This is Amazon’s notion of “you build, you run it” where a development
team takes full responsibility for the software in production.
Decentralized Governance
Netflix is a good example of an organization that follows this philosophy.
Sharing useful and all tested code as libraries encourages other developers
to solve similar problems in similar ways.
Infrastructure Automation
That means automate deployment to each new environment and for every
microservices with separately.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 8/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
As as summarized;
Agility
One of the most important characteristic of microservices is that because
the services are smaller and independently deployable, it’s easier to manage
bug fixes and feature releases. You can update a service without re-
deploying the entire application, and roll-back an update if something
goes wrong. In monolithic applications, if a bug is found in one part of the
application, it can block the entire release process. So new features was
waiting for a bug fix to be integrated, tested, and published.
A microservice should be small enough that a single feature team can build,
test, and deploy it. The microservices model enables an organization to
create small, cross-functional teams around one service or a collection of
services and have them operate in an agile fashion. Small team sizes
increase the agility. Large teams tend be less productive, due to
communication is slower and management overhead goes up So that occurs
the agility diminishes.
https://www.futurefundamentals.com/what
message brokers. It’s possible for the stack of every individual service to be
optimized for that service.
Technology changes all the time, development libraries and tools also
evolving very fast so since an application composed of multiple, smaller
services, it is much easier and less expensive to evolve with more desirable
technology into microservices.
Fault Isolation
Microservices loose coupling also builds with fault isolation and better
resilience into applications. If one of your microservice becomes
unavailable, it won’t affect the entire application. Of course you should
design your microservices are fault tolerance and handle faults correctly
for example by implementing retry and circuit breaking patterns. Even
failures happened, if you fix that failures without any business affect, you
customer will always happy.
Scalability
Microservices can be scaled independently, so you scale out sub-services
that require less resources, without scaling out the entire application. So we
can say that, microservices require less infrastructure than monolithic
applications because they enable precise scaling of only the required
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 13/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
services,
Also scaling is very easy with using an container orchestrator tool like
Kubernetes, you can pack a higher volume of services onto a single host,
which allows for more efficient utilize of hardware resources.
Data isolation
Since microservices following the database-per-service patterns,
databases are separated with each other according to microservices design.
So it gets easier to perform schema updates, because only a single database
is affected. In a monolithic application, schema updates can become very
challenging, and risky.
As you can see that we have seen lots of Benefits of microservices, so now its
time to see challenges of microservices architecture.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 14/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Complexity
Microservices application has lots of services need to work together and
should create a value. Since there are lots of services, that means there is
more moving parts than the monolithic application. Each service is simpler,
but the entire system is more complex. Even deployments can be
complicated for hundreds of services deploy different times hard to manage
versions. Think about the communication. Its really easy to communicate
components in monolithic application because it is inter-process
communication, can be the same machine and same process. But
microservices communication is hard topic and need to have a strategy to
manage inter-service communications between server even different geo-
locations.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 15/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Data Integrity
Microservice has its own data persistence. So data consistency can be a
challenge. Mostly we should follow eventual consistency where possible.
But transactional operations are always will be challenging.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 16/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 17/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
https://www.futurefundamentals.com/what
As you can see the image has several microservices and one API GW which
provide to communicate microservices to client applications.
https://feras.blog/microservices
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 18/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
And you can see another reference architecture. This is also one of the e-
commerce reference architecture that we will evolve step by step this
architecture.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 19/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
https://docs.microsoft.com/en
And lastly we can see some advance microservices architecture. You can see
several API GWs for different client applications. And several microservices
communication via Event Bus systems.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 20/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
As you can see that we have applied “Database per Microservices” and put
database for every microservices on our e-commerce application. So now
these database can be polyglot persistence.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 21/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Microservices are polyglot environments. You can pick any tech stack, as
per microservices. Communication will be handle via REST APIs.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 22/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
c# — asp.net
js — node js
python — django
python — flask
These are backend web api language and frameworks that can be suited.
Since ms are polyglot environments you can pick one of them for every
particular microservices.
Databases
NoSQL
MongoDb
Redis
Cassandra
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 23/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
For Relational
PostgreSQL
MySQL
Oracle
Sql Server
So these are the options that we can use on our e-commerce microservice
architecture. We will decide this tools as per our requirements and company
it strategy.
So what's next ?
See that UI and MS communication are direct, and it seems hard to manage
communications. We now we should focus on microservices
communications with applying API GW pattern and evolving these
architecture step by step.
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 24/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
Microservices Pattern
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 25/26
12/12/21, 10:03 AM Microservices Architecture. In this article, we’re going to learn… | by Mehmet Özkaya | Design Microservices Architecture with Patterns & Principles | Medium
https://medium.com/design-microservices-architecture-with-patterns/microservices-architecture-2bec9da7d42a 26/26