May 4, 2016 | Written by: Abtin Assadi
Share this post:
Microservices are an architectural approach to creating cloud applications, where each application is built as a set of services. Each service runs in its own processes and communicates through application programming interfaces (API).
Services are built around specific business logic, written in any language and they are independently scalable, upgradeable and deployable. When an application is broken up into its component services, changes only affect specific services. Likewise, each service can independently scale in response to demand without consuming unnecessary resources.
Here’s some history on how we’ve moved to using the cloud as a platform: International Data Corporation (IDC) has outlined a generational shift in IT patterns called the First, Second and Third platforms.
The First Platform is made up of mainframe, mini computers with terminals as the user interface. The Second Platform saw the introduction of PCs, LANs, client-server architecture, and the Internet, with PCs as the main user interface devices. The Third Platform, cloud native, is the domain of mobile, cloud, big data and social. The majority of user interactions there take place through mobile devices.
Each succeeding platform makes different architectural choices to meet the challenges of scaling and reliability models.
- The First Platform has custom hardware and software; it uses a centralized software architecture and scales vertically to serve thousands of apps and millions of users.
- The Second Platform is based on enterprise hardware and software. Client-server software architecture and vertical scaling are used to serve tens of thousands of apps and hundreds of millions of users.
- The Third Platform employs distributed software over horizontally scaling commodity hardware, the distributed nature of which enables linear scaling to serve millions of apps and billions of users.
Though there are many differences between the Second and Third platforms, the fundamental shift from enterprise to low-cost commodity hardware ushers in a level of cost advantage that makes large-scale cloud infrastructure possible. However, the shift from reliable enterprise hardware to a commodity alternative pushes the resiliency requirements from the underlying hardware up to the enterprise application.
Historically, enterprise applications were built as monolithic units in three main tiers: a client-side user interface, a database, and a server-side application.
The server-side application would handle HTTP requests, execute business logic, store, retrieve and update data from the database, and populate the client-side interface. The application was a single, logical executable. Any changes to the system involved building and deploying a new version of the server-side application. As more applications were deployed to the cloud, changes to any part of the application would cause the whole application to be rebuilt and redeployed. More resources were required to scale the entire application than the necessary portion of the application that needed scaling.
Cloud-native applications must be designed so that they can tolerate service failures. When a service fails, the application must respond as gracefully as possible. Thus, microservices require a sophisticated monitoring and logging setup for each individual service. It’s important to quickly detect failures so you can restore the service or substitute another, similar service.
A microservices-based architecture promotes an “API First” approach, decoupling APIs from their implementations for more agile development. It also works well for the continuous delivery software development process.