SlideShare a Scribd company logo
Vert.x – Event Driven Non Blocking Reactive Toolkit
Brian S Paskin, Senior Application Architect, R&D Services, IBM Cloud Innovations Lab
6 April 2020
WebSphere Liberty Lunch and Learn
Introduction
2
 Vert.x is an open source project by the Eclipse Foundation
 Is a reactive toolkit that can used as a serverless implementation or in an application
 Used for writing asynchronous network applications
 Supported under multiple Java based languages (polyglot)
– Java, Kotlin, JavaScript, Groovy, Ruby, Scala
 Has two programming methods, with or without Verticles (spelled that way)
 There are different libraries for databases, monitoring, logging, et cetera
 Non blocking and event driven that is scalable using an Event Bus
– Uses an Event Loop to process requests
– Event Bus to handle communications between Verticles
– Can span multiple JVMs and systems
 Can be used with Quarkus and GraalVM
 Requires Maven Shade to create a fat jar
Introduction
3
Event Loop
4
 Implementation of the multi Reactor design pattern
– Continuously checking for new events and pass it to the proper Handler
– Normal Reactor is single threaded, but Vert.x is multi-threaded
 Number of threads for the Event Loop depends on the number of processors
– Is equal to 2 * number of processors
– Not based on the number of Verticles deployed
– Threads are assigned in a round robin method for Verticles
 Verticles will always execute on the assigned thread
 Worker Verticles have their own thread pools
 The Context is passed to the Verticle from the Event Loop
– All Handlers in an Event Loop run using the same Context
– Each Context has its own error handler
– Maintains thread safety
 Never block the event loop
Event Loop, Contexts, and Verticles
5
Verticles
6
 A Verticle is a unit of deployment
 Assigned a Thread in an Event Loop
 Each Verticle has an isolated classloader and cannot share global state
 Verticles can be passed configuration information
 2 Different Types of Verticles
– Standard
– Workers
 A standard Verticle should be quick and a non blocking unit of work
 A worker Verticle is like a standard Verticle but using a different Thread pool
– Can call blocking code
– Used for limiting number of executions of code (ie. calling backend system)
 Can be run in high available mode
– Deploys new Verticle if it dies abruptly
Event Bus
7
 The Event Bus is used for Verticles to communicate with each other by sending messages
– Single instance per Vert.x instance
– Asynchronous
 Can be used with Verticles in the same JVM or across multiple JVMs and systems
– Outside of a single JVM Hazelcast is used to transport messages
 Can be used to communicate with JavaScript
 Three types of messaging
– Publish and subscribe
– Point to point
– Request – response
 Failures in all or part of the Event Bus may lead to lost messages
Introduction
8
Common Libraries Highlights
9
 Core
– Deploy Verticles
– HTTP Server
– Basic Event Bus
– Logging
– JSON and Parser
– Datagrams
– Metrics
– High availability and failover
– Timer events
– Buffers
 Web
– Route requests to Handlers and sub routers
– Routing based on criteria (HTTP Method, MIME type, etc.)
– Authentication (OAuth, Basic)
– Serve web pages
– CORS
– Uploads
– Cookie Handling
– Form handling
– Virtual hosts
– SockJS support
Common Libraries Highlights
10
 Configuration
– Multiple formats (JSON, Properties, YAML, HOCON, System Props, Environment Entries, etc.)
– Can read default configuration file or specify file
– Different configurations can be passed to different Verticles
 JDBC Client
 MongoDB Client
 SQL Common
– Used in conjunction of one of the other data access libraries
 Reactive
– Uses RxJava
 Circuit Breaks for Micro Services
 MQTT
 Kafka Client
 Mail Client
More information
11
 Sample code on GitHub
 Libraries
 Build a starter application
Vert.x Event Driven Non Blocking Reactive Toolkit

More Related Content

What's hot (16)

DOCX
Valgrind debugger Tutorial
Anurag Tomar
 
PPTX
Introduction to Kafka and Event-Driven
Dimosthenis Botsaris
 
PDF
Connection Pooling in PostgreSQL using pgbouncer
Sameer Kumar
 
PDF
8 statement-level control structure
jigeno
 
PPT
Chapter 6-Consistency and Replication.ppt
sirajmohammed35
 
PDF
Ansible 入門 #01 (初心者向け)
Taro Hirose
 
PPTX
What are thread libraries in operating system
geethasenthil2706
 
PPTX
File system node js
monikadeshmane
 
PPT
Chapter 9 - Virtual Memory
Wayne Jones Jnr
 
PDF
2015年度GPGPU実践プログラミング 第6回 パフォーマンス解析ツール
智啓 出川
 
PPTX
OOPS in Java
Zeeshan Khan
 
PPT
Operating-System Structures
K Gowsic Gowsic
 
PDF
Keeping Latency Low for User-Defined Functions with WebAssembly
ScyllaDB
 
PPT
Galvin-operating System(Ch1)
dsuyal1
 
PPT
Chapter 8 - Main Memory
Wayne Jones Jnr
 
Valgrind debugger Tutorial
Anurag Tomar
 
Introduction to Kafka and Event-Driven
Dimosthenis Botsaris
 
Connection Pooling in PostgreSQL using pgbouncer
Sameer Kumar
 
8 statement-level control structure
jigeno
 
Chapter 6-Consistency and Replication.ppt
sirajmohammed35
 
Ansible 入門 #01 (初心者向け)
Taro Hirose
 
What are thread libraries in operating system
geethasenthil2706
 
File system node js
monikadeshmane
 
Chapter 9 - Virtual Memory
Wayne Jones Jnr
 
2015年度GPGPU実践プログラミング 第6回 パフォーマンス解析ツール
智啓 出川
 
OOPS in Java
Zeeshan Khan
 
Operating-System Structures
K Gowsic Gowsic
 
Keeping Latency Low for User-Defined Functions with WebAssembly
ScyllaDB
 
Galvin-operating System(Ch1)
dsuyal1
 
Chapter 8 - Main Memory
Wayne Jones Jnr
 

Similar to Vert.x Event Driven Non Blocking Reactive Toolkit (20)

PPTX
Vertx
Vijay Shukla
 
PPTX
Vert.x for Microservices Architecture
Idan Fridman
 
PDF
Vert.X like Node.js but polyglot and reactive on JVM
Massimiliano Dessì
 
PDF
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Saeed Zarinfam
 
PPTX
Vert.x v3 - high performance polyglot application toolkit
Sages
 
ODP
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
PPTX
Building microservices with vert.x 3.0
Agraj Mangal
 
PDF
Vert.x - Dessì
Codemotion
 
PPTX
Vert.x devoxx london 2013
Stuart (Pid) Williams
 
PDF
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
jaxLondonConference
 
PPTX
Event driven systems
Shatabda Majumdar
 
PPT
JUDCon Brazil 2013 - Vert.x an introduction
Samuel Tauil
 
PDF
BASICS OF VERT.X - A toolkit for building asynchronous and reactive app
HanaStevanovic
 
PDF
Development with Vert.x: an event-driven application framework for the JVM
David Wu
 
PDF
Vertx In Action Asynchronous And Reactive Java Julien Ponge
ratanaarizbe
 
PDF
Vert.x introduction
GR8Conf
 
ODP
Vert.x keynote for EclipseCon 2013
timfox111
 
PDF
Building Reactive Microservices with Vert.x
Claudio Eduardo de Oliveira
 
PDF
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
tdc-globalcode
 
Vert.x for Microservices Architecture
Idan Fridman
 
Vert.X like Node.js but polyglot and reactive on JVM
Massimiliano Dessì
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Saeed Zarinfam
 
Vert.x v3 - high performance polyglot application toolkit
Sages
 
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
Building microservices with vert.x 3.0
Agraj Mangal
 
Vert.x - Dessì
Codemotion
 
Vert.x devoxx london 2013
Stuart (Pid) Williams
 
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
jaxLondonConference
 
Event driven systems
Shatabda Majumdar
 
JUDCon Brazil 2013 - Vert.x an introduction
Samuel Tauil
 
BASICS OF VERT.X - A toolkit for building asynchronous and reactive app
HanaStevanovic
 
Development with Vert.x: an event-driven application framework for the JVM
David Wu
 
Vertx In Action Asynchronous And Reactive Java Julien Ponge
ratanaarizbe
 
Vert.x introduction
GR8Conf
 
Vert.x keynote for EclipseCon 2013
timfox111
 
Building Reactive Microservices with Vert.x
Claudio Eduardo de Oliveira
 
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
tdc-globalcode
 
Ad

Recently uploaded (20)

PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
PPT
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
PPTX
internet básico presentacion es una red global
70965857
 
PDF
Web Hosting for Shopify WooCommerce etc.
Harry_Phoneix Harry_Phoneix
 
PPT
introduction to networking with basics coverage
RamananMuthukrishnan
 
PPT
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
PPTX
INTEGRATION OF ICT IN LEARNING AND INCORPORATIING TECHNOLOGY
kvshardwork1235
 
PPTX
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PPTX
一比一原版(LaTech毕业证)路易斯安那理工大学毕业证如何办理
Taqyea
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
PPTX
ZARA-Case.pptx djdkkdjnddkdoodkdxjidjdnhdjjdjx
RonnelPineda2
 
PDF
DevOps Design for different deployment options
henrymails
 
PPT
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
internet básico presentacion es una red global
70965857
 
Web Hosting for Shopify WooCommerce etc.
Harry_Phoneix Harry_Phoneix
 
introduction to networking with basics coverage
RamananMuthukrishnan
 
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
INTEGRATION OF ICT IN LEARNING AND INCORPORATIING TECHNOLOGY
kvshardwork1235
 
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
一比一原版(LaTech毕业证)路易斯安那理工大学毕业证如何办理
Taqyea
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
ZARA-Case.pptx djdkkdjnddkdoodkdxjidjdnhdjjdjx
RonnelPineda2
 
DevOps Design for different deployment options
henrymails
 
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Ad

Vert.x Event Driven Non Blocking Reactive Toolkit

  • 1. Vert.x – Event Driven Non Blocking Reactive Toolkit Brian S Paskin, Senior Application Architect, R&D Services, IBM Cloud Innovations Lab 6 April 2020 WebSphere Liberty Lunch and Learn
  • 2. Introduction 2  Vert.x is an open source project by the Eclipse Foundation  Is a reactive toolkit that can used as a serverless implementation or in an application  Used for writing asynchronous network applications  Supported under multiple Java based languages (polyglot) – Java, Kotlin, JavaScript, Groovy, Ruby, Scala  Has two programming methods, with or without Verticles (spelled that way)  There are different libraries for databases, monitoring, logging, et cetera  Non blocking and event driven that is scalable using an Event Bus – Uses an Event Loop to process requests – Event Bus to handle communications between Verticles – Can span multiple JVMs and systems  Can be used with Quarkus and GraalVM  Requires Maven Shade to create a fat jar
  • 4. Event Loop 4  Implementation of the multi Reactor design pattern – Continuously checking for new events and pass it to the proper Handler – Normal Reactor is single threaded, but Vert.x is multi-threaded  Number of threads for the Event Loop depends on the number of processors – Is equal to 2 * number of processors – Not based on the number of Verticles deployed – Threads are assigned in a round robin method for Verticles  Verticles will always execute on the assigned thread  Worker Verticles have their own thread pools  The Context is passed to the Verticle from the Event Loop – All Handlers in an Event Loop run using the same Context – Each Context has its own error handler – Maintains thread safety  Never block the event loop
  • 5. Event Loop, Contexts, and Verticles 5
  • 6. Verticles 6  A Verticle is a unit of deployment  Assigned a Thread in an Event Loop  Each Verticle has an isolated classloader and cannot share global state  Verticles can be passed configuration information  2 Different Types of Verticles – Standard – Workers  A standard Verticle should be quick and a non blocking unit of work  A worker Verticle is like a standard Verticle but using a different Thread pool – Can call blocking code – Used for limiting number of executions of code (ie. calling backend system)  Can be run in high available mode – Deploys new Verticle if it dies abruptly
  • 7. Event Bus 7  The Event Bus is used for Verticles to communicate with each other by sending messages – Single instance per Vert.x instance – Asynchronous  Can be used with Verticles in the same JVM or across multiple JVMs and systems – Outside of a single JVM Hazelcast is used to transport messages  Can be used to communicate with JavaScript  Three types of messaging – Publish and subscribe – Point to point – Request – response  Failures in all or part of the Event Bus may lead to lost messages
  • 9. Common Libraries Highlights 9  Core – Deploy Verticles – HTTP Server – Basic Event Bus – Logging – JSON and Parser – Datagrams – Metrics – High availability and failover – Timer events – Buffers  Web – Route requests to Handlers and sub routers – Routing based on criteria (HTTP Method, MIME type, etc.) – Authentication (OAuth, Basic) – Serve web pages – CORS – Uploads – Cookie Handling – Form handling – Virtual hosts – SockJS support
  • 10. Common Libraries Highlights 10  Configuration – Multiple formats (JSON, Properties, YAML, HOCON, System Props, Environment Entries, etc.) – Can read default configuration file or specify file – Different configurations can be passed to different Verticles  JDBC Client  MongoDB Client  SQL Common – Used in conjunction of one of the other data access libraries  Reactive – Uses RxJava  Circuit Breaks for Micro Services  MQTT  Kafka Client  Mail Client
  • 11. More information 11  Sample code on GitHub  Libraries  Build a starter application

Editor's Notes

  • #3: Serverless implementation – an App Server/Transaction processor is not needed. SpringBoot is serverless. Reactive programming is a programming paradigm, associated with asynchronous streams, which respond to any changes or events. Vert.x uses an event bus, to communicate with different parts of the application and passes events, asynchronously to handlers when they available. a verticle is a unit of deployment Vert.x does not follow the JEE / Jakarta EE standards Uses Netty and Hazelcast under the covers Need Maven Shade to create a fat jar.
  • #5: https://medium.com/@alexey.soshin/understanding-vert-x-event-loop-46373115fb3e https://vertx.io/blog/an-introduction-to-the-vert-x-context-object/ https://vertx.io/docs/vertx-core/java/
  • #6: https://vertx.io/blog/an-introduction-to-the-vert-x-context-object/
  • #7: https://vertx.io/docs/guide-for-java-devs/
  • #8: \
  • #10: https://vertx.io/docs
  • #11: https://vertx.io/docs