‘Microservices’ are a fairly recent addition to the software engineering buzzword dictionary. Introduced around 2012, it has steadily gained in popularity. Even enterprises like Amazon, Netflix, Uber, and Etsy have adopted microservices architecture to achieve scaling advantages, business agility, and profitability. But what is ‘microservices’? And, what are the pros and cons of adopting them?
What is Microservices Architecture?
Simply put, “microservices” is a way of organizing software where applications are divided into small, independent services. This is different from the “monolithic” approach, where one service or process handles everything. Microservices are like a more detailed version of the “service-oriented architecture” idea, with each service being very specific and communicating in a straightforward way. It’s like taking the idea of breaking down functions in programming into different classes or libraries and applying it to the level of services. This methodology ties closely to DevOps style workflows.
Uber and Microservices Architecture
As an illustration, let’s look at Uber’s microservices architecture. Initially, Uber adopted a monolithic design. But, the shift to microservices came shortly after the ride-sharing giant encountered growth challenges associated with its monolithic application structure. Basically, the monolith posed difficulties in efficiently developing new features, addressing bugs, and integrating the rapidly expanding global operations of the platform. Additionally, the complexity of Uber’s monolithic architecture demanded extensive developer expertise to implement even minor updates and changes.
Uber’s original system was a monolithic structure where passengers and drivers interacted through a REST API. This setup relied on three adapters with built-in APIs for tasks like billing, payment, and text messages, all connected to a MySQL database. However, as Uber’s popularity grew, this design became problematic and resistant to changes, posing challenges for developers.
So, to overcome these issues, Uber opted to transition from the monolithic model to a cloud-based microservices approach. In this new setup, developers created separate microservices tailored for specific functions, such as managing passengers, handling trips, and incorporating additional features. Thus, Uber established communication between these microservices using an API gateway, allowing for a more flexible and scalable system compared to the original monolithic design.
Top Advantages of Microservices
Advantage 1: Microservices are Independent
Firstly, within a microservices architecture each service is developed and deployed independently from all the other services. That means an update to any one component does not require the entire application to come down to deploy an update – only the component in question. So, this allows for improved uptime and safer deployment processes.
Advantage 2: Microservices are Targeted and Small
Similarly, just as services are developed independently, a microservices architecture makes it easier for different portions of an application to be implemented using different languages. This is desirable when a particular language is better suited or targeted at a given task. Plus, this also helps DevOps engineers (and developers) to troubleshoot as systems are isolated.
Advantage 3: Microservices are Flexible
Thirdly, since all communication happens over the network instead of within the same in-memory process, there is more flexibility in terms of how each endpoint is composed. This also makes it easier for teams that have different skill sets to contribute to a project without spending time learning a new language or operating outside of their areas of expertise.
Advantage 4: Microservices Make Modern Applications Robust
Applications using microservices architecture are more robust as a whole. When there is a loose coupling between services, if any service fails, there’s a greater chance the application as a whole can continue to provide value to users. The robustness depends on the nature of the services, how they interact and whether the application is designed with fault-tolerance.
Top Disadvantages of Microservices Architecture
Disadvantage 1: Moving to Microservices May Require Refactoring
While a microservices architecture can offer advantages when the behaviors of different components are well-defined and easily separable, challenges arise when the initial understanding of the relationships between these components is flawed.
If an application has been implemented in a microservices style with a misunderstanding of the proper relationships between components, refactoring becomes more challenging compared to a monolithic structure. That means coordinating interface changes across multiple teams becomes necessary, and the process of moving functionality from one service to another is no longer as straightforward. Plus, the potential benefits of using different languages for various components may not seem as advantageous when the need arises to port functionality from one service to another.
Therefore, Microservices offer benefits, but success depends on well-designed relationships between services, emphasizing the importance of proper architecture understanding. Addressing these challenges may require additional strategies and considerations. Contact our team to learn more about strategies to refactor legacy applications into more modern methods.
Disadvantage 2: Microservices Architectures Can Be Complex
As previously stated, splitting an application into multiple independent services generates more artifacts to manage with potentially diverse deployment processes. This can increase the complexity of deploying the entire application at once. For those systems such as Amazon.com or Netflix, the scale can make an architectural diagram extremely blurry. Plus, it’s also said that no single individual at Netflix can fully explain how all the technology fits together. Understandably, this can scare many technology executives who are used to having a few really intelligent engineers knowing all architecture and systems.
Disadvantage 3: Increased Cost for Testing Environment
Spinning up test environments is more involved with microservices due to the increased number of nodes required. Basically, this is why microservices is normally discussed with cloud environments, as testing can require resources to be spun up, but then turned off or destroyed when not needed. Still, this can increase costs as more resources are needed to test changes.
Disadvantage 4: Performance “Could” Be Impacted
Another area potentially impacted is overall performance. For example, communication over a network is considerably slower than in memory. For many applications, this may be negligible, particularly as network speeds improve. However, it’s clearly something to be taken into consideration.
Additionally, the design of an application needs to be skewed towards asynchronous behavior. This is neither inherently good nor bad but represents a potential challenge if trying to convert the design of an existing application.
Is Microservices Right For You?
In conclusion, microservices represent a more modern style of application architecture. From a DevOps perspective, microservices present a mixed blessing, offering easier and less risky deployment of individual components but heightened complexity in management. SPK’s team has experience with clients moving from monolithic to microservices, along with companies needing to start a new service using a microservices approach.