Over the past few years there certainly has been a lot of hype and discussions regarding Microservices.
What originally was nothing more than a side note in a discussion on Service Oriented Architecture (SOA) has resulted in the whole software development industry up and the ante and really peddling Microservices as the cure for mostly any software development ailment!
One of the issues surrounding Microservices is that nobody really has a clear definition of what they are and really why they are really useful. Martin Fowler, has attempted to provide a definition, which serves as a great piece when talking engineer to engineer, However in my opinion and experience it doesn’t really provide a definitive job when attempting to explain microservices in the board room.
I have found several explanations on Microservices, that all too often start getting lost in the weeds on the technical implementations and software engineering jargon.
I faced one of those unenviable tasks of explaining Microservices and why they would be particularly useful in addressing a particular challenge for a customer. My target audience were mostly Marketing, Sales, Accounts and other business areas focused.
I had to provide a presentation to explain why the businesses current e-commerce and content management systems were starting to impact performance and why a gradual migration to a Microservice and SOA architecture would enable the business to respond and adapt to change.
I did what most engineers would do in this case, and hopped on my Bicycle for a long ride and time to think.
It suddenly dawned on me that a Bicycle is a perfect example to illustrate and explain the concept of Microservices in action!
Monolith to Microservice
At first glance a bicycle may at first appear to be a Monolith application, but a little closer look, we can see it’s actually an entire application that is composed of small components, all with individual tasks.
In fact an average bicycle can consist of over 893 individual components.
Understanding the Microservice architecture
Ask any number of cyclists what makes a good bicycle and you’ll more than likely never get a definitive answer. The same applies when you ask any number of software architect what defines a good microservice architecture, you may get a number of different opinions.
There is no formal definition of the term microservices, there’s no standard model that you’ll see represented in every system based on this architectural style. However, you can expect most microservice systems to share a few notable characteristics.
Software Solutions should be broken down into multiple component services
The key concept here is that each component can be deployed, tweaked, and then redeployed independently without compromising the integrity of an application.
Just on a bicycle you can change any number of the components. i.e. Change the handle bars, chain or even wheels. Just as long as they conform to the predefined contracts i.e. Bolt or nut sizes etc. It won’t compromise the integrity of the system , as in the bicycle can still function as a bicycle.
Microservices focus on business capabilities and priorities
Microservice focused teams are generally cross-functional teams. The responsibilities of each team are to make specific products based on one or more individual services communicating via message bus.
Microservices are technology agnostic
Decentralized governance is favored by the microservices community because its developers strive to produce useful tools that can then be used by others to solve the same problems regardless of technology implementation. microservice architecture also favors decentralized data management, whereby each each service manages its own unique service database.
Microservices are designed to cope with failure.
Each service is designed without any external dependency on any other service. It is designed to only operate on any inputs and outputs as desired. Therefore if any service in the chain fails or dies, it does not necessarily bring down any of the services, the services are free to service any other requests which are directed to them.
What is a MicroService ?
The name microservice can be a little misleading. The name implies microservices are either small little entities desgined to execute tasks on behalf of a big application or a vast swarm of little bugs that self-replicate through the consumption of energy and are able to disintegrate any software they come into contact with! The truth is they are neither!
The micro in services refers to the scope of the functionality that the service provides i.e. business or platform capability through a well defined API, data contract and configuration. It provides the function and only that function. It is really good at doing one thing and one thing only.
Properties of Microservices
Microservices have a number of distinct properties which provide tangible benefits to software development teams
- AutonomousExist, react and developed independently
- Isolated – Seperate from others, executing in different places and different times
- Elastic– Can be scaled depending on need
- Resilient – Minimize downtime if outages occur
- Responsive -Quick to respond or react
- Message-oriented -Connects separate systems in a network by distributed messages
- Programmable – Tasks are done in order to achieve a specific result
- Configurable – Designed to adapt to form a specific configuration or for specific use cases.
- Automated – Controls that allow to operate without human intervention
Dividing a software project or solution into it microservice component and treating them as seperate development efforts increases the speed of development and reduces the cost of development.
The environment in which you deploy your microservices must provide dynamic scale and high availability configurations for both stateful and stateless services. This is achieved by leveraging a cloud pltform such as Azure , AWS, Heroku etc.
Microservices are reused across a number of different solutions and therefore must be able to scale appropriately depending on the use case. They must be fault tolerant and provide a reasonable timeframe for recovery if an issue arises.
Microservices rely on API’s and data contracts to define how interaction with the service is achieved. The API defines a set of network-visible endpoints and the data contract defines the structure of the message that is either sent or returned.
Microsservices must however provide more than jsut an API and a Data contract. Each microservice will have different levels of configuration and the act of configuring may take different froms. For a microservice to be resuable and address the needs of each system employing its capabilities they must proivde a means by which it can be molded to suit the use case it needs to satisfy.
The life-cycle of a microservice should be fully automated, from design through to deployment.
Benefits of Microservices
An organisaton can evolve to microservice architecture one service at a time
Designed to expose thier functionality through industry standards for network-addressable API’s and data contracts and hosted on highly scalable, elastic resilient cloud platforms
- High Velocity
Microservices can be developed extremely quickly with one team focusing on every aspect of the service
- Reusable and Composable
Microservices are not beholden to any one solution. Independent entities providing a business or platform capability and exposing that functionality through open internet standards.
Deployment of microservices are defined by their automation
- Versionable and Replaceable
It is possible to have multiple versions of a microservice running side by side, providing backward compatability and easy migration.
- Owned by one team
Cross-functional teams are formed with the purpose of owning the Microservice product lifecycle. Design through to support
If we go back to the bicycle example, you’ll notice that each component of the bicycle need not be manufactured by one particular manufacturer, but there may be very many different manufacturers supplying parts and components for a bicycle all agreeing to conform to specific standards and contracts – API’s & Data Contracts. Any component may be replaced on a bicycle without losing the integrity of it use case, although some would argue that this cannot be done at runtime without issue.
It is possible to assemble your own custom bike, entirely from sourcing your own custom components. The options are endless from a Custom balance bike for your child right through a high end custom bike to win the tour de france.