What are the benefits of microservices and how can you best deploy them
Top companies are transitioning to microservices
In the past couple of years microservice architectures have risen to prominence. Leading technology organizations, from Netflix to Facebook, are using microservice architectures to ensure they have the flexibility and nimbleness to rapidly adapt and respond to their customers. Already in 2015, research from Gartner found that 68% of organizations were using or investigating microservices. This rise in prominence reflects the shift to smaller lightweight applications, from large, code-heavy applications (or monoliths as they are commonly referred to) which were the norm just a few years ago.
Application architects are no doubt already familiar with microservices, but here we want to examine them from the perspective of a business executive. What are they, and what do they mean for your business?
Today’s challenge of increasing complexity
Software applications play a key role at the heart of today’s businesses – they define how your organization interacts with, and engages with customers. Due to the importance of certain applications to your business, it is likely that you have dedicated significant resources to your development team, and the team is working on deploying features and functionality to the application on a regular basis. The challenge with this very typical approach is that the application will quickly grow in size and complexity.
So if there is a problem, or a new feature does not work as you expect, then trying to diagnose and find the problem can be tough when applications start consisting of thousands of lines of code. Which part of the code of this increasingly complex application is causing the problem? As a result, you then spend significant time and resources trying to fix it, which has a knock-on impact on future releases. Before you know it, you’re constantly fighting fires rather than implementing the new services, features, and innovation that your customers want.
Microservices help reduce complexity
Without going into the technical detail, we can think of microservices as a modern, smaller software architecture, where the full application is put together using smaller independent parts. These different services then communicate via APIs. This means typically you don’t need much, if any, middleware. Sam Newman, the author of Building Microservices, describes them simply as “small autonomous services that work together”. Josh Evans, former Director of Engineering at Netflix, uses the analogy of organs in a human body – that each organ has a purpose, and then those organs form a system, and ultimately you have a human body. Taking that analogy further, if there is a problem with an organ, your liver for example, it is easier to fix just a small part or have a liver transplant, than heal your entire body.
Additional benefits of microservices
While getting a grip on the complexity of today’s applications is a major reason for implementing a microservice architecture, they also have a variety of other benefits. These include:
- Lower risk when transitioning to a cloud-model. Many organizations need to port existing software products to a cloud-based model. Here, the software product in many cases needs to be extensively re-written for a cloud-first environment. Often it makes sense to use this opportunity to implement microservices, as you can then gradually transition the application to the cloud, rather than undertake a more risky and complex migration. It’s important to note though that to achieve this kind of transition to cloud microservices, you need database models 100% decoupled from each other. Sometimes organizations have shared the same database model for different microservices, which is discouraged.
- Flexibility and popularity amongst developers. In a microservices architecture there is greater flexibility because if you want to add a new feature for example, you do not need to re-write the code for the whole application. Microservices are also popular among developers because they are working with a smaller, and easier to handle code base. It’s worth mentioning that there’s nothing impeding developers having the same base code between microservices, but a good strategy is to handle them as versioned and “decoupled” modules, so each microservice can depend on different versions of the same module. That gives developers the flexibility to improve base code modules without affecting other microservices.
- Each microservice can find the most efficient way to store data. In this new model, each individual microservice needs its own database (this is an oversimplification, but the principle of not sharing persistent data remains). While this can also cause complexity, it also means that each microservice can store its data in the most effective way for that particular service. In addition, in a monolithic approach, where your application has just one database and the logic is located in just one place, then if one part of your product goes down, or it suffers from an attack, then your whole software product can no longer be used by your customers.
DevOps, automation, and Agile development are core pillars of microservices
Microservice architectures are complex, and many organizations struggle when trying to get started with them. If your organization is not already familiar with, or using, techniques such as Agile development methodologies, DevOps, and automation, then be hesitant about going directly to microservices. Those organizations already familiar with them will find the transition much easier, because:
- Microservices and Agile development are a natural mix. One of the key benefits of microservices is that small teams work together focused on one specific element of the application. Small teams of 6-8 people define Agile development, and provide the empowerment and flexibility to work efficiently and meet business demands. Meanwhile, making sure your quality assurance (QA) experts are involved in development, from Sprint 0, will help ensure quality is built into the product.
- Automation is the only way to handle deployment releases within microservices. It’s why enterprises have increasingly turned to platforms such as Docker, which automate the deployment of applications within containers. Meanwhile, there is also a need for on-demand provisioning, such as that provided by MongoDB or Amazon’s DynamoDB.
- A devops culture will be core to your success. In a microservices environment you will be deploying smaller releases much more frequently. One of the main reasons for taking the approach is so that you can deploy faster, and more quickly respond to business requirements and what your customers are demanding. A devops culture means your team is used to quickly deploying smaller releases (micro deployments) and the necessary collaboration this requires. And as you release faster, keep in mind that a good product is one that is live. Meanwhile, if we look beyond this and consider a serverless approach, here you will need less or no devops because being serverless means developers control how much computing power can be used.
How to deploy microservices: Servers, containers and serverless architectures
The three options for deploying microservices are server-based, using containers, and finally serverless architectures. Within these three options, there is currently a fascinating debate between containers and serverless architectures, which we will explore more deeply shortly.
From a business perspective it is important to understand at a high level what are some of the key pros and cons of the different approaches to deploying microservices. When making the decision, ultimately you want to be able to deploy quickly and cost effectively. Let’s examine briefly what they are, and their pros and cons.
- Server-based – a “traditional” approach for applications, but here a poor choice. Some organizations may have concerns about shifting to not just microservices, but then also adopting containers or serverless architectures. However, while it is technically possible to run microservices on a physical server, or run virtual machines on your servers on which you then run microservices, most organizations prefer to use containers or take a serverless approach.
- Containers are a popular choice. At a high level, containers are a simpler (lighter) version of a virtual machine. So instead of needing a separate virtual machine for each application, you can simply use application containerization. They are a popular choice, and there is a relatively large, stable market. Interest in Docker (the Docker platform provides an easy way for developers to build and deploy their applications) has skyrocketed over the past couple of years. Kubernetes is a popular open source system which more and more enterprises are using in conjunction with Docker, to help manage microservice deployments. Containers offer you a steady environment for your application, and offer significant performance benefits over virtual machines. They represent a great choice when you need to constantly synchronize data. Developers can build them relatively easily, and they require less infrastructure support than virtual machines.
- Serverless architectures – the wild west? Serverless computing (or function-as-a-service, FaaS) is a form of cloud computing, where you as the business rely on a 3rd party provider for server provisioning. You deploy the code to a FaaS provider, and they do the rest. Amazon Web Services (AWS) Lambda is one of the best known vendors. From a business perspective, one of the major advantages is cost – if you use a service like AWS Lambda, you only pay for when your code is executing – or in other words when you are serving your customers. Another major advantage is that developers spend less time thinking about how to deploy the application, and more time about what it is they want to build. However it’s important to note that there is still no open standard for serverless architectures, as there is for containers. Some industry observers have therefore called serverless “the wild west”. In addition, in practice, it is more complex than simply uploading your code and letting it run. The market is still maturing.
Conclusion – Winning companies are rapidly moving to microservices
Microservices represent a fundamental shift in technology and the options that are available to you. This is why business executives are exploring their potential and how they can impact the services they deliver to customers. While software architecture can be an intimidating topic for non-technical individuals, software applications now lie at the heart of your business. Their performance, resiliency, and nimbleness directly translates to business metrics such as customer satisfaction, and ultimately revenue. This is why winning companies like Nike, Netflix, and Amazon, are rapidly moving to microservices architecture.