Microservices Introduction

Justin Lee - Technical Evangelist

E: triplez@justinlee.sg

T: @triplez82

Agenda

  • Building Monolithic App

 

  • Introduction about Microservices

 

  • Characteristics of Microservices Architecture

 

  • Benefits and Drawbacks of Microservices

 

  • Demo of implementing a Microservices Architectured App on Bluemix

Building Monolithic App

What's Great with Monolithic App

* Simple to develop

 

* Simple to test

 

* Simple to deploy

 

* Simple to scale

What's Bad with Monolithic App

* App is overwhelmingly complex. Fixing bugs and implementing new features become difficult & time consuming

 

* The development will be slow down due to app size

 

* Very hard to do continuous development (which has been become the new norm in modern SaaS business)

 

* Difficult to scale when different modules have conflicting resource requirements

 

* Reliability is an issue i.e a memory leak could impact entire app

 

* Extremely difficult to adopt new frameworks & technologies

What is Microservices

What is Microservices

Microservices are small, autonomous services that work together

Scale Cube

Characteristics of Microservices

1. Small and focused on doing one thing well

* Single Responsibility Principle

Gather together those things that change for the same reason, and separate those things that change for different reasons.

 

 

Characteristics of Microservices

2. Autonomous

 

* Separate entity, can be deployed on isolated "machine"

 

* Be able to change independently

"Can you make a change to a service and deploy it by itself without changing anything else?"

 

* Each service expose an API and communicate via API

Characteristics of Microservices

3. Language Neutral

 

 

 

NodeJS

Redis

MongoDB

Ruby

Ruby

MongoDB

App Re-Architected as Microservices

Benefits of Microservices

1. Technology Heterogeneity

 

* Pick the right tool for each job

* Able to adopt new technology more quickly

Benefits of Microservices

2. Resilience

 

* Concept of bulkhead

* We can build system handle total failure of services  

Benefits of Microservices

3. Scaling

 

Benefits of Microservices

4. Ease of Deployment

 

* Changes can be made to services & deployed independently 

 

* Faster to rollback in case of failure

 

* Get new functionality to client faster 

Benefits of Microservices

5. Organizational Alignment

 

* Smaller team working on smaller codebases tend to be more productive

 

* Able to align architecture to organization

 

* Able to shift ownership of services to teams who are collocate

Benefits of Microservices

6. Composability 

 

* Functionality can be consumed in different ways for different purposes

 

 

Benefits of Microservices

 7. Optimizing for Replaceability

 

* Easier to manage the cost of replacing / deletion of services due to its small in size

Drawbacks of Microservices

1. Significant Operations Overhead

 

*  You need a mature operations team to manage lots of services, which are being redeployed regularly.

 

 

 

Drawbacks of Microservices

2. Distributed System Complexity

 

* Lots of remote procedure calls, REST APIs or messaging to glue components together across different processes and servers.

 

* Which inter-process communication mechanism to choose?

 

* Have to concern about Network latency, fault tolerance, message serialisation, unreliable networks, asynchronicity, versioning, varying loads, etc

 

Drawbacks of Microservices

3. Asynchronicity is Difficult

 

CAP theorem - you can pick only 2 of these in a distributed system

 

Consistency (all nodes see the same data at the same time)

Availability (a guarantee that every request receives a response about whether it succeeded or failed)

Partition tolerance (the system continues to operate despite arbitrary partitioning due to network failures)

 

 

 

Demo of Microservices App on Bluemix

Demo of Microservices App on Bluemix

Catalog App

* A backend RESTful API to keep track of all the items in the store.


* Developed using Node.js with Express framework. The catalog of items will be persisted in a Cloudant database.


* Node.js is selected due to it’s non-blocking, event-driven I/O, it’s ability to handle many requests, and for the use of a non-relational database for our catalog of items.

Demo of Microservices App on Bluemix

Catalog App

http://microservices-catalogapi-sonlethanh-165.mybluemix.net/

Demo of Microservices App on Bluemix

Orders App

* A backend RESTful API to keep track of all store orders.

 

* Implemented this using Java JAX-RS and use JPA to store the orders in a SQL Database.

 

* Java EE is selected due to the nature of this application handling customer orders and potential billing information, failures are not acceptable for this service and security is our utmost importance.

 

Demo of Microservices App on Bluemix

Orders App

http://microservices-ordersapi-sonlethanh-166.mybluemix.net/

Demo of Microservices App on Bluemix

UI App

http://microservices-ui-sonlethanh-1613.mybluemix.net/

http://bit.ly/BluemixMeetup7Survey

Microservices Introduction

By triplez

Microservices Introduction

  • 1,099