53
Micro Services Eberhard Wolff Freelancer / adesso AG http://ewolff.com Small is Beautiful

Micro Services - Small is Beautiful

Embed Size (px)

DESCRIPTION

General int

Citation preview

Page 1: Micro Services - Small is Beautiful

Micro Services

Eberhard Wolff Freelancer / adesso AG

http://ewolff.com

Small is Beautiful

Page 2: Micro Services - Small is Beautiful

Architecture of Enterprise

Java Apps

Page 3: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Page 4: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Page 5: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

How can I implement a

new feature???

Page 6: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff L

Page 7: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

ECommerce System

Spring & OSGi

New Stuff

Page 8: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

New Stuff Spring & OSGi

New Stuff

ECommerce System

Page 9: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

HTTP

New Stuff

Links

No legacy code Any technology

J Small code base

Page 10: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Micro Services: A Component Model

•  Separate process •  Individual deployment unit •  GUI (?) •  + Logic •  + database •  Independent technology stacks •  Small services + GUI – unlike SOA

Page 11: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Components Collaborate

Micro Service

Micro Service

Link

Data Replication

REST Messaging

Page 12: Micro Services - Small is Beautiful

Micro Service can easily integrate

with Legacy

Page 13: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Online Shop

Order

Catalog

Search

Billing

Page 14: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Online Shop

elasticsearch

Spring Batch Oracle

Spring MVC MongoDB

Order

Catalog

Search

Billing

Page 15: Micro Services - Small is Beautiful

Service might be even smaller

Page 16: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Continuous Delivery

Page 17: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Continuous Delivery: Build Pipeline

Commit Stage

Automated Acceptance

Testing

Automated Capacity Testing

Manual Explorative

Testing

Release

Page 18: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Without Micro Services •  Modify order process slightly •  Billing, Search & Catalog unchanged

Order

Catalog

Search

Billing

Page 19: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Order

Catalog

Search

Billing

Page 20: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Continuous Delivery: Everything Tested etc

Commit Stage

Automated Acceptance

Testing

Automated Capacity Testing

Manual Explorative

Testing

Release Order

Catalog

Search

Billing

Page 21: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Build Pipeline •  Just one component changed!

•  Lots of unneeded work

•  Takes much too long

Page 22: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

With Micro Services

Commit Stage

Automated Acceptance

Testing

Automated Capacity Testing

Manual Explorative

Testing

Release Order

Page 23: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Release •  Just a single component

•  Faster feedback

•  Easier deployment •  Rollback of single service also easier

Page 24: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

How to scale agile?

Implement more feature

Page 25: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Conways Law

Architecture copies

communication structures of the organization

Page 26: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Online Shop

Order

Catalog

Search

Billing

Component = Team

Page 27: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Micro Service •  Team independent from each other

•  No code dependencies •  Can use individual technology stack •  Can even deploy independently

•  Speed up development

Page 28: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Architecture Challenges •  Code Reuse? •  Handling interfaces? •  Managing dependencies between

(>100) Services? •  Global architecture? •  Global refactorings?

Page 29: Micro Services - Small is Beautiful

Install and configure App Server for each Microservice??

Page 30: Micro Services - Small is Beautiful

Spring Boot Demo

Page 31: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Why Spring Boot? •  Easier deployment •  i.e. just a JAR

•  Built in operations support

Page 32: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Technologies •  Dropwizard by Yammer

•  Vert.x

•  Play Framework

Page 33: Micro Services - Small is Beautiful

Deploy & Operate?

Page 34: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Component Model •  No restriction on languag &

environment •  Individual processes •  + infrastructure (database etc) •  JARs, WARs, EARs: No good fit •  Virtual machines as components? •  Overhead??

Page 35: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Docker •  No true virtualization

•  Linux Containers (lxc) •  i.e. shared kernel •  i.e. separate file systems

Page 36: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Docker File Systems •  Read only base images •  +read/write image

•  Can be stacked

Page 37: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Docker •  Linux only

•  So: Run it in VM

•  Controlled by Vagrant

Page 38: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Redis on Docker •  Small NoSQL database

•  In memory

•  Quite a few cool features

Page 39: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Vagrant VM

Docker ContainerRedis

Port6379

6379

6379

Page 40: Micro Services - Small is Beautiful

Docker Demo

Page 41: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Communication Between Docker Container

•  Via ports

•  Via data volumes

Page 42: Micro Services - Small is Beautiful

Docker is a Component

System

Page 43: Micro Services - Small is Beautiful

Example: Log File Analysis

Page 44: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

No Docker, no Micro Services •  Log file analysis •  One Application •  Store (database) •  Parse •  GUI •  One artifact on one server •  Logs provided e.g. by a port

Page 45: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Docker, Small Services •  Log file analysis •  ELK Stack •  Elasticsearch: Store •  Logstash: Parse •  Kibana: Web based GUI •  Install three servers •  Automate installation ... L

Page 46: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Dockerized ELK Stack •  1 Vagrantfile (25 lines) •  6 Dockerfiles (total 22 lines) •  1 HTML file (11 lines) •  1 Config (Logstash) (29 lines)

•  Total: 87 lines, 9 files •  Including one RegExp L

Page 47: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Vagrant VM

Containeruser-registration

8080

8081

Port8081

Containerelasticsearch

Containerlogstash

9200

9200

Port9200

9200

link

Containerkibana

Port8080

8080

8080

Browser

Volume/log

Page 48: Micro Services - Small is Beautiful

Demo ELK Stack

Page 49: Micro Services - Small is Beautiful

Individual Scaling per

Service

Page 50: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Links •  https://github.com/ewolff/user-

registration •  http://www.heise.de/developer/

artikel/Episode-44-Modularisierte-Architektur-fuer-grosse-Systeme-2195818.html

•  http://projects.spring.io/spring-boot/ •  http://www.docker.com/ •  http://www.docker.com/tryit

Page 51: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Page 52: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Micro Services •  A new hope against Java Monoliths •  Also great for legacy

•  Spring Boot for implementation

•  Docker as component model & runtime

Page 53: Micro Services - Small is Beautiful

Eberhard Wolff - @ewolff

Thank You!!

@ewolff