SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
REACTIVE	POLYGLOT
MICROSERVICES	WITH
OPENSHIFT	AND	VERT.X
	
CLEMENT	ESCOFFIER
Vert.x	Core	Developer,	Red	Hat
VERT.X
I N 	 1 0 	 S L I D E S . . .
V E R T. X 	I S 	 A 	 TO O L K I T 	T O 	 B U I L D
D I S T R I B U T E D 	 A N D 	 R E AC T I V E
S Y S T E M S 	 O N 	 T O P 	 O F 	 T H E 	 J V M 	U S I N G
A N 	 A S Y N C H R O N O U S 	 N O N - B L O C K I N G
D E V E L O P M E N T 	 M O D E L .
TOOLKIT
Vert.x	is	a	plain	boring	jar
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
Reactive	systems	are
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/
POLYGLOT
vertx.createHttpServer()
.requestHandler(req -> req.response().end("Hello Java"))
.listen(8080);
vertx.createHttpServer()
.requestHandler({ req -> req.response().end("Hello Groovy") })
.listen(8080)
vertx.createHttpServer()
.requestHandler(function (req) {
req.response().end("Hello JavaScript")
})
.listen(8080);
vertx.createHttpServer()
.requestHandler(req => req.response().end("Hello Scala"))
.listen(8080)
MICROSERVICES
R E B R A N D I N G
D I S T R I B U T E D
A P P L I C A T I O N S
MICROSERVICES
“ 	The	microservice	architectural	style	is	an	approach	to
developing	a	single	application	as	a	suite	of	small	services,
each	running	in	its	own	process	and	communicating	with
lightweight	mechanisms,	often	an	HTTP	resource	API.
These	services	are	built	around	business	capabilities	and
independently	deployable	by	fully	automated	deployment
machinery.	There	is	a	bare	minimum	of	centralized
management	of	these	services,	which	may	be	written	in
different	programming	languages	and	use	different	data
storage	technologies.	(Martin	Fowler)
A	SUITE	OF	INDEPENDENT
SERVICES:
Each	service	runs	in	its	own	process
So	they	are	distributed	applications 	
Lightweight	interactions	-	Loose-coupling
Not	only	HTTP
Messaging
Streams
(async)	RPC
A	SUITE	OF	INDEPENDENT
SERVICES:
Independently	developed,	tested	and	deployed
Automated	process
(Liskov)	substitutability
It's	all	about	agility
NO	FREE	LUNCH
VERT.X	&	MICROSERVICES
We	wont'	build	regular	microservices,	but	reactive
microservices
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
PICK	YOUR	OWN
DEVELOPMENT	MODEL
vertx.createHttpServer()
.requestHandler(request -> {
doA("Austin", ar -> {
doB("Reactive Summit", ar2 -> {
request.response().end(ar.result() + "n" + ar2.result());
});
});
}).listen(8080);
PICK	YOUR	OWN
DEVELOPMENT	MODEL
vertx.createHttpServer()
.requestHandler(request -> {
Future<String> a = doA("Austin");
Future<String> b = doB("Reactive Summit");
CompositeFuture.all(a, b).setHandler(ar -> {
request.response().end(a.result() + "n" + b.result());
});
}).listen(8080);
PICK	YOUR	OWN
DEVELOPMENT	MODEL
vertx.createHttpServer()
.requestHandler(request -> {
CompletableFuture<String> a = doA("Austin");
CompletableFuture<String> b = doB("Reactive Summit");
CompletableFuture.allOf(a, b).thenRun(() -> {
request.response().end(a.join() + "n" + b.join());
});
}).listen(8080);
PICK	YOUR	OWN
DEVELOPMENT	MODEL
HttpServer server = vertx.createHttpServer();
server.requestStream().toObservable()
.subscribe(req -> {
Observable<String> a = doA("Austin");
Observable<String> b = doB("Reactive Summit");
Observable.zip(a, b, (s1, s2) -> s1 + "n" + s2)
.subscribe(s -> req.response().end(s));
});
server.listen(8080);
WHAT	DOES	VERT.X
PROVIDE	TO	BUILD
MICROSERVICES?
TCP,	UDP,	HTTP	1	&	2	servers	and	clients
(non-blocking)	DNS	client
Event	bus	(messaging)
Distributed	data	structures
Load-balancing
Fail-over
Service	discovery
Failure	management,	Circuit-breaker
Shell,	Metrics,	Deployment	support
HTTP	&	REST
B E C A U S E 	 I T 	 A L W A Y S
B E G I N 	 W I T H 	 A 	 R E S T
VERT.X	HELLO	WORLD
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
E V E N T 	 L O O PS
VERT.X	ASYNC	HTTP	CLIENT
HttpClient client = vertx.createHttpClient(
new HttpClientOptions()
.setDefaultHost(host)
.setDefaultPort(port));
client.getNow("/", response -> {
// Handler receiving the response
// Get the content
response.bodyHandler(buffer -> {
// Handler to read the content
});
});
SERVICE	DISCOVERY
Locate	the	services,	environment-agnostic
SERVICE	DISCOVERY	-
KUBERNETES
No	need	for	publication	-	Import	Kubernetes	services
HttpEndpoint.getClient(discovery,
new JsonObject().put("name", "vertx-http-server"),
result -> {
if (result.failed()) {
rc.response().end("D'oh no matching service");
return;
}
HttpClient client = result.result();
client.getNow("/", response -> {
response.bodyHandler(buffer -> {
rc.response().end("Hello " + buffer.toString());
});
});
});
CHAINED	HTTP	REQUESTS
Invoke
MESSAGING	WITH
THE	EVENT	BUS
T H E 	 S P I N E 	 O F 	 V E R T . X
A P P L I C A T I O N S
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	in	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"); });
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:
bonjour	from	node	(248)
hello	from	java	(286)
bonjour	from	node	(247)
hello	from	java	(285)
bonjour	from	node	(246)
hello	from	java	(284)
bonjour	from	node	(245)
hello	from	java	(283)
bonjour	from	node	(244)
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,	Swift...
RELIABILITY
PATTERNS
D O N ' T 	 B E 	 F O O L , 	 B E
P R E P A R E D 	 T O 	 FA I L
RELIABILITY
It's	not	about	being	bug-free	or	bullet	proof,
it's	impossible.
It's	about	being	prepared	to	fail,
and	handling	these	failures.
MANAGING	FAILURES
Distributed	communication	may	fail
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());
}
});
MANAGING	FAILURES
	
Invoke
CIRCUIT	BREAKER
CIRCUIT	BREAKER
cb.executeWithFallback(future -> {
// Async operation
client.get("/", response -> {
response.bodyHandler(buffer -> {
future.complete("Hello " + 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
SCALABILITY
PATTERNS
B E 	 P R E P A R E D 	 T O 	 B E
F A M O U S
E L A S T I C I T Y 	 P A T T E R N S
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
THIS	IS	NOT	THE
END()
BUT	THE	FIRST	STEP	ON	THE	REACTIVE
MICROSERVICE	ROAD
HOW	TO	START	?
https://www.openshift.org 	
http://vertx.io
http://vertx.io/blog/posts/introduction-to-vertx.html
http://escoffier.me/vertx-hol 	
Secure	Enclaves	For	Reactive	Cloud	Applications
@clementplop
THANK	YOU!
					clement.escoffier@redhat.com

Más contenido relacionado

La actualidad más candente

Distributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsDistributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with Events
Steve Pember
 
CloudCamp justin cormack hypervise my app!
CloudCamp   justin cormack    hypervise my app! CloudCamp   justin cormack    hypervise my app!
CloudCamp justin cormack hypervise my app!
Chris Purrington
 

La actualidad más candente (7)

Distributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsDistributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with Events
 
Introduction and Overview of OpenStack for IaaS
Introduction and Overview of OpenStack for IaaSIntroduction and Overview of OpenStack for IaaS
Introduction and Overview of OpenStack for IaaS
 
CloudCamp justin cormack hypervise my app!
CloudCamp   justin cormack    hypervise my app! CloudCamp   justin cormack    hypervise my app!
CloudCamp justin cormack hypervise my app!
 
Scalable and Available Services with Docker and Kubernetes
Scalable and Available Services with Docker and KubernetesScalable and Available Services with Docker and Kubernetes
Scalable and Available Services with Docker and Kubernetes
 
Devoxx university - Kafka de haut en bas
Devoxx university - Kafka de haut en basDevoxx university - Kafka de haut en bas
Devoxx university - Kafka de haut en bas
 
Perfug 20-11-2019 - Kafka Performances
Perfug 20-11-2019 - Kafka PerformancesPerfug 20-11-2019 - Kafka Performances
Perfug 20-11-2019 - Kafka Performances
 
Microservices: 5 things I wish I'd known - Vincent Kok - Codemotion Amsterdam...
Microservices: 5 things I wish I'd known - Vincent Kok - Codemotion Amsterdam...Microservices: 5 things I wish I'd known - Vincent Kok - Codemotion Amsterdam...
Microservices: 5 things I wish I'd known - Vincent Kok - Codemotion Amsterdam...
 

Similar a Reactive Polyglot Microservices with OpenShift and Vert.x

Iaetsd robo control sytsem design using arm
Iaetsd robo control sytsem design using armIaetsd robo control sytsem design using arm
Iaetsd robo control sytsem design using arm
Iaetsd Iaetsd
 

Similar a Reactive Polyglot Microservices with OpenShift and Vert.x (20)

Reactive applications and microservices with Vert.x tool-kit
Reactive applications and microservices with Vert.x tool-kitReactive applications and microservices with Vert.x tool-kit
Reactive applications and microservices with Vert.x tool-kit
 
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYCBuilding a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
 
LF_OVS_17_LXC Linux Containers over Open vSwitch
LF_OVS_17_LXC Linux Containers over Open vSwitchLF_OVS_17_LXC Linux Containers over Open vSwitch
LF_OVS_17_LXC Linux Containers over Open vSwitch
 
Vert.x keynote for EclipseCon 2013
Vert.x keynote for EclipseCon 2013Vert.x keynote for EclipseCon 2013
Vert.x keynote for EclipseCon 2013
 
Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016
Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016
Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016
 
The Big Picture - Integrating Buzzwords
The Big Picture - Integrating BuzzwordsThe Big Picture - Integrating Buzzwords
The Big Picture - Integrating Buzzwords
 
Microservices Practitioner Summit Jan '15 - Don't Build a Distributed Monolit...
Microservices Practitioner Summit Jan '15 - Don't Build a Distributed Monolit...Microservices Practitioner Summit Jan '15 - Don't Build a Distributed Monolit...
Microservices Practitioner Summit Jan '15 - Don't Build a Distributed Monolit...
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Netcomposer
NetcomposerNetcomposer
Netcomposer
 
My Gentle Introduction to RxJS
My Gentle Introduction to RxJSMy Gentle Introduction to RxJS
My Gentle Introduction to RxJS
 
Microservices in a Streaming World
Microservices in a Streaming WorldMicroservices in a Streaming World
Microservices in a Streaming World
 
Demystifying openvswitch
Demystifying openvswitchDemystifying openvswitch
Demystifying openvswitch
 
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
 
Iaetsd robo control sytsem design using arm
Iaetsd robo control sytsem design using armIaetsd robo control sytsem design using arm
Iaetsd robo control sytsem design using arm
 
RestMS Introduction
RestMS IntroductionRestMS Introduction
RestMS Introduction
 
Next generation of frontend architectures
Next generation of frontend architecturesNext generation of frontend architectures
Next generation of frontend architectures
 
9th SDN Expert Group Seminar - Session3
9th SDN Expert Group Seminar - Session39th SDN Expert Group Seminar - Session3
9th SDN Expert Group Seminar - Session3
 
Beyond static configuration
Beyond static configurationBeyond static configuration
Beyond static configuration
 
Creating Packages that Run Anywhere with Chef Habitat
Creating Packages that Run Anywhere with Chef HabitatCreating Packages that Run Anywhere with Chef Habitat
Creating Packages that Run Anywhere with Chef Habitat
 
NOSQL Database: Apache Cassandra
NOSQL Database: Apache CassandraNOSQL Database: Apache Cassandra
NOSQL Database: Apache Cassandra
 

Más de Reactivesummit

Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.
Reactivesummit
 

Más de Reactivesummit (6)

Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafka
 
Microservices: The danger of overhype and importance of checklists
Microservices: The danger of overhype and importance of checklistsMicroservices: The danger of overhype and importance of checklists
Microservices: The danger of overhype and importance of checklists
 
Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.
 
The Zen Of Erlang
The Zen Of ErlangThe Zen Of Erlang
The Zen Of Erlang
 
Monolith to Reactive Microservices
Monolith to Reactive MicroservicesMonolith to Reactive Microservices
Monolith to Reactive Microservices
 
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
 

Último

Último (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Reactive Polyglot Microservices with OpenShift and Vert.x