Accelerating Microservices Design and Development Codex2533
Accelerating Microservices Design and Development Codex2533
Microservices
customer expectations across industries. Many
are struggling to adapt to this accelerated change.
As a result, many businesses are aggressively
Design and
pushing IT to cut delivery time, reduce cost and
improve quality – all simultaneously.
Development
Microservices architecture (MSA) has emerged as
one way to address these challenges. MSA
describes a new way of designing software
applications as suites of small, loosely-coupled
independent services. While there is no precise
definition of this architectural style, these
To proactively deal with changing architectures encompass certain common
business requirements inside characteristics around organization, business
capability, automated deployment, intelligent
and outside the enterprise, IT service endpoints, and decentralized control of
organizations must embrace languages and data. Like their predecessors, they
more modular and extensible bring their own set of unique challenges that
should be addressed up front to prevent the
software development and
architecture from turning into a tangled mesh of
deployment methods built on point-to-point communication paths.
a solid microservices reference
This white paper describes an approach to
architecture. microservices design and development that is
based on adoption of RESTful services design and “The Seven Waves of Change That Will Pow-
best practices.1 Rather than conforming to a er, or Crush, Your Digital Business.”
checklist of design and development guidelines
and best practices that encompass our collective DEFINING MICROSERVICES
knowledge of the right ways of developing ARCHITECTURE
microservices, we recommend a tool-based
A microservices architecture is an architectural
approach that generates code compliant with
style for developing software applications as a
microservices best practices and the chosen
suite of small, autonomous services that work
technology stack.
together running in its own process and that
We believe that given their distributed nature communicate with other services using a
and myriad moving parts, microservices can lightweight communication protocol. The two
easily turn into an implementation nightmare, protocols commonly used are HTTP request-
unless their design and processes are enforced response and lightweight messaging.
and validated on an ongoing basis using
Microservices architectural styles2 are best
best-in-class software engineering tools.
understood by comparing them to traditional mono-
This paper offers a comprehensive microservices lithic architectural styles – a style of application
design and development technique that not only development where an entire application is deployed
leverages rapidly evolving best practices but and scaled as a single unit. In monoliths, business
also supports and enforces them using a logic is packaged in a single bundle and run as a
development workbench that we call Cognizant single process. These applications are usually scaled
COSMOS. It builds on our thinking shared in by running multiple instances horizontally. Figure 1
previous works on the topic, “Overcoming depicts MSA’s architectural implications in com-
Ongoing Digital Transformational Challenges” parison to monoliths.
Remote Service Services communicate remotely with one another. Remote calls
Communication impact service performance and increase chattiness.
Larger Attack Modularity limits the privileges an attacker gets in a single attack.
But it also increases the attack surface, as more services are
Surface exposed to the external world.
Frequent Service Higher-service modularity and remote calls increase the risk of
Failures failures while reducing the failure complexity and resolution time.
Figure 1
IDENTITY MONITORING
SERVICE PERFORMANCE
RESILIENCY LOG ANALYSIS
MANAGER
DASHBOARD DASHBOARD
API
API
DASHBOARD DASHBOARD
DEPLOYMENT ENVIRONMENT
DEVELOPER WORKBENCH
CONTINUOUS INTEGRATION/DELIVERY PIPELINE
Figure 2
may often double up as the API gateway. The deployment. Continuous integration (CI) and
routing service uses dynamic routing and continuous delivery (CD) automate testing
load-balancing capabilities to route external and delivery, ensuring that the software is
requests to the selected service by looking up working as per expectation every time. (For
services from the service registry. In addition, an more on CI and CD, read our white paper,
edge management portal may be required for “Patterns for Success: Lessons Learned When
administering routing rules. Adopting Enterprise DevOps.”
To design the API model, with its constraints and • Data strategy: One of the major challenges of
design attributes, a developer workbench is migrating to a microservices architecture is to
needed to support the API modeling archetypes. adopt the database-per-service design pattern.
The workbench should have features to publish In monolithic service architecture, business
the API model to an API store with support for transactions converge on the database layer,
the full API lifecycle. The API model also needs to making it a shared service. This goes against
be access-controlled using state-of-the-art the notion of an end-to-end loosely-coupled
security standards. From an API consumption component, which is strongly advocated by
perspective, we believe that a component in the microservices purists. The best solution to
microservices reference architecture is needed mitigate this challenge is to use an eventually
to support the definition of usage policies and its consistent database.5
association with consumers.
OUR APPROACH TO MSA
• Infrastructure automation: DevOps is a key
EXCELLENCE
ingredient of a microservices reference
architecture. Microservices, by nature, are COSMOS is an open-standards-based solution for
agile and rapidly move from development to microservices design and delivery (see Figure 3)
Generates
Publishes API
Deployment options: business Business service
model to API
Supports ongoing service services generation: Generates
store
components
deployments by packaging skeleton projects for the
Generates
the developed artifacts into deployment core and composite
executable, deployable bundles for business microservices.
bundles appropriate for the different
deployment environment deployment
environments
(on-premises, IaaS, PaaS).
Figure 3
required by the microservices to connect with • Building and deploying the artifacts to cloud
other microservices and to exchange data or on-premises infrastructure: The
with the operational governance infrastructure workbench supports service deployments to
is also injected into the skeletal classes. both on-premises infrastructures and cloud by
Custom service logic needs to be added to the packaging the developed artifacts (compiled
generated code. Some microservices are code, configurations, etc.) into executable,
exposed for invocation over the public deployable bundles. COSMOS can also be
network. The reference architecture integrated with continuous delivery infra-
recommends inclusion of infrastructure structures (CI/CD) whereby any changes made
components for API management. These to components may trigger the CI/CD build
components typically consist of an API and deployment pipeline directly from the
manager to manage, an API store to host and workbench.
an API gateway to act as a single entry point
for the public APIs. IMPLEMENTING MICROSERVICES
VIA OPEN SOURCE
We believe that API management
infrastructure forms an integral part of the One of the key characteristics of a microservices
reference architecture for microservices architecture is technology diversity and the
implementation. The convergence of these support for it. There are a variety of libraries and
related yet distinct technology paradigms is a frameworks available today that implement the
critical success factor for microservices various components of the reference
architecture. COSMOS has support for architecture shown above. The variety exists not
different API management solutions, both only in terms of programming languages, but
open-source and commercial. also in terms of the various communication
COSMOS supports the open-source Spring Cloud Support for additional technology options are
Netflix stack as one of its technology options for being continuously added to COSMOS. Apache
implementation. Figure 4 depicts how Camel and Eclipse Vert.x support for implementing
components of the Spring Cloud Netflix stack a microservices architecture are in the works and
map to our reference architecture. planned for release in the next version.
OAUTH2.0 MONITORING
API
DEPLOYMENT ENVIRONMENT
ECLIPSE COSMOS PLUGIN
CONTINUOUS INTEGRATION/DELIVERY PIPELINE
Figure 4
FOOTNOTES
1
http://www.drdobbs.com/web-development/restful-web-services-a-tutorial/240169069.
2
James Lewis and Martin Fowler, “Microservices,” http://martinfowler.com/articles/microservices.html.
3
Martin Fowler, “Circuit Breaker,” http://martinfowler.com/bliki/CircuitBreaker.html.
4
Michael T. Nygard, “Release It! Design and Deploy Production-Ready Software,” https://pragprog.com/book/mnee/release-it.
5
Vogels, W, “Scalable Web Services: Eventually Consistent,” ACM Queue, vol. 6, no. 6, pp. 14-16, October 2009.
Pijush Kanti Giri Pijush Kanti Giri is an Architect within the Software Engineering and
Architecture Lab of Cognizant’s Global Technology Office. He has
Architect, extensive experience in Eclipse plug-in architecture and developing
Software Engineering and Eclipse RCP applications, API management and microservices-
Architecture Lab based architecture. Pijush has a B.Tech. degree in computer science
from University of Kalyani. He can be reached at Pijushkanti.Giri@
cognizant.com.
© Copyright 2017, Cognizant. All rights reserved. No part of this document may be reproduced, stored in a retrieval system, transmitted in any form or by any means,electronic, mechanical,
photocopying, recording, or otherwise, without the express written permission from Cognizant. The information contained herein is subject to change without notice. All other trademarks
mentioned herein are the property of their respective owners.
TL Codex 2533