Top Banner
Building microservices with Vert.x Tim van Eijndhoven [email protected] @timveijndhoven
33

Building microservices with Vert.X @ Fall 2016

Apr 12, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Building microservices with Vert.X @ Fall 2016

Building microservices with Vert.x

[email protected] @timveijndhoven

Page 2: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Let’s meet!

Tim van Eijndhoven

Page 3: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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

Page 4: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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

MalmbergisaneducationalpublisherintheNetherlands.Malmbergisbuildingmodern,richand

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

Page 5: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Vert.x basics

Page 6: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Vert.x: the basics• 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!

Page 7: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Why did we choose Vert.x?• We love open source • Powerful module system • Reactive characteristics

Page 8: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Vert.x is reactive

Page 9: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Demo

Page 10: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Vert.x in depth

Page 11: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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

Page 12: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Vert.x in depth• Verticle, application, instance, JVM:

HostJVM

Vert.x instance

Verticle

Event Bus

Verticle

Verticle

Verticle

JVM

Vert.x instance

Verticle

Verticle

Verticle

Verticle

Page 13: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Vert.x in depth• Verticle, application, instance, JVM:

HostHostJVM

Vert.x instance

Verticle

Event Bus

Verticle

Verticle

Verticle

JVM

Vert.x instance

Verticle

Verticle

Verticle

Verticle

Page 14: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Vert.x event bus• 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

Page 15: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Vert.x’s golden rule• Never ever ever block the event loop • Need to do blocking stuff? Use a worker

Page 16: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Demo

Page 18: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Vert.x & microservices

Page 19: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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

Page 20: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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

microserviceVert.x module

Page 21: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Vert.x in practice

Page 22: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

3 years of Vert.x: situation• 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)

Page 23: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

3 years of Vert.x: deployments• Rolled our own deployment tooling and open

sourced it(https://github.com/msoute/vertx-deploy-tools)

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

Page 24: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

3 years of Vert.x: experiences• Very suitable for test driven development • Integration tests with embedded MongoDB • Good cooperation from the Vert.x team

Page 25: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

3 years of Vert.x: challenges• 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

Peter Hendriks RxJava from the Trenches

Page 26: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

Almost there ;-)

Page 27: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

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

Page 28: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

Resources• 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

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

Page 29: Building microservices with Vert.X @ Fall 2016

@bjschrijver@timveijndhoven

One more thing…

Page 30: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

More info: http://www.slideshare.net/BertJanSchrijver/javaone-ignite-2016-how-to-build-your-own-selfdriving-car

Page 31: Building microservices with Vert.X @ Fall 2016

@timveijndhoven

More info: http://www.slideshare.net/BertJanSchrijver/javaone-ignite-2016-how-to-build-your-own-selfdriving-car

Page 32: Building microservices with Vert.X @ Fall 2016

Questions?

@timveijndhoven

Page 33: Building microservices with Vert.X @ Fall 2016

Thanks for your time.Gotfeedback?Tweetit!

Allpicturesbelongtotheirrespective

authors

PleasevoteusingtheFallapp!@timveijndhoven