DEV Community

Cover image for What are microservices?
Rohit Patil
Rohit Patil

Posted on

What are microservices?

Overview

Microservice architecture, or simply microservices, is a unique approach to constructing software systems that focuses on creating single-function modules with well-defined interfaces and activities. In recent years, the practice has gained traction as businesses strive to become more agile and move toward DevOps and continuous testing.


Microservices Have Six Characteristics

1) Routing Made Simple

Microservices work in a similar way to traditional UNIX systems in that they take requests, process them, and respond appropriately. This is in contrast to how many other products, such as ESBs (Enterprise Service Buses), operate, which rely on high-tech systems for message routing, choreography, and the application of business rules. Microservices contain smart endpoints that process data and apply logic, as well as dumb pipes through which data flows.

2) Resistance against Collapse

Microservices, like a well-rounded child, are built to deal with failure. Because numerous distinct and disparate services are talking with one another, it's likely that one of them will fail for whatever reason (for example, when the supplier is unavailable). In these cases, the client should enable its nearby services to continue to function while it gracefully exits. Monitoring microservices, on the other hand, can assist mitigate the risk of a failure. This necessity, as comparison to monolithic systems architecture, adds greater complexity to microservices.

3) Decentralized

Considering microservices use a range of technologies and platforms, traditional centralized governance solutions aren't ideal. The microservices community prefers decentralized governance because its developers try to create helpful solutions that may be used by others to tackle similar challenges. Microservice design, like decentralized governance, encourages decentralized data management. Monolithic systems make use of a single logical database for all applications. Each service in a microservice application generally has its own database.

4) Numerous Components

Microservices software can be split down into several component services by definition. Why? So that each of these services may be deployed, changed, and then re-deployed without jeopardising the application's integrity. As a consequence, rather than needing to reload complete apps, you may just need to modify one or more specific services. However, there are also drawbacks to this technique, including the cost of remote calls (rather than in-process calls), coarser remote APIs, and more complexity when transferring responsibilities across components.

5) Evolutionary

Microservices architecture is an evolutionary design that is suited for evolving systems in which you cannot fully foresee the sorts of devices that may one day contact your application. Many systems begin with a monolithic design, but when new requirements emerge, they may be gradually updated to microservices that connect with an earlier monolithic architecture via APIs.

6) Designed for Business

Microservices architectures are often organized around business capabilities and goals. Unlike a typical monolithic development strategy, in which various teams specialize in, say, user interfaces, databases, technological layers, or server-side logic, microservice architecture employs cross-functional teams. Each team's tasks are to create specialized products based on one or more separate services that communicate via message bus.


What Are the Advantages of Using Microservices?

There are several advantages of employing microservices. Some of them are concerned with how they enable your developers to write code. Your architecture is influenced by others.

Microservices are tiny apps developed independently by your development teams. They are not dependent on the same coding language because they communicate mostly through message. Developers can use the programming language with which they are most comfortable. This allows them to do their task more quickly, at a cheaper cost, and with fewer defects.

Your teams' projects are more agile since they are working on fewer apps and more defined problem areas. They can iterate more quickly, handle new features on a shorter timeline, and repair bugs practically instantaneously. They frequently discover new possibilities to reuse code.


How Are Microservices Deployed?

Microservice deployment necessitates the following:

• Ability to expand several applications at the same time, even if each service has a different amount of traffic; and • The ability to quickly construct microservices that can be deployed independently of others.
• Failure of one microservice must not have an impact on any of the other services.

Docker is a common method for deploying microservices, and the stages are as follows:

• Package the microservice as a container image; • Deploy each service instance as a container; and • Scaling is accomplished by adjusting the number of container instances.

The use of Kubernetes in conjunction with an orchestration system such as Docker in deployment allows for the administration of a cluster of containers as a single system. It also enables businesses to execute containers across different hosts while offering service discovery and replication management. Kubernetes is frequently used in large-scale deployments.


Thank you

Stay tuned for upcoming blogs

Top comments (0)