Mciro Services & Zookeeper

15
MicroServices & ZooKeeper

Transcript of Mciro Services & Zookeeper

Page 1: Mciro Services & Zookeeper

MicroServices & ZooKeeper

Page 2: Mciro Services & Zookeeper

What is Monolithic Architecture

Complete functionality/Product is in same war file All tables/schemas are on same database

Page 3: Mciro Services & Zookeeper

Pros of Monolithic Architecture

Fast development In process latencies Generally good for Small scale. Less expensive.. Easy to manage less servers Ideal when starting a product

Page 4: Mciro Services & Zookeeper

Cons of Monolithic Architecture

Co-ordination overhead as team grows All or nothing deploy Long build time

Page 5: Mciro Services & Zookeeper

Pros/Cons of Monolithic Database !

Anyone !!

Page 6: Mciro Services & Zookeeper

Pros/Cons of Monolithic Database !

Anyone !!

Page 7: Mciro Services & Zookeeper

Requirements for Ideal Micro Services

Separation of FrontEnd and backend for example Angular JS Separation of databases..

Do you think there are more pros or Cons with Micro Services ??

Page 8: Mciro Services & Zookeeper

Pros of Micro Services

Teams can work independently Releases can go independently If one service goes down that doesn’t mean whole site is down. Cheap commodity servers can be used Can scale almost infinitely

Page 9: Mciro Services & Zookeeper

Cons of Micro Services

Network latency serialization-deserialization how to manage transactions co-ordination between services redundancy of data how to keep data in sync esp. when you have no transactions backward compatible with all existing clients because all client might not be changing with

the new release of service. Because it is so modular; dependencies between different services can be really complex...

something similar like calling that many functions.. So we need to make a call judiciously while deciding Micro Services.

Bottom line : Bad for performance as you need to do so much extra work !

Page 10: Mciro Services & Zookeeper

Then why to Use Micro Services !!!!!

This is the only solution when you have to scale almost infinitely

Page 11: Mciro Services & Zookeeper

How to Develop Micro Service

Formally define Interface.. Make sure only public methods are here.. which u want to expose to your clients. Talk to them before finalizing. It is not advisable to change this interface later.

Do a dummy implementation so that clients can start working on it simultaneously and not blocked because of u.

Design database schema which is self sufficient. Develop your Service Write JUnit for your Service.

Page 12: Mciro Services & Zookeeper

ZooKeeper

Why ZooKeeper ! Gives flexibility to manage complex services Gives Load Sharing

Page 13: Mciro Services & Zookeeper

Operate Zookeeper from Command prompt

Starting Server : zkServer.sh start Client Connecting : zkCli.sh -server 127.0.0.1:2181 Zk$ help Zk$ ls / Zk$ create /path pathdata [ creates /path directory ] Zk$ ls / Zk$ get /path Zk$ set /path newPathData Zk$ delete /path

Page 14: Mciro Services & Zookeeper

Operate Zookeeper via Java

Page 15: Mciro Services & Zookeeper

Questions ??