SlideShare a Scribd company logo
1 of 18
Download to read offline
Scalability,Resiliency,Responsiveness
Servlet vs Reactive
Services Setup: Scenario #1
Service A
Service B
Service C
Service C
Setup #1
Setup #2
Service A:
Spring MVC using
RESTTemplate
Service B:
Spring Reactor using
WebClient
Service C:
Spring Reactor
Takes 200ms to
respond to a HTTP
GET
GET /items/{category}
GET /items/{category}
Test Setup
Service A Service C
AWS
t2.micro t2.micro t2.micro
Service B Service C
AWS
t2.micro t2.micro t2.micro
Predict
Performance,
CPU, RAM
Expected Performance
Service B using Non-Blocking Architecture should outperform
Service A as the number of concurrent users increase.
Service B should have higher CPU Utilization.
Service B should have lower response time and higher throughput.
Code Walkhrough and
Performance Test
Execution
Performance
Test Results
Architecture Style Concurrent Users Execution Time
(seconds)
Ramp-Up
Time
(seconds)
Throughput (per
second)
Avg. Response
Time (ms)
A (MVC) 50 600 10 242 204
B (Reactive) 50 600 10 243 203
A (MVC) 100 600 10 476 208
B (Reactive) 100 600 10 472 210
A (MVC) 500 600 10 979 505
B (Reactive) 500 600 10 1430 345
A (MVC) 1000 600 10 965 1024
B (Reactive) 1000 600 10 1777 555
A (MVC) 1500 600 10 958 1546
B (Reactive) 1500 600 10 1755 815
Improve
Performance
of MVC
service
Services Setup: Scenario #2
Service A1
Service B
Service C
Service C
Setup #1
Setup #2
Service A1:
Spring MVC using
RESTTemplate
WebClient
Service B:
Spring Reactor using
WebClient
Service C:
Spring Reactor
Takes 200ms to
respond to a HTTP
GET
GET /items/{category}
GET /items/{category}
Expected Performance
Service A1 should outperform Service A. Service B should
outperform both Service A and Service A1.
Service A1 should have higher CPU Utilization than Service A.
Service A1 should have lower response time and higher throughput
compared to Service A.
Performance
Results
A R C H I T E C T U R E
S T Y L E
C O N C U R R E N T
U S E R S
E X E C U T I O N T I M E
( S E C O N D S )
R A M P - U P T I M E
( S E C O N D S )
T H R O U G H P U T
( P E R S E C O N D )
A V G .
R E S P O N S E
T I M E ( M S )
A (MVC-RT) 1000 600 10 965 1024
A1 (MVC-WC) 1000 600 10 1241 797
B (Reactive) 1000 600 10 1777 555
A (MVC-RT) 1500 600 10 958 1546
A1 (MVC-WC) 1500 600 10 1516 973
B (Reactive) 1500 600 10 1755 815
Responsive
Resilient
Simulate Failure and test
Responisveness and
Resiliency of Service A
and Service B
Reactive
Architecture
- Responsive
- Resilient
Service B on Reactive
Architecturewas Resilient and
Responsive even when
Dependent Services were down.
No need to implement
additional tooling like Circuit
Breakers.
Fast Producer,
Slow
Consumer
Fast Producer can take down the Slow
Consumer
Service A Service C
AWS
t2.micro t2.micro t2.micro
X msg/secY msg/sec
If Y < X then Service C can
eventuallycause Service A
to crash
Reactive Streams are
backpressure enabled
and thus the Consumer
would pull only so much
as it can process
Thank you!!
Code availableon Github:
https://github.com/vrawat79/itemReactiveMockedDB
https://github.com/vrawat79/itemMVCMockedDB
https://github.com/vrawat79/MockedDbService

More Related Content

Similar to Architecture patterns: servlet vs reactive

Synchronizing Relay
Synchronizing RelaySynchronizing Relay
Synchronizing Relay
RAJPRASAD RS
 
CA Unified Infrastructure Management Network Performance Management Capabili...
 CA Unified Infrastructure Management Network Performance Management Capabili... CA Unified Infrastructure Management Network Performance Management Capabili...
CA Unified Infrastructure Management Network Performance Management Capabili...
CA Technologies
 
Resilient service to-service calls in a post-Hystrix world
Resilient service to-service calls in a post-Hystrix worldResilient service to-service calls in a post-Hystrix world
Resilient service to-service calls in a post-Hystrix world
Rares Musina
 

Similar to Architecture patterns: servlet vs reactive (20)

Synchronizing Relay
Synchronizing RelaySynchronizing Relay
Synchronizing Relay
 
Testing Applications—For the Cloud and in the Cloud
Testing Applications—For the Cloud and in the CloudTesting Applications—For the Cloud and in the Cloud
Testing Applications—For the Cloud and in the Cloud
 
Ijeet 06 08_008
Ijeet 06 08_008Ijeet 06 08_008
Ijeet 06 08_008
 
Maximizing Your CA Datacom® Investment for the New Application Economy (Part 2)
Maximizing Your CA Datacom® Investment for the New Application Economy (Part 2)Maximizing Your CA Datacom® Investment for the New Application Economy (Part 2)
Maximizing Your CA Datacom® Investment for the New Application Economy (Part 2)
 
Design of Starting Resistance for AC and DC Machines using Computer Analysis ...
Design of Starting Resistance for AC and DC Machines using Computer Analysis ...Design of Starting Resistance for AC and DC Machines using Computer Analysis ...
Design of Starting Resistance for AC and DC Machines using Computer Analysis ...
 
Unlimited Virtual Computing Capacity using the Cloud for Automated Parameter ...
Unlimited Virtual Computing Capacity using the Cloud for Automated Parameter ...Unlimited Virtual Computing Capacity using the Cloud for Automated Parameter ...
Unlimited Virtual Computing Capacity using the Cloud for Automated Parameter ...
 
Messaging Powered Front Ends
Messaging Powered Front EndsMessaging Powered Front Ends
Messaging Powered Front Ends
 
Performance Engineering Masterclass: Efficient Automation with the Help of SR...
Performance Engineering Masterclass: Efficient Automation with the Help of SR...Performance Engineering Masterclass: Efficient Automation with the Help of SR...
Performance Engineering Masterclass: Efficient Automation with the Help of SR...
 
CA Unified Infrastructure Management Network Performance Management Capabili...
 CA Unified Infrastructure Management Network Performance Management Capabili... CA Unified Infrastructure Management Network Performance Management Capabili...
CA Unified Infrastructure Management Network Performance Management Capabili...
 
WORKSHOP: Microservices as Containers on AWS
WORKSHOP: Microservices as Containers on AWSWORKSHOP: Microservices as Containers on AWS
WORKSHOP: Microservices as Containers on AWS
 
Service Stampede: Surviving a Thousand Services
Service Stampede: Surviving a Thousand ServicesService Stampede: Surviving a Thousand Services
Service Stampede: Surviving a Thousand Services
 
Resilient service to-service calls in a post-Hystrix world
Resilient service to-service calls in a post-Hystrix worldResilient service to-service calls in a post-Hystrix world
Resilient service to-service calls in a post-Hystrix world
 
Ria Mvc
Ria MvcRia Mvc
Ria Mvc
 
Closed Loop Control of Hybrid Boosting Converter for Renewable Energy Applica...
Closed Loop Control of Hybrid Boosting Converter for Renewable Energy Applica...Closed Loop Control of Hybrid Boosting Converter for Renewable Energy Applica...
Closed Loop Control of Hybrid Boosting Converter for Renewable Energy Applica...
 
Aerospace maintenance facility increases utilization by 50%, saves money
Aerospace maintenance facility increases utilization by 50%, saves moneyAerospace maintenance facility increases utilization by 50%, saves money
Aerospace maintenance facility increases utilization by 50%, saves money
 
OPAL-RT | Setup and Performance of a Combined Hardware-in-loop and Software-i...
OPAL-RT | Setup and Performance of a Combined Hardware-in-loop and Software-i...OPAL-RT | Setup and Performance of a Combined Hardware-in-loop and Software-i...
OPAL-RT | Setup and Performance of a Combined Hardware-in-loop and Software-i...
 
IRJET- Metastability Mitigation & Error Masking of High Speed Flip-Flop
IRJET- Metastability Mitigation & Error Masking of High Speed Flip-FlopIRJET- Metastability Mitigation & Error Masking of High Speed Flip-Flop
IRJET- Metastability Mitigation & Error Masking of High Speed Flip-Flop
 
Multiphase Converters.pdf
Multiphase Converters.pdfMultiphase Converters.pdf
Multiphase Converters.pdf
 
Forward Networks - Networking Field Day 13 presentation
Forward Networks - Networking Field Day 13 presentationForward Networks - Networking Field Day 13 presentation
Forward Networks - Networking Field Day 13 presentation
 
Fuzzy System Approach for TCSC Based Controller Design
Fuzzy System Approach for TCSC Based Controller DesignFuzzy System Approach for TCSC Based Controller Design
Fuzzy System Approach for TCSC Based Controller Design
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
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...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Architecture patterns: servlet vs reactive

  • 2. Services Setup: Scenario #1 Service A Service B Service C Service C Setup #1 Setup #2 Service A: Spring MVC using RESTTemplate Service B: Spring Reactor using WebClient Service C: Spring Reactor Takes 200ms to respond to a HTTP GET GET /items/{category} GET /items/{category}
  • 3. Test Setup Service A Service C AWS t2.micro t2.micro t2.micro Service B Service C AWS t2.micro t2.micro t2.micro
  • 5. Expected Performance Service B using Non-Blocking Architecture should outperform Service A as the number of concurrent users increase. Service B should have higher CPU Utilization. Service B should have lower response time and higher throughput.
  • 7. Performance Test Results Architecture Style Concurrent Users Execution Time (seconds) Ramp-Up Time (seconds) Throughput (per second) Avg. Response Time (ms) A (MVC) 50 600 10 242 204 B (Reactive) 50 600 10 243 203 A (MVC) 100 600 10 476 208 B (Reactive) 100 600 10 472 210 A (MVC) 500 600 10 979 505 B (Reactive) 500 600 10 1430 345 A (MVC) 1000 600 10 965 1024 B (Reactive) 1000 600 10 1777 555 A (MVC) 1500 600 10 958 1546 B (Reactive) 1500 600 10 1755 815
  • 9. Services Setup: Scenario #2 Service A1 Service B Service C Service C Setup #1 Setup #2 Service A1: Spring MVC using RESTTemplate WebClient Service B: Spring Reactor using WebClient Service C: Spring Reactor Takes 200ms to respond to a HTTP GET GET /items/{category} GET /items/{category}
  • 10. Expected Performance Service A1 should outperform Service A. Service B should outperform both Service A and Service A1. Service A1 should have higher CPU Utilization than Service A. Service A1 should have lower response time and higher throughput compared to Service A.
  • 11. Performance Results A R C H I T E C T U R E S T Y L E C O N C U R R E N T U S E R S E X E C U T I O N T I M E ( S E C O N D S ) R A M P - U P T I M E ( S E C O N D S ) T H R O U G H P U T ( P E R S E C O N D ) A V G . R E S P O N S E T I M E ( M S ) A (MVC-RT) 1000 600 10 965 1024 A1 (MVC-WC) 1000 600 10 1241 797 B (Reactive) 1000 600 10 1777 555 A (MVC-RT) 1500 600 10 958 1546 A1 (MVC-WC) 1500 600 10 1516 973 B (Reactive) 1500 600 10 1755 815
  • 13. Simulate Failure and test Responisveness and Resiliency of Service A and Service B
  • 14. Reactive Architecture - Responsive - Resilient Service B on Reactive Architecturewas Resilient and Responsive even when Dependent Services were down. No need to implement additional tooling like Circuit Breakers.
  • 16. Fast Producer can take down the Slow Consumer Service A Service C AWS t2.micro t2.micro t2.micro X msg/secY msg/sec If Y < X then Service C can eventuallycause Service A to crash
  • 17. Reactive Streams are backpressure enabled and thus the Consumer would pull only so much as it can process
  • 18. Thank you!! Code availableon Github: https://github.com/vrawat79/itemReactiveMockedDB https://github.com/vrawat79/itemMVCMockedDB https://github.com/vrawat79/MockedDbService