SlideShare a Scribd company logo
Building Protocol
Libraries
The Right Way
Hi!
Protocol libraries the right way
Python HTTP
• Hyper
• h2, hpack, priority, etc.
• Requests + urllib3
• PyCA (PyOpenSSL)
Why All Your Libraries
Are Garbage, And All
But One Of Mine Are
Too
Python HTTP
Rocks
• Requests/urllib3/HTTPie
• gunicorn
• aiohttp
• Twisted
• Tornado
~0% Shared
Code
Code Re-Use
👍
I/O
• httplib: state machine and
parser mixed with I/O
• aiohttp/Tornado/Twisted:
state machine and parser
use concurrency primitives
Choice of I/O limits
choice of libraries
So What?
Wasted Effort
Reduces
Experimentation
Duplicate
Bugs
Limits
Optimisation
Avoiding
This Problem
Don’t Do I/O
Alternative API
events	=	handle_data(in_bytes)	
out_bytes	=	perform_action()
Not All-Purpose
Build
Wrappers
Why Bother?
=============================	test	session	starts	==============================	
platform	darwin	--	Python	2.7.11,	pytest-2.8.5,	py-1.4.31,	pluggy-0.3.1	
rootdir:	/Users/cory/Documents/Python/hyper-h2,	inifile:		
plugins:	hypothesis-1.19.0,	cov-2.2.0,	xdist-1.13.1	
gw0	[513]	/	gw1	[513]	/	gw2	[513]	/	gw3	[513]	
scheduling	tests	via	LoadScheduling	
.............................................................................................
.............................................................................................
.............................................................................................
.............................................................................................
.............................................................................................
................................................	
---------------	coverage:	platform	darwin,	python	2.7.11-final-0	---------------	
Name																	Stmts			Miss	Branch	BrPart		Cover			Missing	
----------------------------------------------------------------	
h2/__init__.py											2						0						0						0			100%				
h2/connection.py							425						0					96						0			100%				
h2/errors.py												17						0						0						0			100%				
h2/events.py												95						0						4						0			100%				
h2/exceptions.py								41						0						0						0			100%				
h2/frame_buffer.py						55						0					18						0			100%				
h2/settings.py										74						0					20						0			100%				
h2/stream.py											286						0					46						0			100%				
h2/utilities.py									45						0					24						0			100%				
----------------------------------------------------------------	
TOTAL																	1040						0				208						0			100%				
==========================	513	passed	in	6.69	seconds	==========================
I/O Is
Application-
Specific
Build A
Toolbox
Example
• hyper-h2, a pure Python
HTTP/2 protocol stack.
• http://python-hyper.org/h2
Help Us
Thanks!
Questions?

More Related Content

PDF
PharoDAYS 2015: Pharo Status - by Markus Denker
PDF
Esri International User Conference 2011: Python: Integrating Standard and Thi...
PPTX
C# - Raise the bar with functional & immutable constructs (Dutch)
KEY
20120524 english lt2_pythontoolsfortesting
PDF
Batch import of large RDF datasets into Semantic MediaWiki
PDF
如何提高研发效率
PDF
Python meetup: coroutines, event loops, and non-blocking I/O
PPTX
Qml 培訓課程 multi media
PharoDAYS 2015: Pharo Status - by Markus Denker
Esri International User Conference 2011: Python: Integrating Standard and Thi...
C# - Raise the bar with functional & immutable constructs (Dutch)
20120524 english lt2_pythontoolsfortesting
Batch import of large RDF datasets into Semantic MediaWiki
如何提高研发效率
Python meetup: coroutines, event loops, and non-blocking I/O
Qml 培訓課程 multi media

Viewers also liked (13)

PDF
Elastic HBase on Mesos - HBaseCon 2015
PDF
我的互联网运维理论与实践
PDF
特卖场景下的大数据平台和机器学习实践
PDF
美团数据库运维平台介绍
PDF
The simplethebeautiful
PDF
Tokyo HBase Meetup - Realtime Big Data at Facebook with Hadoop and HBase (ja)
PDF
阿里巴巴运维自动化的探索与规划
PPTX
基于Python构建可扩展的自动化运维平台
PDF
HBase for Architects
PPTX
HBase Vs Cassandra Vs MongoDB - Choosing the right NoSQL database
PPTX
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
PDF
Python 起步走
PPTX
Apache HBase Performance Tuning
Elastic HBase on Mesos - HBaseCon 2015
我的互联网运维理论与实践
特卖场景下的大数据平台和机器学习实践
美团数据库运维平台介绍
The simplethebeautiful
Tokyo HBase Meetup - Realtime Big Data at Facebook with Hadoop and HBase (ja)
阿里巴巴运维自动化的探索与规划
基于Python构建可扩展的自动化运维平台
HBase for Architects
HBase Vs Cassandra Vs MongoDB - Choosing the right NoSQL database
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
Python 起步走
Apache HBase Performance Tuning
Ad

Similar to Protocol libraries the right way (20)

PDF
Python tools for testing web services over HTTP
PDF
H2O - the optimized HTTP server
PDF
Hyper Introduction
PDF
Python, do you even async?
PDF
A deep dive into PEP-3156 and the new asyncio module
PDF
Tornado Web Server Internals
PDF
Pybind11 - SciPy 2021
PDF
Let's read code: python-requests library
PDF
Netty: asynchronous data transfer
PDF
How do event loops work in Python?
PDF
Python concurrency: libraries overview
PDF
The two flavors of Python 3.13 - PyHEP 2024
PPTX
Async programming and python
PPTX
Python For Large Company?
PDF
«Scrapy internals» Александр Сибиряков, Scrapinghub
PDF
Elegant concurrency
PPTX
HTTP2 and gRPC
PDF
PyCon2022 - Building Python Extensions
PDF
Twisted
PDF
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
Python tools for testing web services over HTTP
H2O - the optimized HTTP server
Hyper Introduction
Python, do you even async?
A deep dive into PEP-3156 and the new asyncio module
Tornado Web Server Internals
Pybind11 - SciPy 2021
Let's read code: python-requests library
Netty: asynchronous data transfer
How do event loops work in Python?
Python concurrency: libraries overview
The two flavors of Python 3.13 - PyHEP 2024
Async programming and python
Python For Large Company?
«Scrapy internals» Александр Сибиряков, Scrapinghub
Elegant concurrency
HTTP2 and gRPC
PyCon2022 - Building Python Extensions
Twisted
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
Ad

More from Leo Zhou (20)

PPTX
第三名 3rd zhyict
PDF
异常检测在苏宁的实践
PPTX
第二名 2nd 火眼金睛
PPTX
第四名 4th H3C AI Institute
PPTX
第一名 1st Bocoiops
PPTX
第六名 6th Aurora
PDF
AI使能网络自动驾驶 AI Building Autonomous Driving Network
PDF
2.2 go在阿里云cdn系统的应用
PDF
1.6 米嘉 gobuildweb
PDF
1.4 go在数据存储上面的应用—毛剑
PDF
1.2 刘奇 go在分布式数据库中的应用
PDF
如何选择 Docker 监控方案
PDF
美团数据库运维平台介绍
PDF
The net is dark and full of terrors - James Bennett
PDF
Hypothesis randomised testing for django
PDF
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
PDF
动静态混合网站或 APP的CDN优化方法
PDF
MySQL运维那些事
PDF
天灾还是人祸? Oracle连环夺命未遂记
PDF
关于服务器评测与选型
第三名 3rd zhyict
异常检测在苏宁的实践
第二名 2nd 火眼金睛
第四名 4th H3C AI Institute
第一名 1st Bocoiops
第六名 6th Aurora
AI使能网络自动驾驶 AI Building Autonomous Driving Network
2.2 go在阿里云cdn系统的应用
1.6 米嘉 gobuildweb
1.4 go在数据存储上面的应用—毛剑
1.2 刘奇 go在分布式数据库中的应用
如何选择 Docker 监控方案
美团数据库运维平台介绍
The net is dark and full of terrors - James Bennett
Hypothesis randomised testing for django
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
动静态混合网站或 APP的CDN优化方法
MySQL运维那些事
天灾还是人祸? Oracle连环夺命未遂记
关于服务器评测与选型

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
A Presentation on Artificial Intelligence
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
MIND Revenue Release Quarter 2 2025 Press Release
Building Integrated photovoltaic BIPV_UPV.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A comparative analysis of optical character recognition models for extracting...
Programs and apps: productivity, graphics, security and other tools
Advanced methodologies resolving dimensionality complications for autism neur...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Review of recent advances in non-invasive hemoglobin estimation
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Spectral efficient network and resource selection model in 5G networks
Dropbox Q2 2025 Financial Results & Investor Presentation

Protocol libraries the right way