Pitfalls and Challenges Faced During A Microservices Architecture Implementation Codex5066
Pitfalls and Challenges Faced During A Microservices Architecture Implementation Codex5066
Executive Summary
Organizations across industries are at various stages suboptimal implementations of microservices
of their journey toward adopting a microservices architectures that have emerged since our initial take
architecture style.1 Some have been successful in on the topic.2
delivering real business benefits, while others are
This white paper provides readers with guidance on
still experimenting.
fundamental design decisions required to properly
While the benefits delivered by a microservices implement a microservices architecture to realize all the
architecture such as agility, selective scalability and benefits available to organizations willing to take
availability still hold true, we are dismayed by the various the plunge.
February 2020
Some teams tend to think of the “micro” in microservices as
a lever to design smaller-scoped systems, while others think of
micro as the lever to deploy and operate manageable systems.
Policy
Claim Customer
ENTITY
Email
PROCESS
Users Notification
Issue policy
UTILITY
Address Process
change claim
Figure 1
While all granularity levels are expected to be microservice designers must pay close attention
served in a system, the main benefits of such to the context-dependent interactions that
architecture design can easily be missed; that is, the microservice needs to participate in. This
balancing agility (speed of change) with resiliency requires the designers to think in terms of loosely
(safety of change). Two issues are typically coupled, event-oriented boundaries and the
observed: context mapping.
Quick Take
Advancing Innovation & Time
to Market in Consumer Lending
One of our APAC clients in the consumer lending domain that wanted to enable
innovation and improve speed-to-market transformed a single monolithic application into
microservices with little or no focus on the design aspect of microservices.
The result was 500-plus microservices with extreme complexity leading to performance
bottlenecks due to chatty inter-service communication.
However, with a monolithic database, the scaling changes in other microservices, which defeats
of microservices puts additional load on the the core purpose of microservices.
database, creating a performance bottleneck. There are many reasons we have seen that lead to
❙ Coupling between microservices. this anti-pattern; two key ones are risk averseness
Microservices architectures offer agility in that to move away from the monolithic database and
they are loosely coupled and independently database designers who are not fully skilled in
deployed. However, if multiple microservices are newer patterns like microservices, leading to
tied to the same tables in the database, then any traditional database design.
change in the schema will result in cascading
To avoid these pitfalls, IT organizations must ❙ Adopt CQRS pattern to use read replicas.
ensure that the database design complements the Command query response segregation (CQRS)
microservices by following best practices: is an architecture pattern but it can be applied
to microservices database design to answer the
❙ Database per service in a no-share model.
biggest question: Can data be shared between
Each microservice needs to have full ownership
microservices?
of the data it requires. This does not mean a
separate physical database but ownership of the ❙ Break distributed transactions with a saga
data it masters. pattern.4 The division of database objects into
groups of logical schemas in bounded context of
❙ Polyglot persistence model. Making a
the wider transaction boundaries require multi-
relational database a default storage of all types
phase commits. Avoid this with saga patterns
of data leads to poor results, hence all types of
that keep intermediate states.
databases (e.g., NoSQL, Graph, in-memory, etc.)
must be used.
Quick Take
Overcoming Centralized
Database Shortcomings
One of the new cloud-native features of a consumer lending solution implemented in pure
microservices style was undermined by a single centralized relational database.
This design led to the database becoming a performance bottleneck and hindrance to
system scalability and resilience.
We addressed this issue by refactoring the database into multiple domain-centric physical
instances with microservices-based logical separations. This allowed domain-based
isolation, which enabled resiliency, scalability and performance improvements.
Breaking the data monolith through bounded context and polyglot design
MS 1 MS 2
MS 1 MS 2 MS 3
Full access
Full access
Read only
Shared table
POLYGLOT DESIGN
MS1 bounded context
MS2 bounded context
Figure 2
Quick Take
Overcoming REST Challenges
One of our large banking clients has implemented a core platform that offers both
message-based and service (REST) interfaces. However, in pursuit of REST-only
integration, the company implemented a REST interface on top of messaging that
resulted in interface complexity, transaction losses and latency issues due to the increased
processing pipeline and number of components engaged.
Chatty services
A chatty application is one that relies on numerous
MS1 API MS 2 API services to fulfill a request or a process. In
most cases, chattiness is a result of designing
microservices that are too fine-grained and break
the bounded context and independent business
capability principle.
Event bus
While calling other services to fulfill a request is
often considered as normal and acceptable, chatty
services incur numerous overhead such as:
Reactive Reactive Reactive
microservice 1 microservice 2 microservice 3
❙ Network latency, disk reads, database queries,
etc. on both the calling service and the service
being called.
For any microservices-based implementation, the
architecture should have a provision for core messaging ❙ Runtime dependency between the
infrastructure. For more complex architectures, a more microservices, resulting in a distributed
elaborate event bus architecture should be considered. monolith. All dependent microservices need to
Figure 3 be available and operational at the same time.
Quick Take
Embracing an Event-Driven
Architecture
A large bank had embarked on a transformation program to modernize its payment
landscape using a microservices architecture style.
Customer KYC
service service
Event bus
Figure 5
In some cases, one microservice might need to call microservice design systems that are misaligned
another microservice to trigger the business logic with business objectives. In addition, the evolution
it contains. In these situations, one service cannot of these microservices tends to be influenced by
avoid communicating with the other, but the the technologists.
IT team can implement it as efficiently as possible
In the majority of cases, this snag is a result of
via asynchronous communication protocols
problems on both sides. The business thinks
(see Figure 5).
topics like microservice design are too “techie”
Technology-only thinking and thus believes it has no role to play. IT thinks
business doesn’t have any useful know-how to
While designing microservices, we often see
contribute to microservices design and thus
development teams acting in complete isolation
shouldn’t be invited/consulted. System designers
with business stakeholders. IT teams tend to
create application boundaries that do not align
think that once the business has provided its
with the business capabilities and the experience
project requirements, design is an IT-only activity
design that the business requires. The result:
and sub-system decomposition, and defining
the microservices identified for such projects do
microservices and release mechanisms are the
not reflect the business domain (both problem
technology team’s agenda. This turns out to be
and solution) and instead are filled with technical
a major shortcoming in projects where business
services.
subject matter experts (SMEs) are not involved in
To avoid this pitfall, solution architects must play a Docker” are becoming commonplace. We believe
major role. They need to ensure that business has a this pitfall is one of the biggest issues facing
seat at the table while designing microservices and microservices adoption today.
both business and IT are able to offer reasons about
Technology is a strong enabler to get
design for delivery, lifecycle management and
microservices right, but that’s not the endgame.
evolution of business capability in scope.
Teams should not let these technologies steer
Another major issue in this category tends their efforts toward microservices. Once they
to be rooted in the accelerating evolution of have designed the right level of microservices
technology. Every few months (sometimes even that are aligned to the business being automated,
weeks) a new shiny technology is released by technology innovation should be used to deliver
vendors who talk up their use of microservices. the promise of high quality and agility. Some of
While continuous technology evolution is a the areas where microservices will really benefit
good thing, it tends to stimulate interest in the from technology evolution include elements
technology by business and IT teams, who steer such as automated deployment, release, scaling,
their project in this direction without really secure communication, high performance,
understanding the implications. availability, monitoring and provisioning. In
fact, our experience suggests that, more than
An example is Docker and Kubernetes.
technology, it’s the culture and systems thinking
Statements like “We are designing our
that influences how well we deal with these
microservices using Kubernetes” or “These
pitfalls in microservices-based systems.
performance problems will now be gone as we
are structuring our system as microservices on
Quick Take
Going Domain Driven
One of our clients faced challenges in correctly modeling the microservice
aggregate – the cohesive core model of any microservice. The team fell into a trap
of designing for compositional convenience and the resulting aggregates were too
large, with data consistency problems.
Quick Take
A Decoupling Approach
One of our financial services clients faced outages on its online portal as result of resource
starvation by a system performance monitoring solution. The agents on the tool exhausted
resources required for business logic processing, causing the portal to go down.
Not isolating the system software from business software was one of the reasons for the
failure, and detecting and isolating it was a difficult job.
The recommendation to decouple the system policy concerns from functional software
was applied through proper runtime-decoupling to resolve this issue. Additionally, the
monitoring and resiliency test practices were enhanced to detect such dependencies
through DevOps continuous integration/continuous delivery (CI/CD).
it is running on, and the network that is Idempotency is the feature to retry the same
interconnecting the microservices. request without impacting the state. With
❙ Recovery after failures. As the failure usually idempotency, each of the inflight transactions
results in complex intermediate states, it is can be retried without compromising the overall
often difficult to recover from. While respective system state.
microservices can be restarted, the transactions ❙ Delegation of intercommunication to a
that were in-flight must be recovered from their service mesh. While some of the microservices
failure state, which is often difficult. implementations use patterns like a circuit
Some strategies that we have found helpful to breaker, in any complex microservices-
address the challenge of resilience in a distributed based application circuit breaking is not
microservices environment include: enough. Implementation of a full-service
mesh (e.g., Istio5) or simpler side car proxy
❙ Observability as a key architecture concern. (e.g., Envoy6) can take away the complexity of
For a microservices environment to be highly intercommunication.
resilient it needs observability implemented at
In summary, resiliency is a big challenge in
each level (i.e., infrastructure and application).
microservices-based applications and unless
The capability to log, monitor and trace requests
dedicated architecture and design focus is given,
across the network is key to providing resiliency.
the desired outcomes will not be achieved.
❙ Design for recoverability more than failures.
While any well-implemented system is defined
Complexity challenge
for failures, it is recoverability more than failures
that address the concern of resilience. The Complexity reduction through well-defined
application should have the ability to recover bounded contexts and communication patterns
from a failure automatically at the container is one of the critical benefits that microservices
(e.g., restarting a container), a microservice (e.g., provide. If done right, microservices offer excellent
reinitiating a connection pool) and application support for autonomous evolution of business
state level (e.g., maintaining consistent state capabilities. Typically, such microservices are also
after recovery). business-capability driven and therefore act as
the common vocabulary used by both business and
❙ Design for idempotency. One of the key
IT teams, resulting in effective evolution of business
features to be implemented at the microservice
capabilities.
level to enable flawless recovery is idempotency.
Figure 6
However, microservices come in systems, which Finally, how to build and generate these polyglot
means that often any non-trivial enterprise system microservices as a coherent whole through the
tends to have dozens or hundreds of these systems complex continuous integration/continuous
(each developed as a microservice). As each delivery (CI/CD) pipeline is a major concern that
of these systems are narrowly focused, single- many teams must overcome. Last but not least,
purpose microservices, any business process or testing microservices is still an evolving area and
user interaction tends to result in invocation and poses a major challenge to the majority of teams.
interaction of multiple microservices, resulting in
Delivery complexity
challenges across multiple phases of projects:
With the advent of CI/CD and automated
Development complexity infrastructure provisioning through APIs,
Microservices development requires teams to deployment and release practices have evolved over
think in terms of distributed application design the last few years. In addition, the use of containers
and interaction patterns. Applying concepts such and managed cloud environments in the platform-
as CQRS, functional interfaces, CAP,7 BASE,8 and as-a service (PaaS) model requires teams to work
sagas9 in contemporary programming languages with constructs provided by these technologies/
and configuration is not something that developers services.
are used to.
While developing microservices in this environment,
Moreover, this is a new area of complexity for many deployment and release is typically coded in the
teams. Data persistence and integration requires form of YAML or JavaScript Object Notation (JSON)
them to not just understand aspects such as polyglot scripts and these artifacts have become a first-class
persistence,10 persistence ignorance11 or event- citizen of the code repositories for microservices.
driven messaging,12 but also poses challenges in Technology diversity, a lack of standards and a
terms of frameworks, libraries and programming plethora of agility-oriented release mechanisms
languages to choose from. (canary release, blue-green deployment, push-to-
Quick Take
Going Serverless
In one of our serverless microservices-based applications consisting of 100-plus
serverless services, we recommended using log streaming for application logs,
infrastructure logs and security logs to a central log store.
With log streaming, we were able to add various log processors and generate
a variety of real-time metrics such as configured memory vs. memory used.
Ultimately, this technique helped us to establish a centralized log store for
monitoring application, infrastructure and security events in a unified manner.
green release, dark release, “dogfooding,” etc.) Being able to achieve production stability and a
are among the areas of complexity that teams must real-time view of the hosted services is anything
deal with. but trivial. Security of interactions and APIs across
bounded contexts and partner systems is another
Finally, the element of release environments
area of complexity. A good API management,
with necessary dependencies required for a
messaging infrastructure and monitoring approach
microservices-based system to be deployed, tested
is essential to overcome these challenges.
and operated is another area of complexity that
many large enterprises have to solve. We strongly suggest that teams consider these
challenges and set up the right infrastructure,
Operational complexity
processes and practices to deal with them
Once released into production, microservices
proactively.
present challenges in the areas of capacity
utilization, scaling, failures and monitoring -- to
name a few. Operating an infrastructure with tens or Observability challenge
hundreds of microservices requires sophisticated Systems can be understood only if they are
tooling for automated provisioning in a secure and observable. Observability, monitoring and analysis
resilient manner. are in a symbiotic relationship, which is depicted as a
pyramid (see Figure 7).
Technologies such as Kubernetes provide the
necessary foundation for this but require operational Key challenges faced by microservices
procedures and practices beyond technology. In the implementation teams include:
13 14
case of monitoring, tools such as ELK, Grafana,
15 16
Jaeger, Prometheus, or cloud providers (e.g., AWS ❙ Observability vs. monitoring. Observability is
CloudWatch) help deal with this complexity, but about making the data available from within the
orchestrating all of these tools at scale is not a trivial system to be monitored; monitoring is the task of
task. If the microservices are operated in container collecting and displaying that data. Microservices
or serverless runtime, then these complexities are teams focus on monitoring tools without making
amplified as the infrastructure is quite dynamic. the software observable.
ANALYSIS
MONITORING
OBSERVABILITY
Figure 7
Quick Take
Working Around Event-Driven
Obstacles
In one of our banking client’s event-driven straight through processing (STP) applications,
the team was struggling to monitor the event processing.
We proposed a mechanism in which each functional module published an event before and
after processing. We also defined application logging standards, log aggregation and monitoring
approaches, which helped the team to enable effective observability and monitoring.
As a result, incident resolution improved and business KPIs provided real-time insights to the
business.
❙ Distributed tracing. The most difficult part significant, which puts pressure on developers.
of observability is distributed tracing with and This results in developers spending time on
between application services. A great deal of writing instrumentation for monitoring rather
work is involved in implementing distributed than the functional code.
tracing. Microservices teams lack the underlying Guidelines that we have found helpful to address
principles of tracing requests that flow between the observability challenges include:
services. Organizations typically need a cultural
overhaul to embrace observability as part of the ❙ Establish standards and governance. For
development process. observability, it is critical to establish standards
and governance. Without standards, the
❙ Contemporary tools. Modern application
collection and correlation of event logs
delivery has shifted to containerization,
and metrics becomes highly challenging,
microservices, and polyglot environments,
compromising the outcomes. IT organizations
which cause problems for monitoring tools.
must establish the following standards.
The speed of deployment has increased along
with the number of software components that Logging standards:
are deployed. The existing monitoring tools or > Standards such as, log format, log level usage
production profilers are finding it difficult to and logging frequency.
keep pace. Additionally, these tools have trouble
identifying and connecting dependencies > Business data standards: Logging of business
between microservices, especially at the data (masking and hiding).
individual request level. > Technology standards: Clear guidelines on
❙ Automating observability. The practicalities tools usage for dev engineers.
of implementing observability can be quite
Figure 8
Quick Take
Team Building
One of our clients decided to modernize its IT landscape using microservices architecture
style. Since the domain was complex and the landscape was large scale, we worked
with the client to enable a diverse workforce on microservices design, cloud-native
infrastructure, SRE disciplines and DevOps practices in a dedicated infrastructure setup.
This enablement and competency development led to a strong team of developers across
locations delivering microservices-based projects in a consistent manner.
Looking forward
Microservice architecture style is one of the challenges so that microservices benefits can be
prominent and relevant design approaches for effectively achieved. Wherever any of these pitfalls
developing cloud-native systems. We strongly or challenges result in tactical decision-making, we
consider that our clients apply this style in should ensure that such exceptions are handled
distributed systems development. However, the though a proper technical debt-management
pitfalls and challenges presented in this paper mechanism.
tend to result in sub-optimal applications of this
Finally, the extent to which enterprises can address
architecture style, leading to an environment in
these issues depends on infrastructure maturity
which teams start to think that microservices is yet
and design competency within IT and alignment
another adopted fad.
of business and IT overall. Try to evolve toward that
The additional complexity in operations of and state instead of trying to address all of these pitfalls
troubleshooting these systems creates further and challenges upfront, learning and adapting your
issues. Hence, we highly recommend keeping an approaches along the way.
eye on these pitfalls and proactively addressing the
Endnotes
1 James Lewis, “Microservices,” Martin Fowler, March 25, 2014, http://martinfowler.com/articles/microservices.html.
2 Cognizant, “Overcoming Ongoing Digital Transformation Challenges with Microservices Architecture,” November 2015,
https://www.cognizant.com/InsightsWhitepapers/Overcoming-Ongoing-Digital-Transformational-Challenges-with-a-
Microservices-Architecture-codex1598.pdf.
4 A saga is a sequence of local transactions where each transaction updates data within a single service. The first transaction
is initiated by an external request corresponding to the system operation, and then each subsequent step is triggered by
the completion of the previous one (Rosa, 2018).
5 Istio, https://istio.io/.
6 Envoy, https://www.envoyproxy.io/.
10 http://www.martinfowler.com/bliki/PolyglotPersistence.html.
11 https://deviq.com/persistence-ignorance/.
12 https://en.wikipedia.org/wiki/Event-driven_messaging.
14 Grafana, https://grafana.com/.
15 Jaeger, https://www.jaegertracing.io/.
16 Prometheus, https://prometheus.io/.
References
❙ A. Brandolini, Strategic Domain Driven Design with Context Mapping, November 25, 2009, Retrieved from infoq.com:
https://www.infoq.com/articles/ddd-contextmapping.
❙ D. Rosa, Saga Pattern, January 10, 2018, Retrieved from blog.couchbase.com: https://blog.couchbase.com/saga-pattern-
implement-business-transactions-using-microservices-part/.
Dinkar Gupta
Senior Director & Chief Architect, Cognizant Banking and Financial Services
Dinkar is a Senior Director & Chief Architect with Cognizant’s Banking and Financial Services (BFS)
Technology and Architecture Office. Based in Switzerland, Dinkar leads the practice for Europe and the
UK region. He has a post-graduate degree in computer science and applications from National Institute
of Electronic and Information Technology, India, and has over 20 years of architecture and technology
experience across diverse industry segments with a strong focus on financial services. Dinkar can be
reached at [email protected] | LinkedIn: www.linkedin.com/in/dinkargupta/.
Mrudul Palvankar
Former Principal Architect, Cognizant Banking and Financial Services
Mrudul is a former Principal Architect in Cognizant’s Banking and Financial Services (BFS) Technology and
Architecture Office, where she previously headed the architecture and technology team assisting a global
BFS client. She has a post-graduate degree in business administration from Institute of Management
Development and Research, India, and has 19 years of software development experience across multiple
industry segments. She is also TOGAF certified and is actively engaged in architecture transformation
consulting and solution delivery for BFS customers. Mrudul can be reached at LinkedIn: www.linkedin.
com/in/mrudul-palvankar-593398/.
Acknowledgments
The authors would like to thank their former colleague Vivek Kant (www.linkedin.com/in/vivekkant/)
for his contributions to this white paper.
About Cognizant
Cognizant (Nasdaq-100: CTSH) is one of the world’s leading professional services companies, transforming clients’ business, operating and technology
models for the digital era. Our unique industry-based, consultative approach helps clients envision, build and run more innovative and efficient business-
es. Headquartered in the U.S., Cognizant is ranked 193 on the Fortune 500 and is consistently listed among the most admired companies in the world.
Learn how Cognizant helps clients lead with digital at www.cognizant.com or follow us @Cognizant.
© Copyright 2020, 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.
Codex 5066