Microservices in a netshell

download Microservices in a netshell

If you can't read please download the document

Transcript of Microservices in a netshell

Microservices in a nutshell


Pranjut Gogoi
Senior Software Consultant
Knoldus software LLP

Agenda

What are microservices?

Why is it important?

How is it done?

Orchestration vs Choreography.

Pitfalls of microservices.

Demo.

What are microservices?

Microservices are small, autonomous services that work together.

Monolithic

Microservices are special SOA, Service oriented architecture.

If you can't make it good, at least make it look good- Bill Gates

O'reilly have this bee picture in their book

Honey sealing

Drone feeding

Queen attendants

Honeycomb building

Why is it important?

Technology Heterogeneity

Resilience

Scaling

Ease of Deployment

Organizational Alignment

Composability

Optimizing for Replaceability

Resilience:1. If one component of a systemfails, but that failure doesnt cascade, you can isolate the problem and the rest of thesystem can carry on working.2. Simian Army - Chaos monkey for failure testing.

Composable: Composability means reusability. Resure the same service for different purpose, native application, web application etc.

How does it work?

Orchestration architecture

Choreography architecture

Microservice design patterns

Orchestration

Choreography

Orchestration vs Choreography

An orchestration typically ties together lower level services. It is like a mediator. A choreography helps reduce coupling even further.

Orchestration is useful when you have control over all the actors in a process - when they're all in one domain of control and you can dictate the flow of activities. This is of course most often when you're specifying a business process that will be enacted inside one organisation that you have control over.

Choreography is a way of specifying how two or more parties - none of which has any control over the other parties' processes, or perhaps any visibility of those processes - can coordinate their activities and processes to share information and value. Use choreography when coordination across domains of control/visibility is required. You can think of choreography, in a simple scenario, as like a network protocol. It dictates acceptable patterns of requests and responses between parties.

Our application is almost built on this except each servcice each database.

Design patterns
Aggregator Pattern

Our application is almost built on this except each servcice each database.

Chained Pattern

The key part to remember is that the client is blocked until the complete chain of request/response

There are more to it. But I found good quality images for this two only.

Proxy pattern which is almost like the aggregator pattern.

Branch Microservice.

Shared data microservice.

Asynchonous messaging

Asynchronous Messaging

The key part to remember is that the client is blocked until the complete chain of request/response

There are more to it. But I found good quality images for this two only.

Proxy pattern which is almost like the aggregator pattern.

Branch Microservice.

Shared data microservice.

Asynchonous messaging

Pitfalls of microservices

Team members don't get any idea what's going on the complete application as they're more focus on their own module.

Understanding the what is microservice and how does it work. There was a case where an engineer had literally wrapped and hosted one microservice within another because he didn't understand how the services were supposed to communicate if they were in separate processes (or on separate machines).

Common util module configuration or code sharing among the micro services will help a lot of work easier but again that could be problem too. There was a case where one person defined a general abstraction to database library, but the database library wasn't well encapsulated (in fact it had a transitive dependency on an older version of our web server - Jetty).

Resilience:1. If one component of a systemfails, but that failure doesnt cascade, you can isolate the problem and the rest of thesystem can carry on working.2. Simian Army - Chaos monkey for failure testing.

Composable: Composability means reusability. Resure the same service for different purpose, native application, web application etc.

Cont...

Its more of a solution, so basically in order to communicate among the services we need to follow a messaging pattern, where AMQP and CQRS are two choices. However CQRS is a preferable pattern as AMQP sometime don't work well. However that will depend on the requirement of the communication.

As microservices increases the devOps burden increases as well, because each microservice will run in a different jvm and need to deploy them separately.

Resilience:1. If one component of a systemfails, but that failure doesnt cascade, you can isolate the problem and the rest of thesystem can carry on working.2. Simian Army - Chaos monkey for failure testing.

Composable: Composability means reusability. Resure the same service for different purpose, native application, web application etc.

Thank You