33
# vertx @ bjschrijver Building microservices with Vert.x Bert Jan Schrijver @bjschrijver [email protected]

Devoxx UK 2016 - Building microservices with Vert.x

Embed Size (px)

Citation preview

Page 1: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

Building microservices with Vert.x

Bert Jan Schrijver

@bjschrijver [email protected]

Page 2: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

Let’s meet

Bert Jan Schrijver

Page 3: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Introduction • Why Vert.x? • Basic demo • Deep dive • Advanced demo • Microservices with Vert.x • Vert.x in practice

Outline

Page 4: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Introduction • Why Vert.x? • Basic demo • Deep dive • Advanced demo • Microservices with Vert.x • Vert.x in practice

Introduction

MalmbergisaneducationalpublisherintheNetherlands.Malmbergisbuildingmodern,richand

scalablee-learningapplicationsusingJava8,Vert.x,AngularJSandMongoDB,runningonAmazoncloudservices.

Page 5: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Vert.

x bas

ics

Page 6: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Toolkit for building reactive applications on the JVM • General purpose application framework • Swiss army knife for building modern and scalable

web apps • Event-driven, non-blocking • Polyglot • Lightweight and fast • Fun to work with!

Vert.x: the basics

Page 7: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• We love open source • Powerful module system • Reactive characteristics

Why we chose Vert.x

Page 8: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

Vert.x is reactive

Page 9: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Demo

Page 10: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Vert.

x in

dept

h

Page 11: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Verticle, application, instance, JVM:

Vert.x in depth

HostJVM

Vert.x instance

Verticle

Event Bus

Verticle

Verticle

Verticle

JVM

Vert.x instance

Verticle

Verticle

Verticle

Verticle

Page 12: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Verticle, application, instance, JVM:Host

Vert.x in depth

HostJVM

Vert.x instance

Verticle

Event Bus

Verticle

Verticle

Verticle

JVM

Vert.x instance

Verticle

Verticle

Verticle

Verticle

Page 13: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Event driven and non blocking event loop • Multi-reactor pattern • Actor-like concurrency • Distributed event bus • Management and monitoring built-in

Vert.x in depth

Page 14: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Both request/response and publish/subscribe • All Vert.x instances have access to the event bus • Verticles interact using messages • Messages are received by Handlers

Vert.x event bus

Page 15: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Never ever ever block the event loop! • Need to to blocking stuff? Use a worker

Vert.x’s golden rule

Page 16: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

Vert.x in one slide

Source: http://www.slideshare.net/clement.escoffier/vertx-31-be-reactive-on-the-jvm-but-not-only-in-java

Page 17: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Demo

Page 18: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Vert.

x and

micros

ervic

es

Page 19: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Small in size, single responsibility • Runs in its own process • Has its own data store • Distributed by default • Independently develop, deploy, upgrade, scale • Potentially heterogeneous/polyglot • Light-weight communication

Anatomy of a microservice

Page 20: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Small in size, single responsibility • Runs in its own process • Has its own data store • Distributed by default • Independently develop, deploy, upgrade, scale • Potentially heterogeneous/polyglot • Light-weight communication

Anatomy of a Vert.x modulemicroservice

Page 21: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Vert.

x in

prac

tice

Page 22: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Organisation structure: • Core platform team (infrastructure) • Core modules team (Vert.x modules) • Product teams

• Deployment model: AWS, Nginx, MongoDB • A product consists of multiple lightweight artifacts • Re-use of Vert.x modules (no central services)

3 years of Vert.x: situation

Page 23: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Rolled our own deployment tooling and open sourced it(https://github.com/msoute/vertx-deploy-tools)

• Controlled from Jenkins • Zero-downtime deployments • Microservice deployments

3 years of Vert.x: deployments

Page 24: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Very suitable for test driven development • Integration tests with embedded MongoDB • Good cooperation with the Vert.x team

3 years of Vert.x: experiences

Page 25: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Callback hell • Java 8 helped a LOT • Rx fixes the remaining issues

• Blocking the event loop • Scaling / JVM overhead • Debugging • Static code analysis • Upgrade from Vert.x 2 to Vert.x 3

3 years of Vert.x: challenges

Page 26: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Almos

t the

re ;-

)

Page 27: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Summar

y

Page 28: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Vert.x: toolkit for reactive applications on the JVM • Polyglot, event-driven • Very suitable for building microservices

Summary

Page 29: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• https://github.com/bertjan/vertx3-examples • http://vertx.io • http://vertx.io/blog/my-first-vert-x-3-application • https://github.com/vert-x3/vertx-examples • http://github.com/msoute/vertx-deploy-tools

Vert.x resources

Don’t worry, I’ll tweet a link to the slide deck ;-)

Page 30: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

Q & A

Page 31: Devoxx UK 2016 - Building microservices with Vert.x

@YourTwitterHandle#DVXFR14{session hashtag}#vertx @bjschrijver

One m

ore t

hing…

Page 32: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• My next project with Vert.x:

One more thing…

Page 33: Devoxx UK 2016 - Building microservices with Vert.x

#vertx @bjschrijver

• Please care about conference quality • Rate this talk in the Devoxx app • Got feedback? Want to learn more? Let me know!

Thanks for your time!

All pictures belong to their respective authors

@[email protected]