SlideShare a Scribd company logo
REACTIVE	DISTRIBUTED
SYSTEMS	WITH	VERT.X
CLEMENT	ESCOFFIER
RED	HAT
VERT.X	IS	A	TOOLKIT	TO	BUILD
DISTRIBUTED	AND	REACTIVE	SYSTEMS
ON	TOP	OF	THE	JVM	USING	AN
ASYNCHRONOUS	NON-BLOCKING
DEVELOPMENT	MODEL.
TOOLKIT
Vert.x	is	a	plain	boring	jar
Vert.x	components	are	plain	boring	jars
Your	application	depends	on	this	set	of	jars
(classpath,	fat-jar,	...)
DISTRIBUTED
“You	know	you	have	a	distributed
system	when	the	crash	of	a	computer
you've	never	heards	of	stops	you
from	getting	any	work	done.”
(Leslie	Lamport)
REACTIVE	SYSTEMS
Responsive	-	they	respond	in	an	acceptable	time
Elastic	-	they	scale	up	and	down
Resilient	-	they	are	designed	to	handle	failures
gracefully
Asynchronous	-	they	interact	using	async	messages
http://www.reactivemanifesto.org/
REACTIVE	SYSTEMS	!=	REACTIVE
PROGRAMMING
REACTIVE	SYSTEMS	+	REACTIVE
PROGRAMMING
POLYGLOT
Vert.x	applications	can	be	developed	using
Java
Groovy
Ruby	(JRuby)
JavaScript	(Nashorn)
Ceylon
Scala
Kotlin
VERT.X
A	toolkit	to	build	distributed	systems
VERT.X
Build	distributed	systems:
Do	not	hide	the	complexity
Failure	as	first-class	citizen
Provide	the	building	blocks,	not	an	all-in-one	solution
WHAT	DOES	VERT.X	PROVIDE	?
TCP,	UDP,	HTTP	1	&	2	servers	and	clients
(non-blocking)	DNS	client
Clustering
Event	bus	(messaging)
Distributed	data	structures
(built-in)	Load-balancing
(built-in)	Fail-over
Pluggable	service	discovery,	circuit-breaker
Metrics,	Shell
REACTIVE
Build	reactive	distributed	systems:
Responsive	-	fast,	is	able	to	handle	a	large	number	of
events	/	connections
Elastic	-	scale	up	and	down	by	just	starting	and
stopping	nodes,	round-robin
Resilient	-	failure	as	first-class	citizen,	fail-over
Asynchronous	message-passing	-	asynchronous
and	non-blocking	development	model
ASYNCHRONOUS	&	NON-BLOCKING
ASYNCHRONOUS	&	NON-BLOCKING
// Synchronous development model
X x = doSomething(a, b);
// Asynchronous development model - callback variant
doSomething(a, b, // Params
ar -> { // Last param is a Handler<AsyncResult<X>>
// Result handler
});
// Asynchronous development model - future variant
Future<X> future = doSomething(a, b);
future.setHandler(
ar -> { /* Completion handler */ });
REQUEST	-	REPLY
INTERACTIONS
HTTP,	TCP,	RPC...
VERT.X	HELLO	WORLD
Vertx vertx = Vertx.vertx();
vertx.createHttpServer()
.requestHandler(request -> {
// Handler receiving requests
request.response().end("World !");
})
.listen(8080, ar -> {
// Handler receiving start sequence completion (AsyncResult)
if (ar.succeeded()) {
System.out.println("Server started on port "
+ ar.result().actualPort());
} else {
ar.cause().printStackTrace();
}
});
VERT.X	HELLO	WORLD
Invoke
EVENT	LOOPS
VERT.X	ASYNC	HTTP	CLIENT
HttpClient client = vertx.createHttpClient(
new HttpClientOptions()
.setDefaultHost("localhost")
.setDefaultPort(8081));
client.getNow("/", response -> {
// Handler receiving the response
// Get the content
response.bodyHandler(buffer -> {
// Handler to read the content
});
});
CHAINED	HTTP	REQUESTS
Invoke
INTERACTING	WITH	BLOCKING	SYSTEMS
MESSAGING
The	eventbus	-	the	spine	of	Vert.x	applications...
THE	EVENT	BUS
The	event	bus	is	the	nervous	system	of	vert.x:
Allows	different	components	to	communicate
regardless
the	implementation	language	and	their	location
whether	they	run	on	vert.x	or	not	(using	bridges)
Address:	Messages	are	sent	to	an	address
Handler:	Messages	are	received	by	Handlers.
POINT	TO	POINT
vertx.eventBus().send("address", "message");
vertx.eventBus().consumer("address", message -> {});
PUBLISH	/	SUBSCRIBE
vertx.eventBus().publish("address", "message");
vertx.eventBus().consumer("address", message -> {});
REQUEST	/	RESPONSE
vertx.eventBus().send("address", "message", reply -> {});
vertx.eventBus().consumer("address",
message -> { message.reply("response"); });
FROM	LOCAL	TO	CLUSTERED
Vert.x	instances	form	a	cluster
The	event	bus	is	distributed	on	all	the	cluster	members
Vertx.clusteredVertx(new VertxOptions(), result -> {
if (result.failed()) {
System.err.println("Cannot create a clustered vert.x : "
+ result.cause());
} else {
Vertx vertx = result.result();
// ...
}
});
DISTRIBUTED	EVENT	BUS
Almost	anything	can	send	and	receive	messages
DISTRIBUTED	EVENT	BUS
Let's	have	a	java	(Vert.x)	app,	and	a	node	app	sending
data	just	here:
DISTRIBUTED	EVENT	BUS
EVENTBUS	CLIENTS	AND	BRIDGES
Bridges
SockJS:	browser,	node.js
TCP:	languages	/	systems	able	to	open	a	TCP
socket
Stomp
AMQP
Camel
Clients:
Go,	C#,	C,	Python...
RELIABILITY	PATTERNS
Don't	be	fool,	be	prepared	to	fail
RELIABILITY
It's	not	about	being	bug-free	or	bullet	proof,
we	a	humans.
It's	about	being	prepared	to	fail,
and	handling	these	failures.
MANAGING	FAILURES
Distributed	communication	may	fail
AsyncResult	lets	us	manage	these	failures:
doSomethingAsync(param1, param2,
ar -> {
if (ar.failed()) {
System.out.println("D'oh, it has failed !");
} else {
System.out.println("Everything fine ! ");
}
});
MANAGING	FAILURES
Adding	timeouts
vertx.eventbus().send(..., ...,
new DeliveryOptions().setSendTimeout(1000),
reply -> {
if (reply.failed()) {
System.out.println("D'oh, he did not reply to me !");
} else {
System.out.println("Got a mail " + reply.result().body());
}
});
CIRCUIT	BREAKER
CIRCUIT	BREAKER
cb.executeWithFallback(future -> {
// Async operation
client.get("/", response -> {
response.bodyHandler(buffer -> {
future.complete("Ola " + buffer.toString());
});
})
.exceptionHandler(future::fail)
.end();
},
// Fallback
t -> "Sorry... " + t.getMessage() + " (" + cb.state() + ")"
)
// Handler called when the operation has completed
.setHandler(content -> /* ... */);
CIRCUIT	BREAKER
	 Invoke
VERTICLE	FAIL-OVER
Verticles	are	chunk	of	code	that	get	deployed	and	run
by	Vert.x
Verticles	can	deploy	other	verticles
Verticles	can	be	written	in	Java,	Groovy,	JavaScript,
Ruby,	Ceylon...
VERTICLE	FAIL-OVER
In	High-Availability	mode,	verticles	deployed	on	a
node	that	crashes	are	redeployed	on	a	sane	node	of
the	cluster.
VERTICLE	FAIL-OVER
Invoke
ELASTICITY	PATTERNS
Be	prepared	to	be	famous
ELASTICITY	PATTERNS
BALANCING	THE	LOAD
When	several	consumers	listen	to	the	same	address,
Vert.x	dispatches	the	sent	messages	using	a	round
robin.
So,	to	improve	the	scalability,	just	spawn	a	new	node!
BALANCING	THE	LOAD
BALANCING	THE	LOAD
Invoke
SCALING	HTTP
WHAT	ABOUT
PERFORMANCES	?
Because	we	do	it	well,	and	we	do	it	fast
TECHEMPOWER	-	FORTUNE
Request	->	JDBC	(query)	->	Template	engine	->
Response
THIS	IS	NOT	THE	END();
But	the	first	step	on	the	Vert.x	path
Reactive Distributed Applications with Vert.x
HOW	TO	START	?
http://vertx.io
http://vertx.io/blog/posts/introduction-to-vertx.html
http://escoffier.me/vertx-hol/	(HOL3180)
Reactive	Microservices	with	Vert.x	(CON5389)
https://jaxlondon.com/jax-awards/

More Related Content

PDF
PDF
「人月の神話」紹介プレゼン
PDF
Shootout! Template engines for the JVM
PDF
The Deploy Master: From Basic to Zero Downtime, Blue/Green, A/B and Canary
PDF
High Performance Data Storage in a Microservices Environment
PDF
Microservices with Docker, Kubernetes, and Jenkins
PDF
Write Powerful Javascript Modules To Make Your Apps DRY (Brian Leathem)
PDF
CDK 2.0: Docker, Kubernetes, And OSE On Your Desk (Langdon White)
「人月の神話」紹介プレゼン
Shootout! Template engines for the JVM
The Deploy Master: From Basic to Zero Downtime, Blue/Green, A/B and Canary
High Performance Data Storage in a Microservices Environment
Microservices with Docker, Kubernetes, and Jenkins
Write Powerful Javascript Modules To Make Your Apps DRY (Brian Leathem)
CDK 2.0: Docker, Kubernetes, And OSE On Your Desk (Langdon White)

Viewers also liked (20)

PDF
Containers: Under The Hood (Vincent Batts)
PDF
MicroServices for Java Developers
PDF
Kubernetes for Java Developers
PPTX
DevOps Moves To Production (Lori MacVittie)
PDF
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
PDF
Java and DevOps: Supercharge Your Delivery Pipeline with Containers
PPTX
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
PDF
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
PDF
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
PDF
Development with Vert.x: an event-driven application framework for the JVM
PDF
RESTful HATEOAS standards using Java based Katharsis
PDF
Architecting cloud-enabled applications using Spring-Integration 2.x
ODP
TDC 2014 SP - E o DeltaSpike ?
PDF
Microservices with Kubernetes, Docker, and Jenkins
PDF
Enterprise Integration Patterns na nuvem com Spring Integration
PDF
7 Must-Try User Experience Tactics For Developers (Tiffany Nolan & Catherine ...
PDF
It's not tools, Stupid
PDF
JavaOne 2016: The Deploy Master: From Basic to Zero Downtime, Blue/Green, A/B...
PDF
CDI Extensions e DeltaSpike
PDF
Agile Is A Four-Letter Word (Jen Krieger)
Containers: Under The Hood (Vincent Batts)
MicroServices for Java Developers
Kubernetes for Java Developers
DevOps Moves To Production (Lori MacVittie)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Java and DevOps: Supercharge Your Delivery Pipeline with Containers
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
Development with Vert.x: an event-driven application framework for the JVM
RESTful HATEOAS standards using Java based Katharsis
Architecting cloud-enabled applications using Spring-Integration 2.x
TDC 2014 SP - E o DeltaSpike ?
Microservices with Kubernetes, Docker, and Jenkins
Enterprise Integration Patterns na nuvem com Spring Integration
7 Must-Try User Experience Tactics For Developers (Tiffany Nolan & Catherine ...
It's not tools, Stupid
JavaOne 2016: The Deploy Master: From Basic to Zero Downtime, Blue/Green, A/B...
CDI Extensions e DeltaSpike
Agile Is A Four-Letter Word (Jen Krieger)
Ad

Similar to Reactive Distributed Applications with Vert.x (20)

PPTX
Vertx – reactive toolkit
PDF
Reactive microservices with eclipse vert.x
PDF
VertX Toolkit by makingdevs
PPTX
Reactive applications and microservices with Vert.x tool-kit
PDF
Reactive Polyglot Microservices with OpenShift and Vert.x
PDF
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
ODP
Vert.x keynote for EclipseCon 2013
PDF
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
PDF
Vert.x - 2014 JDay Lviv (English)
PPTX
Vert.x Event Driven Non Blocking Reactive Toolkit
PPTX
App Mod 04: Reactive microservices with eclipse vert.x
PDF
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
PDF
Building Reactive Microservices with Vert.x
PDF
vert.x 3.1 - be reactive on the JVM but not only in Java
PDF
Vertx Basics
PDF
Malmberg meetup June 2018 - Building microservices with Vert.x
PDF
Apps software development with Vert.X
PDF
Vertx In Action Asynchronous And Reactive Java Julien Ponge
PPT
JUDCon Brazil 2013 - Vert.x an introduction
PDF
Codemotion Amsterdam 2016 - Building microservices with Vert.x
Vertx – reactive toolkit
Reactive microservices with eclipse vert.x
VertX Toolkit by makingdevs
Reactive applications and microservices with Vert.x tool-kit
Reactive Polyglot Microservices with OpenShift and Vert.x
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
Vert.x keynote for EclipseCon 2013
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - 2014 JDay Lviv (English)
Vert.x Event Driven Non Blocking Reactive Toolkit
App Mod 04: Reactive microservices with eclipse vert.x
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
Building Reactive Microservices with Vert.x
vert.x 3.1 - be reactive on the JVM but not only in Java
Vertx Basics
Malmberg meetup June 2018 - Building microservices with Vert.x
Apps software development with Vert.X
Vertx In Action Asynchronous And Reactive Java Julien Ponge
JUDCon Brazil 2013 - Vert.x an introduction
Codemotion Amsterdam 2016 - Building microservices with Vert.x
Ad

More from Red Hat Developers (20)

PDF
DevNation Tech Talk: Getting GitOps
PDF
Exploring the power of OpenTelemetry on Kubernetes
PDF
GitHub Makeover | DevNation Tech Talk
PDF
Quinoa: A modern Quarkus UI with no hassles | DevNation tech Talk
PDF
Extra micrometer practices with Quarkus | DevNation Tech Talk
PDF
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
PDF
Integrating Loom in Quarkus | DevNation Tech Talk
PDF
Quarkus Renarde 🦊♥: an old-school Web framework with today's touch | DevNatio...
PDF
Containers without docker | DevNation Tech Talk
PDF
Distributed deployment of microservices across multiple OpenShift clusters | ...
PDF
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
PDF
Dear security, compliance, and auditing: We’re sorry. Love, DevOps | DevNatio...
PDF
11 CLI tools every developer should know | DevNation Tech Talk
PDF
A Microservices approach with Cassandra and Quarkus | DevNation Tech Talk
PDF
GitHub Actions and OpenShift: ​​Supercharging your software development loops...
PDF
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
PDF
Profile your Java apps in production on Red Hat OpenShift with Cryostat | Dev...
PDF
Kafka at the Edge: an IoT scenario with OpenShift Streams for Apache Kafka | ...
PDF
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
PDF
Level-up your gaming telemetry using Kafka Streams | DevNation Tech Talk
DevNation Tech Talk: Getting GitOps
Exploring the power of OpenTelemetry on Kubernetes
GitHub Makeover | DevNation Tech Talk
Quinoa: A modern Quarkus UI with no hassles | DevNation tech Talk
Extra micrometer practices with Quarkus | DevNation Tech Talk
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Integrating Loom in Quarkus | DevNation Tech Talk
Quarkus Renarde 🦊♥: an old-school Web framework with today's touch | DevNatio...
Containers without docker | DevNation Tech Talk
Distributed deployment of microservices across multiple OpenShift clusters | ...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
Dear security, compliance, and auditing: We’re sorry. Love, DevOps | DevNatio...
11 CLI tools every developer should know | DevNation Tech Talk
A Microservices approach with Cassandra and Quarkus | DevNation Tech Talk
GitHub Actions and OpenShift: ​​Supercharging your software development loops...
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
Profile your Java apps in production on Red Hat OpenShift with Cryostat | Dev...
Kafka at the Edge: an IoT scenario with OpenShift Streams for Apache Kafka | ...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Level-up your gaming telemetry using Kafka Streams | DevNation Tech Talk

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Big Data Technologies - Introduction.pptx
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Big Data Technologies - Introduction.pptx
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
sap open course for s4hana steps from ECC to s4
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation theory and applications.pdf
Programs and apps: productivity, graphics, security and other tools
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Encapsulation_ Review paper, used for researhc scholars

Reactive Distributed Applications with Vert.x