Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Microservice architecture patterns and best practices

Today, there are several trends that are forcing application architectures to
evolve. Users expect a rich, interactive and dynamic user experience on a wide
variety of clients including mobile devices. Applications must be highly scalable,
highly available and run on cloud environments. Organizations often want to
frequently roll out updates, even multiple times a day. Consequently, its no
longer adequate to develop simple, monolithic web applications that serve up
HTML to desktop browsers.
Pattern: Monolithic Architecture
Context
You are developing a server-side enterprise application. It must support a variety
of different clients including desktop browsers, mobile browsers and native
mobile applications. The application might also expose an API for 3rd parties to
consume. It might also integrate with other applications via either web services
or a message broker. The application handles requests (HTTP requests and
messages) by executing business logic; accessing a database; exchanging
messages with other systems; and returning a HTML/JSON/XML response.
> The application has either a layered or hexagonal architecture and consists of
different types of components:
> Presentation components - responsible for handling HTTP requests and
responding with either HTML or JSON/XML (for web services APIS)
> Business logic - the applications business logic
> Database access logic - data access objects responsible for access the
database
Application integration logic - messaging layer, e.g. based on Spring integration.
There are logical components corresponding to different functional areas of the
application.
Problem
What's the application's deployment architecture?
Forces
>There is a team of developers working on the application
>New team members must quickly become productive
>The application must be easy to understand and modify
>You want to practice continuous deployment of the application

>You must run multiple copies of the application on multiple machines in order
to satisfy scalability and availability requirements
>You want to take advantage of emerging technologies (frameworks,
programming languages, etc)
Solution
Build an application with a monolithic architecture. For example:
>a single Java WAR file.
>a single directory hierarchy of Rails or NodeJS code
Example
Lets imagine that you are building an e-commerce application that takes orders
from customers, verifies inventory and available credit, and ships them. The
application consists of several components including the StoreFrontUI, which
implements the user interface, along with some backend services for checking
credit, maintaining inventory and shipping orders.

The application is deployed as a single monolithic application. For example, a


Java web application consists of a single WAR file that runs on a web container
such as Tomcat. A Rails application consists of a single directory hierarchy
deployed using either, for example, Phusion Passenger on Apache/Nginx or JRuby
on Tomcat. You can run multiple instances of the application behind a load
balancer in order to scale and improve availability.
Resulting context
This solution has a number of benefits:
>Simple to develop - the goal of current development tools and IDEs is to
support the development of monolithic applications
>Simple to deploy - you simply need to deploy the WAR file (or directory
hierarchy) on the appropriate runtime
>Simple to scale - you can scale the application by running multiple copies of the
application behind a load balancer
However, once the application becomes large and the team grows in size, this
approach has a number of drawbacks that become increasingly significant:
> The large monolithic code base intimidates developers, especially ones who
are new to the team. The application can be difficult to understand and modify.
As a result, development typically slows down. Also, because there are not hard
module boundaries, modularity breaks down over time. Moreover, because it can

be difficult to understand how to correctly implement a change the quality of the


code declines over time. It's a downwards spiral.
> Overloaded IDE - the larger the code base the slower the IDE and the less
productive developers are.
> Overloaded web container - the larger the application the longer it takes to
start up. This had have a huge impact on developer productivity because of time
wasted waiting for the container to start. It also impacts deployment too.
> Continuous deployment is difficult - a large monolithic application is also an
obstacle to frequent deployments. In order to update one component you have
to redeploy the entire application. This will interrupt background tasks (e.g.
Quartz jobs in a Java application), regardless of whether they are impacted by
the change, and possibly cause problems. There is also the chance that
components that havent been updated will fail to start correctly. As a result, the
risk associated with redeployment increases, which discourages frequent
updates. This is especially a problem for user interface developers, since they
usually need to iterative rapidly and redeploy frequently.
> Scaling the application can be difficult - a monolithic architecture is that it can
only scale in one dimension. On the one hand, it can scale with an increasing
transaction volume by running more copies of the application. Some clouds can
even adjust the number of instances dynamically based on load. But on the other
hand, this architecture cant scale with an increasing data volume. Each copy of
application instance will access all of the data, which makes caching less
effective and increases memory consumption and I/O traffic. Also, different
application components have different resource requirements - one might be CPU
intensive while another might memory intensive. With a monolithic architecture
we cannot scale each component independently
> Obstacle to scaling development - A monolithic application is also an obstacle
to scaling development. Once the application gets to a certain size its useful to
divide up the engineering organization into teams that focus on specific
functional areas. For example, we might want to have the UI team, accounting
team, inventory team, etc. The trouble with a monolithic application is that it
prevents the teams from working independently. The teams must coordinate
their development efforts and redeployments. It is much more difficult for a team
to make a change and update production.
> Requires a long-term commitment to a technology stack - a monolithic
architecture forces you to be married to the technology stack (and in some
cases, to a particular version of that technology) you chose at the start of
development . With a monolithic application, can be difficult to incrementally
adopt a newer technology. For example, lets imagine that you chose the JVM.
You have some language choices since as well as Java you can use other JVM
languages that inter-operate nicely with Java such as Groovy and Scala. But
components written in non-JVM languages do not have a place within your
monolithic architecture. Also, if your application uses a platform framework that

subsequently becomes obsolete then it can be challenging to incrementally


migrate the application to a newer and better framework. Its possible that in
order to adopt a newer platform framework you have to rewrite the entire
application, which is a risky undertaking.
Related patterns
The microservices architecture is an alternative pattern that addresses the
limitations of the monolithic architecture.
Known uses
Well known internet services such as Netflix, Amazon.com and eBay initially had
a monolithic architecture. Most web applications developed by the author had a
monolithic architecture.

Source : microservices.io
Recommended by :
Jon Cohn ,CTO , VP IT Architecture
https://www.linkedin.com/in/jonacohn
joncohn@comcast.net

"Jon Cohn Exton PA" "Jon Cohn Exton" "Jon Cohn Evolution"

https://docs.google.com/document/d/1jhU5Mis7YoGzJvK85coGd8yZIHs-JnCG_cyz-p_y9Jk/edit?
usp=sharing
http://issuu.com/jonacohn/docs/jon.cohn.resume.docx
https://www.scribd.com/doc/294344968/Jon-cohn-Resume
http://www.slideshare.net/jonacohn/joncohnresume
https://penzu.com/p/e1f1fb23
http://jonacohn.tumblr.com/post/136671484928/jon-a-cohn
https://jonacohn.wordpress.com/2016/01/06/jon-a-cohn/
http://jonacohn.blogspot.com/2016/01/jon-cohn-resume.html

www.slideserve.com/jonacohn/jon-a-cohn-exton-pa
http://www.authorstream.com/Presentation/jonacohn-2711402-jon-cohn-exton-pa-19341/
www.slideserve.com/jonacohn/jon-a-cohn-exton-pa
http://slideonline.com/presentation/99077-jon-a-cohn-exton-pa

https://docs.google.com/document/d/1NJujdCMyQTF9qReGp6oMbmvWBXWEqP-

u1avWwEMAgmo/edit?usp=sharing
https://plus.google.com/105089455909133040148/posts/1j3SQfwm6QW
http://jonacohn.blogspot.com/2016/01/knowledge-management-in-software.html
http://docslide.net/technology/knowledge-management-in-software-architecture-.html
http://issuu.com/jonacohn/docs/knowledge_management_in_software_ar
https://www.scribd.com/doc/294345138/Knowledge-Management-in-Software-Architecture
http://www.slideshare.net/jonacohn/knowledge-management-in-software-architecture
https://penzu.com/p/20142217
http://jonacohn.tumblr.com/post/136671606138/knowledge-management-in-software-architecture
https://jonacohn.wordpress.com/2016/01/06/knowledge-management-in-software-architecturestate-of-the-art/
https://docs.google.com/document/d/1CfsHdjb2TmLzBqgUu5bqTolxNJIJdYyj4WKvYs9Isqc/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/RQtZGoR4qEd
http://jonacohn.blogspot.com/2016/01/microservice-architecture-patterns-and.html
http://docslide.net/technology/microservice-architecture-patterns-and-best-practices-.html
http://issuu.com/jonacohn/docs/microservice_architecture_patterns_
https://www.scribd.com/doc/294345139/Microservice-Architecture-Patterns-and-Best-Practices
http://www.slideshare.net/jonacohn/microservice-architecture-patterns-and-best-practices
https://penzu.com/p/4a54eb47
http://jonacohn.tumblr.com/post/136671688403/microservice-architecture-patterns-and-best
https://jonacohn.wordpress.com/2016/01/06/microservice-architecture-patterns-and-best-practices/
https://docs.google.com/document/d/16a4js8-8Aun-getG1O1J5G2LfCOsiv6nvWfAJDL0itI/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/AR8bEGBYukJ
http://jonacohn.blogspot.com/2016/01/microservices-anti-patterns.html
http://docslide.net/technology/microservices-anti-.html
http://issuu.com/jonacohn/docs/microservices_anti.docx
https://www.scribd.com/doc/294345141/Microservices-Anti
http://www.slideshare.net/jonacohn/microservices-anti
https://penzu.com/p/fb7180ed
http://jonacohn.tumblr.com/post/136671725568/microservices-anti-patterns
https://jonacohn.wordpress.com/2016/01/06/microservices-anti-patterns/
https://docs.google.com/document/d/1yW3qK63RbReFDM0u7QaFaN6GQ7aztbovav7eKbKaUyg/e
dit?usp=sharing
https://plus.google.com/105089455909133040148/posts/JoonTaUmWJN
http://jonacohn.blogspot.com/2016/01/software-architecture-antipatterns.html
http://docslide.net/technology/software-architecture-antipatterns-.html
http://issuu.com/jonacohn/docs/software_architecture_antipatterns.
https://www.scribd.com/doc/294345142/Software-Architecture-AntiPatterns
http://www.slideshare.net/jonacohn/software-architecture-anti-patterns
https://penzu.com/p/623a155f
http://jonacohn.tumblr.com/post/136671788668/software-architecture-antipatterns
https://jonacohn.wordpress.com/2016/01/06/software-architecture-antipatterns/
https://docs.google.com/document/d/1amUg47H3WiWfjFyCEXuE2IW0BjsRpy5FcS21ocskPfo/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/3wnZwvKRJVw
http://jonacohn.blogspot.com/2016/01/5-ways-cios-can-rationalize-application.html
http://docslide.net/technology/5-ways-cios-can-rationalize-application-portfolios-.html
http://issuu.com/jonacohn/docs/5_ways_cios_can_rationalize_applica
https://www.scribd.com/doc/294345398/5-Ways-CIOs-Can-Rationalize-Application-Portfolios

http://www.slideshare.net/jonacohn/5-ways-ci-os-can-rationalize-application-portfolios
https://penzu.com/p/59d0714d
http://jonacohn.tumblr.com/post/136671848208/5-ways-cios-can-rationalize-application-portfolios
https://jonacohn.wordpress.com/2016/01/06/5-ways-cios-can-rationalize-application-portfolios/
https://docs.google.com/document/d/1mxok-5UOtBtOrf_DnX-YuJuqWjXz_5dmM6dIWIz42Qo/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/8zoDBqkuVUY
http://jonacohn.blogspot.com/2016/01/8-enterprise-software-predictions.html
http://docslide.net/technology/8-enterprise-software-predictions-.html
http://issuu.com/jonacohn/docs/8_enterprise_software_predictions.d
https://www.scribd.com/doc/294345403/8-Enterprise-Software-Predictions
http://www.slideshare.net/jonacohn/8-enterprise-software-predictions-56574229
https://penzu.com/p/bb8da598
http://jonacohn.tumblr.com/post/136671903488/8-enterprise-software-predictions
https://jonacohn.wordpress.com/2016/01/06/8-enterprise-software-predictions/
https://docs.google.com/document/d/1j6vNIc8UPFBBDwY9Pf3JotXOz2rFFED1_RUiv3uAITA/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/1KzDqVAbsPe
http://jonacohn.blogspot.com/2016/01/9-enterprise-tech-trends-for-2016-and.html
http://docslide.net/technology/9-enterprise-tech-trends-for-2016-and-beyond-.html
http://issuu.com/jonacohn/docs/9_enterprise_tech_trends_for_2016_a
https://www.scribd.com/doc/294345405/9-Enterprise-Tech-Trends-for-2016-and-Beyond
http://www.slideshare.net/jonacohn/9-enterprise-tech-trends-for-2016-and-beyond
https://penzu.com/p/1d693de8
http://jonacohn.tumblr.com/post/136671931568/9-enterprise-tech-trends-for-2016-and-beyond
https://jonacohn.wordpress.com/2016/01/06/9-enterprise-tech-trends-for-2016-and-beyond/
https://docs.google.com/document/d/1MYjcjtP9GbvwW9jCjCHWq6giriccM1DspbFbwX4qyCk/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/iZWpb25woCS
http://jonacohn.blogspot.com/2016/01/best-practices-enterprise-architecture.html
http://docslide.net/technology/best-practices-joncohn202.html
http://issuu.com/jonacohn/docs/best_practices.docx
https://www.scribd.com/doc/294345407/Best-Practices
http://www.slideshare.net/jonacohn/best-practices-56574259
https://penzu.com/p/63e3b811
http://jonacohn.tumblr.com/post/136672044823/best-practices-enterprise-architecture
https://jonacohn.wordpress.com/2016/01/06/best-practices-enterprise-architecture/
https://docs.google.com/document/d/1Wb04CK1FHTJUxRibL74u_YwYf5dxyEqOK5wUgNpcU2g/ed
it?usp=sharing
https://plus.google.com/105089455909133040148/posts/DyvwQzQUnsS
http://jonacohn.blogspot.com/2016/01/enterprise-architecture-innovation.html
http://docslide.net/technology/enterprise-architecture-.html
http://issuu.com/jonacohn/docs/enterprise_architecture.docx
https://www.scribd.com/doc/294345410/Enterprise-Architecture
http://www.slideshare.net/jonacohn/enterprise-architecture-56574277
https://penzu.com/public/c15a5fd5
http://jonacohn.tumblr.com/post/136672100058/enterprise-architecture-innovation-management
https://jonacohn.wordpress.com/2016/01/06/enterprise-architecture-innovation-managementexploring-the-links/
https://docs.google.com/document/d/11ufZjAbBpLn_fnG3q3b1JqVhCRS-K0YxnJAmql1H4W0/edit?

usp=sharing
https://plus.google.com/105089455909133040148/posts/GgDtXx7nMRs
http://jonacohn.blogspot.com/2016/01/seven-best-practices-for.html
http://docslide.net/technology/seven-best-practices-for-revolutionizing-your-data-.html
http://issuu.com/jonacohn/docs/seven_best_practices_for_revolution
https://www.scribd.com/doc/294345412/Seven-Best-Practices-for-Revolutionizing-Your-Data
http://www.slideshare.net/jonacohn/seven-best-practices-for-revolutionizing-your-data
https://penzu.com/p/ba199cb7
http://jonacohn.tumblr.com/post/136672128658/seven-best-practices-for-revolutionizing-your-data
https://jonacohn.wordpress.com/2016/01/06/seven-best-practices-for-revolutionizing-your-data/
https://docs.google.com/document/d/1t8Q6bRX8mX3mrVczTxlk4rzRJalcYNvNC7d1M-XF3Ao/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/Ku4Fj2SC15z
http://jonacohn.blogspot.com/2016/01/six-steps-to-data-governance-success.html
http://docslide.net/technology/six-steps-to-data-governance-success-.html
http://issuu.com/jonacohn/docs/six_steps_to_data_governance_succes
https://www.scribd.com/doc/294345415/Six-Steps-to-Data-Governance-Success
http://www.slideshare.net/jonacohn/six-steps-to-data-governance-success
https://penzu.com/p/f152cfd5
http://jonacohn.tumblr.com/post/136672450458/six-steps-to-data-governance-success
https://jonacohn.wordpress.com/2016/01/06/six-steps-to-data-governance-success/
https://docs.google.com/document/d/16lyD986BUJSQNRGZ5L_EGaVoj03XP4qCuMYi6lpb1A/edit?usp=sharing
https://plus.google.com/105089455909133040148/posts/h54EfyrsDLh
http://jonacohn.blogspot.com/2016/01/the-big-data-architecture-dilemma-for.html
http://docslide.net/technology/the-big-data-architecture-dilemma-for-cios-.html
http://issuu.com/jonacohn/docs/the_big_data_architecture_dilemma_f
https://www.scribd.com/doc/294345419/The-Big-Data-Architecture-Dilemma-for-CIOs
http://www.slideshare.net/jonacohn/the-big-data-architecture-dilemma-for-ci-os
https://penzu.com/p/427555f6
http://jonacohn.tumblr.com/post/136672497063/the-big-data-architecture-dilemma-for-cios
https://jonacohn.wordpress.com/2016/01/06/the-big-data-architecture-dilemma-for-cios/
https://docs.google.com/document/d/1Dn-1qgitLF-abiZwWE5WAAvaiO7vB-gXWGVIYh8v6ao/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/gxMGKV2uiDn
http://jonacohn.blogspot.com/2016/01/the-next-generation-of-enterprise-it.html
http://docslide.net/technology/the-next-generation-of-enterprise-it-.html
http://issuu.com/jonacohn/docs/the_next_generation_of_enterprise_i
https://www.scribd.com/doc/294345420/The-Next-Generation-of-Enterprise-IT
http://www.slideshare.net/jonacohn/the-next-generation-of-enterprise-it
https://penzu.com/public/c3a53beb
http://jonacohn.tumblr.com/post/136672518848/the-next-generation-of-enterprise-it
https://jonacohn.wordpress.com/2016/01/06/the-next-generation-of-enterprise-it/
https://docs.google.com/document/d/1tXutYHc6npuklzT79T7ZN4Ck6OFgS2zv5gCc5KLW0kI/edit?
usp=sharing
https://plus.google.com/105089455909133040148/posts/XFQccKewNBv
http://jonacohn.blogspot.com/2016/01/where-is-enterprise-architecture-in.html
http://docslide.net/technology/where-is-enterprise-architecture-in-healthcare-.html
http://issuu.com/jonacohn/docs/where_is_enterprise_architecture_in
https://www.scribd.com/doc/294345421/Where-is-Enterprise-Architecture-in-Healthcare
http://www.slideshare.net/jonacohn/where-is-enterprise-architecture-in-healthcare-56574321

https://penzu.com/public/f3710120
http://jonacohn.tumblr.com/post/136672547973/where-is-enterprise-architecture-in-healthcare
https://jonacohn.wordpress.com/2016/01/06/where-is-enterprise-architecture-in-healthcare/

You might also like