Using microservices to improve the software delivery process
Many organisations are still creating business applications that are monolithic in nature; apps that are built as a single solution usually with a front-end (web, desktop or mobile), server-side code routing requests for data through a business layer into a database.
What happens if, for example, you want to change the way a customers name is displayed in the UI? Or what if you want to change the validation that happens when an order is placed? With this architecture you have to deploy the entire application, from database level all the way up to the UI. That doesn't seem like the best approach, does it, particularly with large-scale enterprise applications?
The Monolithic Architecture
Every application starts out small, but over time new features are added causing the application to get increasingly large. Eventually we end up with huge monolithic applications that:
- Become difficult/impossible to move away from (re-develop or replace)
- Become too large to maintain effectively (firefighting)
- Rely on obsolete code, frameworks or third party components (difficult/impossible to update)
- Become difficult to deploy on a regular basis (they end up with releases that have to be planned months or even years in advance)
The Microservice Architecture
So how can we make this easier to work on? With a microservice architecture we break the system into smaller, discrete, easily manageable components. Each component in a microservice architecture is a small standalone application that's dedicated to a single area of functionality and that can be enhanced and deployed separately from other components in the system.
In the example architecture shown above, the individual components are clear. We can see that there are the UI components; the mobile apps, desktop and web user interfaces. These UI apps call into specific microservice APIs for the appropriate data; if the app wants to update customer information, it will make calls into the customer API. If the app wants to create an order then it will make call into the product API so that the customer can choose what they want and then post the completed order into the orders API.
The microservice architecture is an architectural style that structures an application as a set of services that are organised around business capabilities. - Chris Richardson, Technical Author
How Does This Make Things Easier?
Let's say that the mobile app team want to add a feature to allow mobile customers to upload their photo and add it to their profile. The customer API can be updated and deployed to the production environment without any other component (even the mobile app) being changed. All that the test team need to check is the customer API. In the past, the entire application would have to be checked to make sure nothing had accidentally been broken and changed unintentionally during deployment.
What this means for the product team is that it's now possible to make small, regular changes to specific components. In larger companies, individual teams can be assigned to maintain and develop individual components in the system.
Should Every Solution Use MicroserviceS?
Adopting a microservice architecture allows organisations to innovate faster by delivering software faster, more frequently and more reliably. However, it isn't a silver bullet. Many smaller applications may still work better as a monolith; for example, if you application only makes a dozen or so calls into your business database, having multiple microservice API's is just going to be an additional maintenance overhead.
There are potential pitfalls when creating a microservice architecture so things need to be planned out beforehand to make sure these are avoided. Skills within the development team such as object-oriented design, writing clean code and automated testing are essential in getting things right. Start small, deliver, review and change the things that haven't worked! Just ploughing ahead regardless of the outcomes is a recipe for disaster.
There's no doubt that the cloud and modern software development tooling have made developing and deploying a microservice architecture easier than ever. Make sure that you have a team with the right skills and you'll enjoy the benefits of microservices while enabling your organisation to grow for the future.