Introduction of Microservices

Kavindaperera
4 min readMar 25, 2022

--

Microservices

One of the hot topics that most software developers talk about is Micro Services. Many developers, including me, had many concerns about why such architecture is essential, why it is famous, and what benefits it provides us. Additionally, we even considered the drawbacks of using such architecture. During this article, we will discuss microservices and their advantages and disadvantages.

Introduction Of Microservices

To know what microservices are, let’s initially talk about what we had before micro servers came to life. Before microservices, it consists of monolithic applications.

Monolithic Applications

A monolithic application, it has a single executable file for the entire application. In a monolithic application, the application as a whole is packed or combined into one file.
If you take an e-commerce application as an example — This application consists of several classes. One is a model class, one class to handle the payment, etc. The entire files are put together in one place when using monolithic applications.

One of the significant drawbacks of using this is that if you require to change anything in the whole application, for example, if you need to change just one class file, you have to send the entire zip file after the necessary change is done again.

Does sending the entire zip file matter? Yes, of course, it is a hectic task because the entire application requires a testing mechanism to be performed once again. Several testing mechanisms, such as regression testing performance testing, should be carried out. If you require releasing a new version, the entire application needs to be turned off, which is very complex work.

Another major disadvantage of the monolithic application is that no single person knows the entire code base; therefore, you require separate support to handle this. Making the debug and development process much harder.

Advantage — Using the architecture allows to easily test (integration testing) since it is just one single application
-Very easy to monitor since it consists of one application

Microservices

Microservices: Mostly referred to as the other era of service-oriented architecture. This is also capable of carrying some essential features of what SOS have.

Microservices has their own dedicated purpose of living. In other words we can mention it as a domain driven development and it has its own define scope. This is one of the characteristics of micro services

Microservices — also known as the microservice architecture — is an architectural style that structures an application as a collection of services

The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.

In Microservices Architecture, we split a large, complex application into small, autonomous, independently deployable services.

Some of the characteristics of microservices

  • Microservices should be able to run on their processes.
  • Capable of communicating to some lightweight mechanism most of the time ex: HTTP.
  • Should be able to develop using the smaller team quickly.
  • In microservices, you should be able to main decentralized control as much as possible.
  • Microservices gives the capability of implementing in various languages.
  • Microservices should be able to scale independently in addition that microservices should be able to deploy independently

There is latency when microservices require to talk to other applications. in other words, it needs some time to communicate with other services. The right amount of balance should be achieved for the project to be successful.

For example — Let’s say there are five services. and one service is called numerous times. Lets assume due to corona the search service is mostly called therefore we can add more services to work as this search service in order to balance the load and later on we can simply remove these extra services. this basically refers to as functional decomposition plus that's what it say individually scalable

What does it take to develop a microservice application?

Although most people create microservice applications in java, .net is totally up to the developers. Developers are capable of choosing any language they prefer. It should be microservices responsibility to handle every language. When structure, it is essential to consider the domain-driven factor. One critical factor that arises when structuring is that you need to ensure that services don’t depend on other factors.
Ex: services should be able to remove from the system and plugged anytime into the system. (it doesn’t mean that the system should run without service. It means that it should not depend on another service). Another critical factor you should consider is service resilience and fault tolerance.

Ex:(if there is a service cart and you invoke the service bill but the service bill has a timeout for this scenario, you should be able to maintain the failure situation). You need to consider failure mechanisms when you implement microservice.

In monolithic application starts everything at the beginning it self where as the micro services you require to make sure all the services are up and running for the application to run.

Advantages of microservice

  • When an issue is raised it is not required to read about other services since each service is isolated.
  • Very easy to migrate to any language or framework developers prefer (since servers doesn't have any dependency)

Disadvantage of microservice

  • very hard to monitor the application
  • Not every easy to test since the services are isolated therefore it is much harder to integration testing compared to monolithic .
  • Distribute complexity
  • When versioning or deployment are required it requires to pay attention because dependent services will be in trouble

Thanks for reading the article hope you enjoyed it. If you do require any additional support for code, go through my GitHub link — https://github.com/KavindaPereraa/

References

Web application to Microservices. GO or NO GO — YouTube

What are Microservices? | SmartBear

What are microservices?

--

--