SlideShare ist ein Scribd-Unternehmen logo
1 von 35
BUILDING MICROSERVICES
WITH VERT.X 3.0
AGRAJ MANGAL
AGENDA
• Microservices
• Why, why not ?
• Comparison with Monolithic Architecture
• Vert.x
• Concepts: Event Loop, Verticles, Event Bus
• Modules: core, web
• Comparisons
• Real-life Example - Pulse
MONOLITHIC ARCHITECTURE
• Logically Different Modules
• But Packaged & deployed as a Single Unit
• Initial Phases of Project
• Simple to Deploy
• Vertical Scaling
• Later on
• Difficult to Manage & Scale
• Longer Startup Times
• Slow down Development
• CI becomes challenging
MICROSERVICES PATTERN
• Split into Smaller, Interconnected Services
• Loose Coupling
• Service == Functional Area
• Service exposes APIs – consumed by other services & clients
FINE GRAINED VIEW
BENEFITS
• Enforces Modularity
• Decomposing complexity
• Manageable chunks
• Each service – well defined boundary
• Independent Development
• Different Teams
• Different Technologies
• Easy to test
• Scaling is Easy
• Each service can be scaled independently
• Different Service might have different requirements ( CPU, Memory )
SCALING
MICROSERVICES
SERVICES
COMMUNICATING
DRAWBACKS
• Partitioned Database Architecture
• Have to settle for Eventual Consistency
• ACID transactions not possible
• Deploying
• Though scalable, but more complex
• Many more moving parts
• Service Discovery required
• Polyglot (Java, JavaScript, Groovy, Ruby, Python etc.)
• Event-driven & Non-blocking programming model
• Super simple Concurrency Model
• Lightweight ~ 650Kb
• “Ideal choice for creating light-weight, high-
performance, microservices”
• Public module repository
• Reactive applications
• Asynchronous APIs
CONCEPTS
• Event Loop
• Verticles
• Server Verticles
• Worker Verticles
• Event Bus
• Point to Point
• Pub/Sub
• Distributed
THE FAMOUS EVENT LOOP
ARCHITECTURE
• Don’t Block the Event Loop
• Workers “can” block
• Message Passing using Event Bus
• Concurrency Model
• A Verticle instance is always Single threaded
• No more Locking, synchronized & race conditions
• Actor-like concurrency model
• Scaling
• By Creating more Verticle Instances
• For TCP & HTTP servers, Vert.x does automatic load balancing
• Use FAT Jar for Deployment
VERT.X MODULES
• Core
• Web
• Data Access
• MongoDB, JDBC, Redis, MySQL
• Authentication Modules
• JWT, OAuth 2, JDBC Auth, Shiro Auth, MongoDB auth
• Messaging Systems
• Kafka, RabbitMQ
• Clustering – Hazelcast
VERT.X CORE
• Servers & clients
• TCP/SSL
• HTTP/HTTPS
• Websocket & SockJS
• EventBus
• Shared Maps & Sets
• Buffers & Flow Control
• Container API – Deploy & Undeploy Verticles
• Timers & Files
• Logging
• Configuration
VERT.X HTTP SERVER – HELLO WORLD
VERT.X WEB
• Routing
• Regex Matching
• Request Body Handling, parameters extraction
• Cookie Parsing & Handling
• Multipart Form & File Upload
• Session support ( sticky & non-sticky )
• CORS & CSRF Support
• Authentication & Authorization
• SockJS Support
VERT.X WEB HELLO WORLD
ROUTING
ROUTING
• Chain of Routers
• Either “end” it
• Or pass it to the “next” one
• Various Options – Route by
• HTTP Method Type
• Exact Path
• Regex Matching
• MIME type of request
• Decide Routing Order
VERT.X WEB
• BodyHandler
• Retrieve Request Body
• Limit Body Size
• Handle File Uploads
• CookieHandler
• Get, Add, Delete Cookie
• SessionHandler
• Sticky & Non-Sticky Sessions
• Vert.x don’t put actual data in Session Cookie – Session UUID is used to
lookup data on the server
• Session timeouts
VERT.X WEB
• Authentication & Authorization
• Support for Basic-Auth, Redirect-Auth, FormLogin
• JWT
• OAuth2
• Static Resources
• StaticHandler
• Caching – set headers ( cache-control, last-modified, date )
• Configurable webroot, index page
• Disable File Caching - .vertx
• Templating Support
• Handlebars, Jade, MVEL, Thymeleaf
• CORS & CSFR Handlers
DISTRIBUTED SUPPORT
DISTRIBUTED EVENT BUS
• Connect multiple Vert.x
instances across JVMs
• Event bus extends to client side
Javascript
• Ideal for “real-time” web
applications
• vertx-eventbus.js
CLUSTERING
• Hazelcast
• Shared Data Structures
REALTIME COMMUNICATION - SOCKJS
• Excellent Support for Low-latency, full-duplex cross-communication
channel
• Tries
• Native Websocket
• Browser specific transport protocols
• Polling for old browsers
• Heartbeats – prevent load balancers & proxies to close long running
http requests
• Vert.x – built in support for SockJS
• SockJS event bus bridge
• Distributed event bus
• Extend’s vert.x server side event bus to JavaScript clients
• vertx-eventbus.js – publish & register messages
APPLICATION PACKAGING
• Maven & Gradle Tooling Support
• Packaging
• Use maven-shade-plugin to package as FAT Jar
• Run the Jar
MESSAGE TYPES – EVENT BUS
• Primitives & their Boxed Types
• String
• org.vertx.java.core.json.JsonObject
• org.vertx.java.core.json.JsonArray
• org.vertx.java.core.buffer.Buffer
• Custom Type Support – Write your own Serializer
REAL-LIFE EXAMPLE - PULSE
• Marketing Cloud Core Service
• REST API for Notifications
• Vertx-Web powered Microservice
COMPARISONS
• Vert.x Vs Netty
• Application Vs Infrastructure
• Vert.x provides higher level IO
• Vert.x Vs Jetty
• Vert.x Vs NodeJS
• Use all available cores
VERT.X VS NODEJS
NodeJS vs Vert.x Performance
RESOURCES
• Nginx Microservices Introduction
• NodeJS Event Loop
• Interview with Tim Fox on Vert.x 3
• SockJS

Weitere ähnliche Inhalte

Was ist angesagt?

Hypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStackHypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStack
Tim Mackey
 
Introducing OpenStack for Beginners
Introducing OpenStack for Beginners Introducing OpenStack for Beginners
Introducing OpenStack for Beginners
openstackindia
 
Lightweight Orchestration with WSO2 ESB
Lightweight Orchestration with WSO2 ESBLightweight Orchestration with WSO2 ESB
Lightweight Orchestration with WSO2 ESB
WSO2
 

Was ist angesagt? (20)

Service Discovery: From Classic to VPC
Service Discovery: From Classic to VPCService Discovery: From Classic to VPC
Service Discovery: From Classic to VPC
 
Building Bizweb Microservices with Docker
Building Bizweb Microservices with DockerBuilding Bizweb Microservices with Docker
Building Bizweb Microservices with Docker
 
WSO2 Gateway
WSO2 GatewayWSO2 Gateway
WSO2 Gateway
 
OpenNebula Administrator View
OpenNebula Administrator ViewOpenNebula Administrator View
OpenNebula Administrator View
 
Building microservices web application using scala & akka
Building microservices web application using scala & akkaBuilding microservices web application using scala & akka
Building microservices web application using scala & akka
 
Vertx
VertxVertx
Vertx
 
Microservices with Spring Cloud, Netflix OSS and Kubernetes
Microservices with Spring Cloud, Netflix OSS and Kubernetes Microservices with Spring Cloud, Netflix OSS and Kubernetes
Microservices with Spring Cloud, Netflix OSS and Kubernetes
 
Hypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStackHypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStack
 
Securing your database servers from external attacks
Securing your database servers from external attacksSecuring your database servers from external attacks
Securing your database servers from external attacks
 
What's New in WildFly 9?
What's New in WildFly 9?What's New in WildFly 9?
What's New in WildFly 9?
 
ONE Tips & Tricks
ONE Tips & Tricks ONE Tips & Tricks
ONE Tips & Tricks
 
VMware Hybrid Cloud Service - Overview
VMware Hybrid Cloud Service - OverviewVMware Hybrid Cloud Service - Overview
VMware Hybrid Cloud Service - Overview
 
CloudStack vs OpenStack
CloudStack vs OpenStackCloudStack vs OpenStack
CloudStack vs OpenStack
 
Saltconf 2016: Salt stack transport and concurrency
Saltconf 2016: Salt stack transport and concurrencySaltconf 2016: Salt stack transport and concurrency
Saltconf 2016: Salt stack transport and concurrency
 
GUJavaSC - Criando Micro-serviços Reativos com Java
GUJavaSC - Criando Micro-serviços Reativos com JavaGUJavaSC - Criando Micro-serviços Reativos com Java
GUJavaSC - Criando Micro-serviços Reativos com Java
 
Microservices with SenecaJS (part 2)
Microservices with SenecaJS (part 2)Microservices with SenecaJS (part 2)
Microservices with SenecaJS (part 2)
 
Introducing OpenStack for Beginners
Introducing OpenStack for Beginners Introducing OpenStack for Beginners
Introducing OpenStack for Beginners
 
Alex Fishman - Virtualizing the Cloud
Alex Fishman - Virtualizing the CloudAlex Fishman - Virtualizing the Cloud
Alex Fishman - Virtualizing the Cloud
 
Lightweight Orchestration with WSO2 ESB
Lightweight Orchestration with WSO2 ESBLightweight Orchestration with WSO2 ESB
Lightweight Orchestration with WSO2 ESB
 
Multi tenancy for docker
Multi tenancy for dockerMulti tenancy for docker
Multi tenancy for docker
 

Andere mochten auch

Mangal das garças
Mangal das garçasMangal das garças
Mangal das garças
Rosa Silva
 
Case study - Nuskin: Statefull Applications in a Stateless World
Case study - Nuskin: Statefull Applications in a Stateless WorldCase study - Nuskin: Statefull Applications in a Stateless World
Case study - Nuskin: Statefull Applications in a Stateless World
Day Software
 

Andere mochten auch (20)

Vert.X: Microservices Were Never So Easy (Clement Escoffier)
Vert.X: Microservices Were Never So Easy (Clement Escoffier)Vert.X: Microservices Were Never So Easy (Clement Escoffier)
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
 
Vert.x clustering on Docker, CoreOS and ETCD
Vert.x clustering on Docker, CoreOS and ETCDVert.x clustering on Docker, CoreOS and ETCD
Vert.x clustering on Docker, CoreOS and ETCD
 
Vert.x
Vert.xVert.x
Vert.x
 
Modern app programming with RxJava and Eclipse Vert.x
Modern app programming with RxJava and Eclipse Vert.xModern app programming with RxJava and Eclipse Vert.x
Modern app programming with RxJava and Eclipse Vert.x
 
Building microservices with Vert.x - Bert Jan Schrijver - Codemotion Amsterda...
Building microservices with Vert.x - Bert Jan Schrijver - Codemotion Amsterda...Building microservices with Vert.x - Bert Jan Schrijver - Codemotion Amsterda...
Building microservices with Vert.x - Bert Jan Schrijver - Codemotion Amsterda...
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Reactive Polyglot Microservices with OpenShift and Vert.x
Reactive Polyglot Microservices with OpenShift and Vert.xReactive Polyglot Microservices with OpenShift and Vert.x
Reactive Polyglot Microservices with OpenShift and Vert.x
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
 
Refactoring for microservices
Refactoring for microservicesRefactoring for microservices
Refactoring for microservices
 
How do event loops work in Python?
How do event loops work in Python?How do event loops work in Python?
How do event loops work in Python?
 
vert.x - life beyond jetty and apache
vert.x - life beyond jetty and apachevert.x - life beyond jetty and apache
vert.x - life beyond jetty and apache
 
Microservices designing deploying
Microservices designing deployingMicroservices designing deploying
Microservices designing deploying
 
Mangal das garças
Mangal das garçasMangal das garças
Mangal das garças
 
O mangal fica muito batido visão da utilização do manguezal pelo pescador e...
O mangal fica muito batido   visão da utilização do manguezal pelo pescador e...O mangal fica muito batido   visão da utilização do manguezal pelo pescador e...
O mangal fica muito batido visão da utilização do manguezal pelo pescador e...
 
Aseptoray technology presentation MDB
Aseptoray technology presentation MDBAseptoray technology presentation MDB
Aseptoray technology presentation MDB
 
Real World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xReal World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.x
 
Dwdm
DwdmDwdm
Dwdm
 
Vert.x
Vert.xVert.x
Vert.x
 
Case study - Nuskin: Statefull Applications in a Stateless World
Case study - Nuskin: Statefull Applications in a Stateless WorldCase study - Nuskin: Statefull Applications in a Stateless World
Case study - Nuskin: Statefull Applications in a Stateless World
 
Event driven microservices with vertx and kubernetes
Event driven microservices with vertx and kubernetesEvent driven microservices with vertx and kubernetes
Event driven microservices with vertx and kubernetes
 

Ähnlich wie Building microservices with vert.x 3.0

Migrating Enterprise Microservices From Cloud Foundry to Kubernetes
Migrating Enterprise Microservices From Cloud Foundry to KubernetesMigrating Enterprise Microservices From Cloud Foundry to Kubernetes
Migrating Enterprise Microservices From Cloud Foundry to Kubernetes
Tony Erwin
 
Cloud and Windows Azure
Cloud and Windows AzureCloud and Windows Azure
Cloud and Windows Azure
Radu Vunvulea
 
Hacking apache cloud stack
Hacking apache cloud stackHacking apache cloud stack
Hacking apache cloud stack
Nitin Mehta
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
6 weeks  6 months live project summer industrial training in cmc limited  20126 weeks  6 months live project summer industrial training in cmc limited  2012
6 weeks 6 months live project summer industrial training in cmc limited 2012
CMC Limited
 

Ähnlich wie Building microservices with vert.x 3.0 (20)

How to grow your own Microservice?
How to grow your own Microservice?How to grow your own Microservice?
How to grow your own Microservice?
 
Microservices in Azure
Microservices in AzureMicroservices in Azure
Microservices in Azure
 
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
 
Flying to clouds - can it be easy? Cloud Native Applications
Flying to clouds - can it be easy? Cloud Native ApplicationsFlying to clouds - can it be easy? Cloud Native Applications
Flying to clouds - can it be easy? Cloud Native Applications
 
Microservices in Azure
Microservices in AzureMicroservices in Azure
Microservices in Azure
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
 
Amazon AWS vs Azure Cloud vs Kubernetes
Amazon AWS vs Azure Cloud vs KubernetesAmazon AWS vs Azure Cloud vs Kubernetes
Amazon AWS vs Azure Cloud vs Kubernetes
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
 
Fuse integration-services
Fuse integration-servicesFuse integration-services
Fuse integration-services
 
Migrating Enterprise Microservices From Cloud Foundry to Kubernetes
Migrating Enterprise Microservices From Cloud Foundry to KubernetesMigrating Enterprise Microservices From Cloud Foundry to Kubernetes
Migrating Enterprise Microservices From Cloud Foundry to Kubernetes
 
Cloud and Windows Azure
Cloud and Windows AzureCloud and Windows Azure
Cloud and Windows Azure
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Coherence sig-nfr-web-tier-scaling-using-coherence-web
Coherence sig-nfr-web-tier-scaling-using-coherence-webCoherence sig-nfr-web-tier-scaling-using-coherence-web
Coherence sig-nfr-web-tier-scaling-using-coherence-web
 
Oracle WebLogic 12c New Multitenancy features
Oracle WebLogic 12c New Multitenancy featuresOracle WebLogic 12c New Multitenancy features
Oracle WebLogic 12c New Multitenancy features
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
Hacking apache cloud stack
Hacking apache cloud stackHacking apache cloud stack
Hacking apache cloud stack
 
Getting Started with Apache CloudStack
Getting Started with Apache CloudStackGetting Started with Apache CloudStack
Getting Started with Apache CloudStack
 
Exploring microservices in a Microsoft landscape
Exploring microservices in a Microsoft landscapeExploring microservices in a Microsoft landscape
Exploring microservices in a Microsoft landscape
 
Transforming Legacy Applications Into Dynamically Scalable Web Services
Transforming Legacy Applications Into Dynamically Scalable Web ServicesTransforming Legacy Applications Into Dynamically Scalable Web Services
Transforming Legacy Applications Into Dynamically Scalable Web Services
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
6 weeks  6 months live project summer industrial training in cmc limited  20126 weeks  6 months live project summer industrial training in cmc limited  2012
6 weeks 6 months live project summer industrial training in cmc limited 2012
 

KĂźrzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

KĂźrzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Building microservices with vert.x 3.0

  • 2. AGENDA • Microservices • Why, why not ? • Comparison with Monolithic Architecture • Vert.x • Concepts: Event Loop, Verticles, Event Bus • Modules: core, web • Comparisons • Real-life Example - Pulse
  • 3. MONOLITHIC ARCHITECTURE • Logically Different Modules • But Packaged & deployed as a Single Unit • Initial Phases of Project • Simple to Deploy • Vertical Scaling • Later on • Difficult to Manage & Scale • Longer Startup Times • Slow down Development • CI becomes challenging
  • 4.
  • 5. MICROSERVICES PATTERN • Split into Smaller, Interconnected Services • Loose Coupling • Service == Functional Area • Service exposes APIs – consumed by other services & clients
  • 6.
  • 8. BENEFITS • Enforces Modularity • Decomposing complexity • Manageable chunks • Each service – well defined boundary • Independent Development • Different Teams • Different Technologies • Easy to test • Scaling is Easy • Each service can be scaled independently • Different Service might have different requirements ( CPU, Memory )
  • 11. DRAWBACKS • Partitioned Database Architecture • Have to settle for Eventual Consistency • ACID transactions not possible • Deploying • Though scalable, but more complex • Many more moving parts • Service Discovery required
  • 12. • Polyglot (Java, JavaScript, Groovy, Ruby, Python etc.) • Event-driven & Non-blocking programming model • Super simple Concurrency Model • Lightweight ~ 650Kb • “Ideal choice for creating light-weight, high- performance, microservices” • Public module repository • Reactive applications • Asynchronous APIs
  • 13. CONCEPTS • Event Loop • Verticles • Server Verticles • Worker Verticles • Event Bus • Point to Point • Pub/Sub • Distributed
  • 16. • Don’t Block the Event Loop • Workers “can” block • Message Passing using Event Bus • Concurrency Model • A Verticle instance is always Single threaded • No more Locking, synchronized & race conditions • Actor-like concurrency model • Scaling • By Creating more Verticle Instances • For TCP & HTTP servers, Vert.x does automatic load balancing • Use FAT Jar for Deployment
  • 17. VERT.X MODULES • Core • Web • Data Access • MongoDB, JDBC, Redis, MySQL • Authentication Modules • JWT, OAuth 2, JDBC Auth, Shiro Auth, MongoDB auth • Messaging Systems • Kafka, RabbitMQ • Clustering – Hazelcast
  • 18. VERT.X CORE • Servers & clients • TCP/SSL • HTTP/HTTPS • Websocket & SockJS • EventBus • Shared Maps & Sets • Buffers & Flow Control • Container API – Deploy & Undeploy Verticles • Timers & Files • Logging • Configuration
  • 19. VERT.X HTTP SERVER – HELLO WORLD
  • 20. VERT.X WEB • Routing • Regex Matching • Request Body Handling, parameters extraction • Cookie Parsing & Handling • Multipart Form & File Upload • Session support ( sticky & non-sticky ) • CORS & CSRF Support • Authentication & Authorization • SockJS Support
  • 23. ROUTING • Chain of Routers • Either “end” it • Or pass it to the “next” one • Various Options – Route by • HTTP Method Type • Exact Path • Regex Matching • MIME type of request • Decide Routing Order
  • 24. VERT.X WEB • BodyHandler • Retrieve Request Body • Limit Body Size • Handle File Uploads • CookieHandler • Get, Add, Delete Cookie • SessionHandler • Sticky & Non-Sticky Sessions • Vert.x don’t put actual data in Session Cookie – Session UUID is used to lookup data on the server • Session timeouts
  • 25. VERT.X WEB • Authentication & Authorization • Support for Basic-Auth, Redirect-Auth, FormLogin • JWT • OAuth2 • Static Resources • StaticHandler • Caching – set headers ( cache-control, last-modified, date ) • Configurable webroot, index page • Disable File Caching - .vertx • Templating Support • Handlebars, Jade, MVEL, Thymeleaf • CORS & CSFR Handlers
  • 26. DISTRIBUTED SUPPORT DISTRIBUTED EVENT BUS • Connect multiple Vert.x instances across JVMs • Event bus extends to client side Javascript • Ideal for “real-time” web applications • vertx-eventbus.js CLUSTERING • Hazelcast • Shared Data Structures
  • 27. REALTIME COMMUNICATION - SOCKJS • Excellent Support for Low-latency, full-duplex cross-communication channel • Tries • Native Websocket • Browser specific transport protocols • Polling for old browsers • Heartbeats – prevent load balancers & proxies to close long running http requests • Vert.x – built in support for SockJS • SockJS event bus bridge • Distributed event bus • Extend’s vert.x server side event bus to JavaScript clients • vertx-eventbus.js – publish & register messages
  • 28. APPLICATION PACKAGING • Maven & Gradle Tooling Support • Packaging • Use maven-shade-plugin to package as FAT Jar • Run the Jar
  • 29.
  • 30. MESSAGE TYPES – EVENT BUS • Primitives & their Boxed Types • String • org.vertx.java.core.json.JsonObject • org.vertx.java.core.json.JsonArray • org.vertx.java.core.buffer.Buffer • Custom Type Support – Write your own Serializer
  • 31. REAL-LIFE EXAMPLE - PULSE • Marketing Cloud Core Service • REST API for Notifications • Vertx-Web powered Microservice
  • 32.
  • 33. COMPARISONS • Vert.x Vs Netty • Application Vs Infrastructure • Vert.x provides higher level IO • Vert.x Vs Jetty • Vert.x Vs NodeJS • Use all available cores
  • 34. VERT.X VS NODEJS NodeJS vs Vert.x Performance
  • 35. RESOURCES • Nginx Microservices Introduction • NodeJS Event Loop • Interview with Tim Fox on Vert.x 3 • SockJS