By: Shankar
September 27 2018

Power Of Microservices Architecture In Drupal Development

One of the reasons why The New York Times is able to catch up to its growing user base is its inclination towards technological advancements. That was evident when it leveraged the power of microservice architecture via a remodelled video publishing platform to scale with their newsroom demands. They also moved their infrastructure to the cloud which resulted in a stable and scalable email platform, powered by a suite of microservices, for sending emails to the readers.

Illustration showing a back office of news media company with several people working and paper being circulated in the machines


Why are big enterprises like The New York Times leaning towards microservices? Microservices has grown exponentially and holds an astronomical future for the digital businesses. It will be interesting to see how traditional CMS like Drupal finds a place in the world of microservices. But before plunging into all that, one might wonder where did this ‘microservices’ thing originate from?

Tracing the roots in the UNIX world

New Relic has compiled an interesting and brief timeline of the evolution of microservices. Microservices has its roots in the Unix world that takes us back to more than three decades ago.

As a term, microservices was first documented in 2011 by Martin Fowler

Service-oriented architecture (SOA), a design principle where services are offered to other components by application components via communication protocol over a network, was all the rage decades ago. Due to a superabundance of failures and costly implementations, the SOA earned a poor reputation and took a backseat. Martin Fowler, among others, has said that microservices are a new spin on SOA.

As a term, it was first documented in 2011 by Fowler at a software architects’ workshop.

In 2012, a presentation was given by James Lewis at the 33rd Degree in Krakow which was titled “Microservices - Java, the Unix Way”. This delineated microservices as a means of building software more rapidly by dividing and conquering and used Conway’s Law to structure teams.

Since that time, the adoption of microservice architecture has grown and many organisations are going for microservices as their default style for building enterprise applications.

Understanding the terminology

Illustration showing four boxes with texts explaining microservices
Source: LeanIX GmbH

What are microservices? Microservices are an architecture for splitting a monolithic application into smaller pieces. Each of those pieces offers a certain function through a well-defined and carefully handled API.

The collection delivers the same overall business value like the monolithic application with the difference being these independently working individual pieces in microservices. That means they can be updated swiftly without impacting an entire application.

“The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies”. - Martin Fowler

"A microservice architectural style is an approach to develop a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API".

Netflix is an unsurpassed example of microservices adoption. It moved from a traditional development model with several engineers producing a monolithic DVD-rental application to a microservices architecture. Small teams could focus on the end-to-end development of hundreds of microservices that work together to serve digital entertainment to millions of Netflix customers every day.

Flowchart with the logos of amazon and etsy showing the difference between monolithic and microservices architectures
Source: LeanIX GmbH

The main difference between monolithic and microservices architecture, as can be seen in the depiction above, is that all the features and functionalities were under a single umbrella. That is, they were under a single instance sharing a single database. With microservices, each feature is allotted a different microservice, managing its own data, and performing a different set of functionalities.

How good or bad are microservices?

Illustration with boxes on left and right side showing challenges and solutions of microservices on the respective sides
Source: Logentries

The benefits of microservices are laid out below:

  • Autonomous deployments: You can update a service without having to redeploy the entire application and rollback or roll forward an update during mishaps. Fixing bugs and feature releases are much more manageable with fewer challenges.
  • Autonomous development: Building, testing and deploying a service would need a single development team leading to perpetual innovation and swift release cadence.
  • Small teams: Teams can lay their focus onto one service thereby simplifying the understanding of the codebase with the smaller scope for each service.
  • Isolation of faults: Downtime in one of the services won’t affect the overall application. This does not mean that you get resiliency for free.
  • Tech stack mixture: Technology that is deemed most fit for a service can be selected by the teams.
  • Scalability at granular levels: Independent scaling of services is possible.

Some of the challenges are outlined below:

  • Intricacy: More moving parts are there in microservice application than the equivalent monolithic application.
  • Development and testing: Developing against service dependencies would need a different approach and testing service dependencies is difficult particularly when the application is evolving rapidly.
  • The dearth of administration: The decentralised approach for building microservices may lead to numerous languages and frameworks thereby making it harder to manage.
  • Network congestion and latency: Usage of granular services can result in more inter-service communication. Chances are that if the chain of service dependencies gets too elongated, additional latency can be a challenge.
  • Data integrity: Data consistency can be a hurdle with each microservice responsible for its own data persistence.
  • Management: Correlated logging across services can become a formidable task.
  • Update issues: If not for a careful design, several services updating at a given time could result in backward or forward compatibility.
  • Team skill-set: As the highly distributed systems, microservices require a team with the right mix of skills and experience.

Taking Drupal into the context

Drupal is a monolith. How can it survive this trend of microservices? Drupal, being an amazing content management framework, provides a great content editing experience and has been pioneering digital innovation. With that being said, microservices architecture can be used for development and deployment of applications using Drupal. Let’s see how Drupal can put into the scheme of things.

Demonstration at DrupalCon Vienna 2017

A presentation held at DrupalCon Vienna 2017 demonstrated an effective way of integrating Drupal 8 in a microservices architecture.
 
Drupal 8 proved to be a useful content management framework for this implementing microservices architecture because of its:

  • Symfony components,
  • Composer to manage external dependencies,
  • and the magnificent results of the Web Services and Context Core Initiative (WSCCI).
     


It exhibited the delegation of asynchronous work from Drupal to a set of very reactive applications written in Go with some assistance of RabbitMq queues. Elasticsearch was leveraged as a common data storage between services and REST endpoints were exposed where the endpoints could notify back to Drupal.
 
Furthermore, methods of connecting websocket server to push and pull messages between services were shown. To run all these services in a controlled and replicable manner, services of Ansible and Docker were extracted.

Demonstration at Drupal Developer Days Lisbon 2018

Another session at Drupal Developer Days Lisbon 2018 delineated how the citizen portal of the city of Reykjavik (Iceland) was relaunched using Drupal and microservices.
 
With the incorporation of more than 100 web services ranging from simple services like registering a dog or renewing a driver’s license to the intricate services like the admissions of children to school or updating the residential address.


Powered by Drupal 8, this new portal integrates the services with a microservices architecture using JSON Schema as communication protocol. The microservices architecture was chosen to let centralised data collection and presentation in a single portal while simultaneously incorporating a heterogeneous landscape of services autonomously from one another.

Predictions ahead

Oracle’s Cloud Predictions 2018 report states that by 2020, the lion’s share of new applications will be powered by microservices architectures.

Open source has given a whopping push to the microservices architecture. Its several components support continuous integration and delivery pipelines, microservices platforms, containers, container management and orchestration, container registry service, and serverless capability.

Open source has given a whopping push to the microservices architecture

Adoption of cross-cloud containers like Docker and Kubernetes is on the upwards trajectory and developers consider an open cloud stack to prevent vendor lock-in.

A bar graph showing the CAGR of microservices from 2016 to 2023
Source: Market Research Future

According to a report on Market Research Future, the microservices architecture market is expected to reach $32.01 billion by 2023 with a Compound Annual Growth Rate (CAGR) of around 16.17% during the forecast period.

Another report on Research and Markets for the forecast period of 2017 to 2023 states that as far as the ‘Market Analysis’ is concerned, the rise in the cloud adoption is integral for microservices market. This is because the microservices architectures function on smaller and simpler services. Also, there is a high demand from North American companies as they have implemented it in e-commerce, financial, and travel services. This has helped in storing data and information cost-effectively and enhanced the efficacy, agility and scalability.

The report on Research and Markets has an interesting ‘Countries and Vertical Analysis’ vis-à-vis microservices. Most of the major players are in the American region with the prominent vendors covered in the report include the likes of Cognizant, IBM Corporation, Datawire, Salesforce, Infosys Ltd., MuleSoft Inc., and Software AG. Japan, the US and China are expected to witness a tremendous growth in microservices adoption.

Conclusion

Microservices architectures streamline the overall application development lifecycle leading to quicker testing, higher quality and more releases. Such an architecture can be hugely useful for efficient management of Drupal-based projects. Innovation has always been something Drupal is greatly supportive of. Adopting a microservice architecture for Drupal development is possible and is extremely fruitful.

Organisations should be wary of their digital business ecosystem and should understand the challenges that they might have to encounter during its adoption. Opensense Labs has been in the constant pursuit of bringing a positive change for our valued partners with our expertise in Drupal.

Contact us at [email protected] to know more about microservices architectures and its value to your organisational setup.