In this short post, we will get an introduction to microservices. We get an answer to a popular question “what are microservices?”
Microservices is a software development technique that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight. Microservice is an architectural style in which complex system is decomposed or broken down into smaller services based on the functionality that work together to form larger business services.
“Microservices – also known as the microservice architecture – is an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.”
@Chris Richardson, Microservices.io
In other words, Microservice architecture consists of small and autonomous services. Each service self-contained and independently deployable which means breaking a large application into loosely coupled modules. Microservices are not inverted, rather they are evaluated from the previous architecture styles such as MONOLITHIC Architecture.
Here are some of the advantages of designing our application based on microservices architecture.
Microservices are more complex than legacy system. In turn, the environment becomes more complicated because services have to manage, secure, monitor and support.
Here is a high-level overview of microservices.
Communication between microservices can be designed either in SYNCHRONOUS or ASYNCHRONOUS styles. In general, microservices communicate with each other using widely adopted lightweight protocols, such as HTTP and REST, or messaging protocols, such as JMS or AMQP. In specific cases, one might choose more optimized communication protocols, such as Thrift, ZeroMQ, Protocol Buffers, or Avro.
It is not possible to develop a system with just one approach. A combination of both approaches is required based on the use cases. In principle, the asynchronous approach is great for microservices. However, attempting to model everything as asynchronous leads to complex system designs.
The one microservice can be deployed in one or multiple Virtual Machines (VMs) or physical Machines by replicating the deployment for scalability and availability. Multiple Microservices can be deployed int one VM if the service is simple and the traffic volume is less.
In case of cloud infrastructure, the developers need not worry about where the services are running. Services will be deployed in a compute cloud, the infrastructure self-manages deployments. Cloud infrastructure is the best option if origination contains hundreds of microservices.
In this post, we got a basic understanding of microservices. We get understanding of what are microservices and core principles for building microservices. We covered the architecture as well the challenges while working with these services.