SlideShare a Scribd company logo
Putting sync/async
servers to test
Jordi Soucheiron
Who am I?
Putting sync/async servers to test
• Software engineer @ Skyscanner
• Python lover
• Systems administration and backend systems
background
• @jordixou
http://bit.ly/jordisync
What are we going to talk about?
• Sync/async models
• Assumptions
• Benchmarking
• Conclusions
• Questions
Putting sync/async servers to test
http://bit.ly/jordisync
How do sync servers (usually) work
Putting sync/async servers to test
http://bit.ly/jordisync
How do async servers (usually) work
Putting sync/async servers to test
http://bit.ly/jordisync
The test environment
• 3 docker containers
• aiohttp
• Flask
• nginx
• wrk
• used to stress test and gather data
• 2 threads, 10-100 connections, 30 seconds
• docker stats to gather container performance data
• Tested in a macbook pro 13” 2.9GHz i5
• Docker configured to use 4 cores and 4GB of RAM
Putting sync/async servers to test
http://bit.ly/jordisync
Nginx container
• Using openresty
• Hello world with delays:
• 0ms
• 100ms
• 200ms
• 1s
Putting sync/async servers to test
http://bit.ly/jordisync
Flask container
• Dockerfile
• Python 3.6.3
• Using gunicorn, 100 worker threads
Putting sync/async servers to test
http://bit.ly/jordisync
Flask container
• 2 endpoints
• IO bottleneck
• CPU bottleneck
Putting sync/async servers to test
http://bit.ly/jordisync
aiohttp container
• Dockerfile
• Python 3.6.3
• Using gunicorn, 1 worker per CPU
Putting sync/async servers to test
http://bit.ly/jordisync
aiohttp container
• 2 endpoints
• IO bottleneck
Putting sync/async servers to test
http://bit.ly/jordisync
aiohttp container
• 2 endpoints
• CPU bottleneck
Putting sync/async servers to test
http://bit.ly/jordisync
Assumptions
• Async servers use less memory
• Latency is smaller in sync servers
• Sync code is simpler
• Async code is harder to reason about
• Async servers can handle more
requests/seq
Putting sync/async servers to test
http://bit.ly/jordisync
Benchmarks
Putting sync/async servers to test
http://bit.ly/jordisync
Benchmarks
• Disclaimer:
• This is not gonna be a fair fight
Putting sync/async servers to test
http://bit.ly/jordisync
Benchmarks
Putting sync/async servers to test
http://bit.ly/jordisync
0.00
200.00
400.00
600.00
800.00
1000.00
1200.00
hello world cpu_waster 100ms 200ms 1s
Response time (lower is better)
nginx aiohttp flask
Benchmarks
Putting sync/async servers to test
http://bit.ly/jordisync
0.00
500.00
1000.00
1500.00
2000.00
2500.00
3000.00
3500.00
4000.00
4500.00
hello world cpu_waster 100ms 200ms 1s
Requests per second (higher is better)
nginx aiohttp flask
Benchmarks
Putting sync/async servers to test
http://bit.ly/jordisync
0
5
10
15
20
25
30
35
hello world cpu_waster 100ms 200ms 1s
Memory per request per second (lower is better)
nginx aiohttp flask
Assumptions review
• Async servers use less memory
• Latency is smaller in sync servers
• Sync code is simpler
• Async code is harder to reason about
• Async servers can handle more
requests/seq
Putting sync/async servers to test
http://bit.ly/jordisync
Conclusions
• Async servers are great for*:
• Slow dependencies
• Many external dependencies
• Data aggregation from multiple sources
• Microservices
• Lots of I/O
• Async is bad for*:
• Static content
• CPU intensive work
Putting sync/async servers to test
*generally
http://bit.ly/jordisync
Conclusions
• Pros:
• Lower memory footprint*
• Higher throughput (req/s)*
• Cons:
• Latency for simple sync requests is higher*
• Chasing bottlenecks is harder
Putting sync/async servers to test
*generally
http://bit.ly/jordisync
Questions?
• All feedback is welcome
• Slides and links to the code available here:
• http://bit.ly/jordisync
• Ping me at @jordixou
Putting sync/async servers to test
http://bit.ly/jordisync
Thank you

More Related Content

PDF
Rails after 5 years
PPTX
How to work with Selenium Grid and Cloud Solutions
PDF
Intro to front-end testing
PPTX
CI/CD for android
PDF
PyCon AU 2015 - Using benchmarks to understand how wsgi servers work
PDF
Selenium grid workshop london 2016
PDF
Introduction to selenium_grid_workshop
KEY
Selenium Grid
Rails after 5 years
How to work with Selenium Grid and Cloud Solutions
Intro to front-end testing
CI/CD for android
PyCon AU 2015 - Using benchmarks to understand how wsgi servers work
Selenium grid workshop london 2016
Introduction to selenium_grid_workshop
Selenium Grid

What's hot (20)

PDF
Printing with AventX 10.0 is Faster than Ever!
PDF
Virtualization session 7 by Gugan
PDF
asyncio community, one year later
PPTX
Implement server push in flask framework
PPTX
Stress Testing at Twitter: a tale of New Year Eves
PDF
HTTP caching with Varnish
PPTX
Managing Large Selenium Grid
PDF
Delivering a production Cloud Foundry Environment with Bosh | anynines
PPT
Apache Traffic Server
PDF
Boyan Ivanov - latency, the #1 metric of your cloud
PDF
So you think JSON is cool?
PDF
Spinnaker 파트 1
PDF
Open stack and_vagrant-os-meetup-2015
PDF
Test Kitchen and Infrastructure as Code
PPTX
Controlling multiple VMs with the power of Python
PPTX
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
PDF
Cloud infrastructures - Slide Set 6 - BOSH | anynines
PPTX
Solving anything in VCL
PDF
Debugging ansible modules
PDF
[Js hcm] Deploying node.js with Forever.js and nginx
Printing with AventX 10.0 is Faster than Ever!
Virtualization session 7 by Gugan
asyncio community, one year later
Implement server push in flask framework
Stress Testing at Twitter: a tale of New Year Eves
HTTP caching with Varnish
Managing Large Selenium Grid
Delivering a production Cloud Foundry Environment with Bosh | anynines
Apache Traffic Server
Boyan Ivanov - latency, the #1 metric of your cloud
So you think JSON is cool?
Spinnaker 파트 1
Open stack and_vagrant-os-meetup-2015
Test Kitchen and Infrastructure as Code
Controlling multiple VMs with the power of Python
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
Cloud infrastructures - Slide Set 6 - BOSH | anynines
Solving anything in VCL
Debugging ansible modules
[Js hcm] Deploying node.js with Forever.js and nginx
Ad

Similar to Skyscanner Engineering: Putting sync async servers to test by Jordi Soucheiron (20)

PDF
Http2 in practice
PPTX
Virtualization and SAN Basics for DBAs
PDF
Building Awesome APIs with Lumen
PPTX
SharePoint 2013 Performance Analysis - Robi Vončina
PDF
«Scrapy internals» Александр Сибиряков, Scrapinghub
PDF
Tomcat Optimisation & Performance Tuning
PDF
Cassandra and drivers
PPTX
Fastest Servlets in the West
PDF
GraphConnect Europe 2016 - Moving Graphs to Production at Scale - Ian Robinson
PPTX
Cloud Performance Benchmarking
PDF
Stack Exchange Infrastructure - LISA 14
PDF
haproxy-150423120602-conversion-gate01.pdf
PPTX
HAProxy
PDF
20160503 Amazed by AWS | Tips about Performance on AWS
PDF
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
PDF
Oleksandr Khotemskyi - Serverless architecture and how to apply it in Automa...
PDF
Extending Your Applications to the Edge with CDNs
PDF
Host Health Monitoring with Docker Run
PDF
Benchmarking Performance and Scalability with Web Stress
Http2 in practice
Virtualization and SAN Basics for DBAs
Building Awesome APIs with Lumen
SharePoint 2013 Performance Analysis - Robi Vončina
«Scrapy internals» Александр Сибиряков, Scrapinghub
Tomcat Optimisation & Performance Tuning
Cassandra and drivers
Fastest Servlets in the West
GraphConnect Europe 2016 - Moving Graphs to Production at Scale - Ian Robinson
Cloud Performance Benchmarking
Stack Exchange Infrastructure - LISA 14
haproxy-150423120602-conversion-gate01.pdf
HAProxy
20160503 Amazed by AWS | Tips about Performance on AWS
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Oleksandr Khotemskyi - Serverless architecture and how to apply it in Automa...
Extending Your Applications to the Edge with CDNs
Host Health Monitoring with Docker Run
Benchmarking Performance and Scalability with Web Stress
Ad

Recently uploaded (20)

PPTX
UNIT 4 Total Quality Management .pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
OOP with Java - Java Introduction (Basics)
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Well-logging-methods_new................
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Geodesy 1.pptx...............................................
PPTX
Foundation to blockchain - A guide to Blockchain Tech
UNIT 4 Total Quality Management .pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Fundamentals of safety and accident prevention -final (1).pptx
Safety Seminar civil to be ensured for safe working.
Model Code of Practice - Construction Work - 21102022 .pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
OOP with Java - Java Introduction (Basics)
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
III.4.1.2_The_Space_Environment.p pdffdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Well-logging-methods_new................
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Geodesy 1.pptx...............................................
Foundation to blockchain - A guide to Blockchain Tech

Skyscanner Engineering: Putting sync async servers to test by Jordi Soucheiron

  • 1. Putting sync/async servers to test Jordi Soucheiron
  • 2. Who am I? Putting sync/async servers to test • Software engineer @ Skyscanner • Python lover • Systems administration and backend systems background • @jordixou http://bit.ly/jordisync
  • 3. What are we going to talk about? • Sync/async models • Assumptions • Benchmarking • Conclusions • Questions Putting sync/async servers to test http://bit.ly/jordisync
  • 4. How do sync servers (usually) work Putting sync/async servers to test http://bit.ly/jordisync
  • 5. How do async servers (usually) work Putting sync/async servers to test http://bit.ly/jordisync
  • 6. The test environment • 3 docker containers • aiohttp • Flask • nginx • wrk • used to stress test and gather data • 2 threads, 10-100 connections, 30 seconds • docker stats to gather container performance data • Tested in a macbook pro 13” 2.9GHz i5 • Docker configured to use 4 cores and 4GB of RAM Putting sync/async servers to test http://bit.ly/jordisync
  • 7. Nginx container • Using openresty • Hello world with delays: • 0ms • 100ms • 200ms • 1s Putting sync/async servers to test http://bit.ly/jordisync
  • 8. Flask container • Dockerfile • Python 3.6.3 • Using gunicorn, 100 worker threads Putting sync/async servers to test http://bit.ly/jordisync
  • 9. Flask container • 2 endpoints • IO bottleneck • CPU bottleneck Putting sync/async servers to test http://bit.ly/jordisync
  • 10. aiohttp container • Dockerfile • Python 3.6.3 • Using gunicorn, 1 worker per CPU Putting sync/async servers to test http://bit.ly/jordisync
  • 11. aiohttp container • 2 endpoints • IO bottleneck Putting sync/async servers to test http://bit.ly/jordisync
  • 12. aiohttp container • 2 endpoints • CPU bottleneck Putting sync/async servers to test http://bit.ly/jordisync
  • 13. Assumptions • Async servers use less memory • Latency is smaller in sync servers • Sync code is simpler • Async code is harder to reason about • Async servers can handle more requests/seq Putting sync/async servers to test http://bit.ly/jordisync
  • 14. Benchmarks Putting sync/async servers to test http://bit.ly/jordisync
  • 15. Benchmarks • Disclaimer: • This is not gonna be a fair fight Putting sync/async servers to test http://bit.ly/jordisync
  • 16. Benchmarks Putting sync/async servers to test http://bit.ly/jordisync 0.00 200.00 400.00 600.00 800.00 1000.00 1200.00 hello world cpu_waster 100ms 200ms 1s Response time (lower is better) nginx aiohttp flask
  • 17. Benchmarks Putting sync/async servers to test http://bit.ly/jordisync 0.00 500.00 1000.00 1500.00 2000.00 2500.00 3000.00 3500.00 4000.00 4500.00 hello world cpu_waster 100ms 200ms 1s Requests per second (higher is better) nginx aiohttp flask
  • 18. Benchmarks Putting sync/async servers to test http://bit.ly/jordisync 0 5 10 15 20 25 30 35 hello world cpu_waster 100ms 200ms 1s Memory per request per second (lower is better) nginx aiohttp flask
  • 19. Assumptions review • Async servers use less memory • Latency is smaller in sync servers • Sync code is simpler • Async code is harder to reason about • Async servers can handle more requests/seq Putting sync/async servers to test http://bit.ly/jordisync
  • 20. Conclusions • Async servers are great for*: • Slow dependencies • Many external dependencies • Data aggregation from multiple sources • Microservices • Lots of I/O • Async is bad for*: • Static content • CPU intensive work Putting sync/async servers to test *generally http://bit.ly/jordisync
  • 21. Conclusions • Pros: • Lower memory footprint* • Higher throughput (req/s)* • Cons: • Latency for simple sync requests is higher* • Chasing bottlenecks is harder Putting sync/async servers to test *generally http://bit.ly/jordisync
  • 22. Questions? • All feedback is welcome • Slides and links to the code available here: • http://bit.ly/jordisync • Ping me at @jordixou Putting sync/async servers to test http://bit.ly/jordisync