What Are Microservices, Actually?
What do microservices really mean? How do they differ from previous development architectures? Read about their structure and advantages.
Join the DZone community and get the full member experience.Join For Free
Over the past few years, a lot of people have used the term “microservices” either to try to explain their system’s or application’s setup or just to brag about how trendy they are in the tech world. I believe everyone from the tech industry should know at least the fundamentals, because microservices are the future of development. And if you don’t believe me, I have the word of the President of SAP to back me up. But what are microservices, actually?
First, to be precise, when talking about microservices, we are actually referring to a microservice architecture. This architecture type is a particular way of developing software, web or mobile applications as suites of independent services – a.k.a microservices. These services are created to serve only one specific business function, such as: user management, user roles, e-commerce cart, search engine, social media logins, etc. Furthermore, they are independent of each other, meaning they can be written in different programming languages and use different data storages. The centralized management is almost non-existent and the microservices use lightweight HTTP, REST or Thrift APIs for communicating between themselves.
Naturally, some people will ask: Hey, isn’t that same as SOA? In a way, you could say that microservices finally achieved what Service Oriented Architecture wanted to in the first place. However, there are still differences between the two types of architectures. Classic SOA is often implemented inside deployment monoliths and is more platform driven, while microservices must be independently deployable and therefore offer more flexibility in all dimensions. The key difference of course is the size, the word micro says it all – they tend to be significantly smaller than regular SOA is. As Martin Fowler says, we should think about SOA as a superset of microservices.
That being said, we do not look at microservices as revolutionary breakthrough, but more like a natural next step in the evolution of software development.
Advantages of Microservices
Following the trend of modularity in the physical world (PC’s hardware, IKEA furniture, automobiles, etc.), the idea behind microservices is to allow developers to build their applications from various independent components which can easily be changed, removed or upgraded without affecting the whole application – as is not the case with monoliths. This can be considered one of the major benefits of this new type of architecture. On top of that, after creating a certain microservices (e.g., File Uploading service), a developer can reuse the code for many other projects that have the need for the same function.
Another important characteristic of microservices, is that unlike monolithic applications where teams are defined by the different layers of the app: user interface, server-side logic, database logic and so on - it allows companies to construct teams around specific business capabilities. This in turn makes teams cross-functional and with a larger set of skills: user experience, database management, project management etc. This brings us closer to the era of DevOps.
The decentralized governance of the services, enables developers to use different programming language, depending on what they believe is the best one for the specific business function the microservice is built around. This also means that they can use separate data storages, bringing us to the biggest advantage of this architecture – the practically unlimited scalability. Having hosted each microservice at a different location allows you to scale only the function you have a need to, instead of creating double instances of the whole application every time. This in turn saves you both time and resources.
When talking about microservices, it is inevitable to mention containers. Containers are designed to be pared down to the minimal viable pieces needed to run what they were meant to, rather than packing multiple functions in the same physical or virtual machine. That being said, containers are just tools that might ease deployment, so it is not impossible to build an application following the microservice architecture without containerization.
To sum up, the goal of microservices is to ease the building, maintaining and managing of an application by breaking it down into smaller, composeable pieces which work together and can be independently deployed, upgraded, removed or scaled whenever the need arises.
Published at DZone with permission of Kristijan Arsov. See the original article here.
Opinions expressed by DZone contributors are their own.