Efficient software reuse has always been a vision for software developers and integrators, since it is considered as one of the factors that can boost productivity and reduce software development costs. In earlier days, reuse was limited to technical components, while more recently it has been expanded to business components and services. Component-based programming paradigms such as EJB (Enterprise Java Beans), along with approaches for developing business services such as SOA (Service Oriented Architectures) have gained popularity, due to their ability to boost application assembly based on reusable business components and services. Nevertheless, these paradigms have rather limited scalability, as they still rely on components that cannot scale without limitations and in a cost effective fashion.
During the last couple of years developers have been able to leverage more scalable approaches to developing applications based on distributed components, thanks to the emergence of microservices and microservices architectures.
Microservices are small and modular business services, which are deployed independently and communicate with each other based on lightweight mechanisms and protocols. Each microservice runs its own process and is therefore able to scale independently from the rest. Communication between microservices is usually based on mainstream protocols, such as HTTP/REST, even though the details of the communication are always dependent on the application requirements.
Contrary to conventional client-server applications that tend to be monolithic and thus not flexible to change, microservices-based applications can be revised based on changes to specific microservices rather than on the application as a whole and hence are much more adaptable and agreeable to change. Moreover, they provide the possibility to scale specific business functions without a need to scale the entire application. That’s very different from conventional programming models and architectures such as SOA.
In most cases, microservices architectures are deployed in the cloud and in conjunction with NoSQL databases, which makes them suitable for a wide range of applications including mobile applications, Internet of Things (IoT) applications, wearable applications, as well as applications that deploy hybrid combinations of different device types.
Microservices architectures are characterized by the following properties:
- Multiple Component Services: Microservices architectures comprise multiple independent components, which can be deployed, redeployed and scaled-up independently from each other.
- Business Components: The various components are in charge of complete business functions that deliver tangible business value (such as an order fulfillment process or a credit card authorization process). Microservices are about business functionalities rather than technical ones.
- Fully distributed operational and governance model: Unlike other component-based software techniques, microservices are independent in terms of the data layer that they use (e.g., each microservice is likely to have its own database). Moreover, microservices architectures enable teams to take advantage of microservices libraries that have been produced by third parties.
- Evolvable Systems and Architectures: Microservices architectures are ideal for building systems that are likely to evolve over time, especially in cases where the details of the evolution (e.g., the devices to be used) are not known. Also, new devices and functionalities can be easily integrated on the basis of the development and use of new microservices that will communicate with the pre-existing ones.
- Agility: The evolutionary nature of microservices architectures, along with their scalability, modularity and adaptability to changes, makes them ideal for supporting agile software engineering approaches. Indeed, the above-listed properties are fully in-line with the iterative, evolutionary and flexible nature of agile software engineering, which has been described in one of our earlier posts. Furthermore, both agile approaches and microservices are product rather than project focused, which makes them very popular within companies that build high-tech ICT-based products.
Empowering DevOps with Microservices
The rising popularity of microservices is also due to its alignment with DevOps approaches to software systems development and deployment. DevOps stands for Development and Operations and emphasizes on a holistic iterative approach which streamlines the build, validation, deployment and delivery stages of state-of-the-art software systems. By combining development with operations in the scope of cross-functional teams, DevOps addresses one of the major challenges in software systems development, which is the proclaimed gap between development and quality assurance (QA) teams. The delegation of software development and quality assurance in different teams has always been a cause of tension and problems in the software production and deployment processes, as each one of the two teams tends to blame the other in case something does not work. DevOps alleviates these problems by enhancing agile software engineering processes with deployment operations, which are always essential to producing a working product.
Microservices are an ideal technology for DevOps not just because of their deployability, reliability, availability and scalability properties, but also as a result of their flexibility in implementing and deploying changes. Based on these features a microservices architecture enables shorter cycles for building, testing and deploying software products. Furthermore, microservices make it easy to deploy (and redeploy) the product based on a variety of different configurations (e.g., security or persistence configurations), which is at the heart of a DevOps approach. Likewise, a microservices architecture is less susceptible to faults, as the latter are likely to impact only one or a subset of the microservices rather than the whole application. Overall, microservices provide flexibility in both development and operations, along with a set of popular tools that facilitate their monitoring and deployment.
Maximizing Productivity with Microservices
Microservices architectures provide a compelling value proposition as outlined above. Nevertheless, they are also associated with numerous challenges. Some of these challenges are:-
- Complex and tedious testing,
- Architecture and integration complexity,
- Fault tolerance,
- Network latency,
- Sophisticated handling of distributed transactions,
- The need to optimize memory consumption and more.
Furthermore, it is not always easy to partition an application in microservices, as this can in several cases, be more art rather than science. Given these challenges the efficient implementation of a microservices architecture requires expertise in DevOps, intense monitoring of the microservices and also thorough planning that can effectively deal with any complexities and also meet the desired business goals.