What is Microservices Architecture?
Bài đăng này đã không được cập nhật trong 3 năm
In the last two week, I did a research about sofware devlopment architecture, and I am interested in two archeticture Monolithic and Microservices. And Microservices is the most I am interested. So, what is "Microservices"?
What is "Microservices"?
Introduced by Dr. Peter Rodgers in 2005, "Micriservices" has many definition which given by difference developer. However, base on wikipedia:
"Microservices are a more concrete and modern interpretation of service-oriented architectures (SOA) used to build distributed software systems.".
Understanding Architecture
The way of microservices work is breaking a large appplication into many small core function base on business capability. Then, we can group developer into small team to work on those module and each team can use their favorite language, tools, and framworks. Because their task is focusing on one thing only and they use language, tools they fimilar with, they can develop each module faster. how each modul talk to each other?
The microservices find each other by using via a service discovery when it found each other, they communicate using REST or messaging.
Who use "Microservices" today?
Nowadays, there are many large web site have switch from monolithic to microservices architecture such as Netflix, eBay, Amazon, the UK Government Digital Service, realestate.com.au, Forward, Twitter, PayPal, Gilt, Bluemix, Soundcloud, The Guardian, and many more.
Example of Microservices
Let’s apply microservices architecture for develop “Plant Lover” project.
Base on requirement for “Plant Lover” project, we divide it into 4 module:
-
Catalog: which we use for grouping plants based on its property. This we assign to a team who use java to develop it since those group is good at Java.
-
Search: a small group develop this service and they use Python
-
Point: the score which given to user and assign to RoR team to develop this module.
-
Processing:this service we choose C language because C has lots of library for working with image.
Then, we connect those feature together by using API for communication between point service, search service, catalog service or messaging for communication with processing service. And now our applicationis ready for deployment.
Pro and Con of "Microservices"
Pro
- Each group of developer can use langaunge of choice for their develpment
- Freedom of choice of technology, tools, framworks
- Easy to scale which developer can add or remove some service easily.
- Easy to understand and maintain because each module has focus on one specific problem
- Design for failure, when one service down, it just down on one feature and other working fine
- Focus on one thing
Con
- It is hard to test for destibuted system.
- Need to update multiple database when something change because each service have its own database.
- Duplication data storage
- Developers have to put additional effort into implementing the mechanism of communication between the services
I think this awesome youtube video will explain you more about Microserices.
Resource
Summary
Microservices is a good choice when you want to build a complex application. However, this archeticture also has some down side too. And after you apply this archeticture on your project, you will see how awesomeness this archeticture is!
All rights reserved