SlideShare a Scribd company logo
HTTP Requests Proxying
Alexander Krizhanovsky
Tempesta Technologies, Inc.
ak@tempesta-tech.com
Who am I?
CEO & CTO at Tempesta Technologies
Developing Tempesta FW – open source Linux
Application Delivery Controller (ADC)
Custom software development in:
● high performance network traffic processing
e.g. WAF mentioned in Gartner magic quadrant
● Databases
e.g. MariaDB SQL System Versioning
https://github.com/tempesta-tech/mariadb
https://m17.mariadb.com/session/technical-preview-temporal-queryi
ng-asof
HTTP requests proxying
Load balancing
Backend
connections
management
SSL/TLS
termination
Protocol
downgrade
HTTP proxying issues
How many server connections?
What to do if an upstream resets a connection?
How to manage HTTP message queues?
Is it safe to resend a request to another upstream?
TLS is expensive
Sockets proxying is expensive
HTTP multiplexing - HTTP/2?
Server connections
New connections or persistent
connections
HTTP keep-alive connections
Keep-Alive: timeout=5, max=10000
Reestablish closed KA connection
New connections if all are busy
Tempesta FW: connections
provisioning for DDoS and flash
crowds
How many connections?
There is optimal connections number
for particular Web server and hardware
Large connections number:
Larger latency
Smaller RPS
Connection resets & server failure
Default for Apache HTTPD & Nginx: reset each 100 requests
Dirty hack for messy dynamics
Server failure
● Connection reset or I/O timeout
● HTTP error responses
● Backend healthcheck
• TCP connection
• HTTP response code
• HTTP response body
HTTP message pipelining
Mostly unused by proxies
Squid, Tempesta FW, Polipo
Messages multiplexing
Forwarding and reforwarding
issues
Security issues
● Breaking authentication
● HTTP Response splitting
Connection closing and Keep-Alive
Client
Connection: close + TCP active close (RFC 7230 3.3.3)
no Content-Length
no Transfer-Encoding: chunked
Backend
● Connection: keep-alive
● Add Content-Length
● Now the message can be pipelined
HTTP Response Splitting attack
(Web cache poisoning)
/redir_lang.jsp?lang=foobar%0d%0aContent-Length:%200%0d%0a%0d%0a
HTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0a
Content-Length:%2019%0d%0a%0d%0a<html>Shazam</html>
HTTP/1.1 302 Moved Temporarily
Date: Wed, 24 Dec 2003 15:26:41 GMT
Location: http://10.1.1.1/by_lang.jsp?lang=foobar
Content-Length: 0
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 19
<html>Shazam</html>
Proxy must count number of requests and responses (later detection!)
Validate allowed URI alphabet (also for injection attacks)
(Non-)indempotent requests
RFC 7231 4.2.2: Nonidempotent request changes server state
Idempotent (safe) methods: GET, HEAD, TRACE, OPTIONS
● Admin responsibility: GET /action?do=delete
● Can be POST (e.g. web-search)
Let a user to specify idempotence of methods and resources:
nonidempotent GET prefix “/action”
Pipeline queues
Tempesta FW: switch off pipelining server_queue_size 1
Use a queue with NI-request only if all connections are busy
Resend HTTP requests?
Tainted requests: server_forward_retries and server_forward_timeout
Request-killers – RFC 7230 6.3.2: “a client MUST NOT pipeline
immediately after connection establishment”
● Connection with re-forwarded requests is non-schedulable
Nonidempotent requests aren’t reforwarded
server_retry_nonidempotent
Error messages keep order of responses
Resending HTTP messages + TCP retransmission
Copying is required…
...unless TCP send queue integreated into a proxy
Requests reforwarding
(not for persistent sessions!)
SSL/TLS: no zero-copying
(no sendfile()!)
User-kernel space copying
● Copy network data to user space
● Encrypt/decrypt it
● Copy the data to kernel for transmission
Kernel-mode TLS
● Facebook, RedHat: https://lwn.net/Articles/666509/
● Netflix: https://people.freebsd.org/~rrs/asiabsd_2015_tls.pdf
● DDoS: TLS handshake is still an issue
● Tempesta: http://www.netdevconf.org/2.1/papers/https_tcpip_stack.pdf
Buffering vs streaming
Buffering
● Seems everyone by default
● Performance degradation on large messages
● 200 means OK, no incomplete response
Streaming
● Tengine (patched Nginx) w/
proxy_request_buffering & fastcgi_request_buffering
● More performance, but 200 doesn't mean full response
HTTP messages adjustment
Add/remove/update HTTP headers
Build a new HTTP message
User space HTTP proxying
1. Receive request at CPU1
2. Copy request to user space
3. Update headers
4. Copy request to kernel space
5. Send the request from CPU2
3 data copies
Access TCP control blocks and
data buffers from different CPUs
HTTP messages adjustment: zero-copy
Add/remove/update HTTP headers
w/o copies
skb and its head are allocated in the
same page fragment or a compound
page
Zero-copy sockets proxying
Kernel space or
user space TCP/IP stack
Socket callbacks call TLS and
HTTP processing
Everything is processing in
softirq (while the data is hot)
No receive & accept queues
No file descriptors
Less locking
Tempesta FW: kernel HTTPS/TCP/IP stack
Alternative to user space TCP/IP stacks
HTTPS is built into TCP/IP stack
L7 DDoS mitigation and simple WAF out of the box
Very fast HTTP parser and strings processing using AVX2
TODO
HTTP QoS for asymmetric DDoS mitigation
DSL for multi-layer filter rules
Tempesta FW: zero-copy proxying
Socket callbacks call TLS and
HTTP processing
Everything is processing in
softirq (while the data is hot)
No receive & accept queues
No file descriptors
Less locking
Lock-free inter-CPU transport
=> faster socket reading
=> lower latency
HTTP/2
Pros
● Responses are sent in parallel and in
any order (no head-of-line blocking)
● Compression
Cons
● Zero copy techniques aren’t applicable
=> For client connections (slow network), not for LAN (fast network)
Thanks!
Web-site: http://tempesta-tech.com (Powered by Tempesta FW)
Availability: https://github.com/tempesta-tech/tempesta
Blog: http://natsys-lab.blogspot.com
E-mail: ak@tempesta-tech.com

More Related Content

KEY
Site Performance - From Pinto to Ferrari
ODP
Choosing a Web Architecture for Perl
PDF
LCA2014 - Introduction to Go
PDF
REST in peace @ IPC 2012 in Mainz
PPTX
Эксплуатируем неэксплуатируемые уязвимости SAP
KEY
Going on an HTTP Diet: Front-End Web Performance
PPTX
Altitude San Francisco 2018: Testing with Fastly Workshop
PPTX
Nexcess Magento Imagine 2014 Performance Breakout
Site Performance - From Pinto to Ferrari
Choosing a Web Architecture for Perl
LCA2014 - Introduction to Go
REST in peace @ IPC 2012 in Mainz
Эксплуатируем неэксплуатируемые уязвимости SAP
Going on an HTTP Diet: Front-End Web Performance
Altitude San Francisco 2018: Testing with Fastly Workshop
Nexcess Magento Imagine 2014 Performance Breakout

What's hot (20)

PPTX
Altitude San Francisco 2018: Programming the Edge
PDF
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
PDF
From crash to testcase
PPTX
Elastic stack
PDF
DEF CON 27- ALBINOWAX - http desync attacks
PDF
HTTP2 is Here!
PDF
Using Websockets with Play!
PDF
Developing cacheable PHP applications - PHPLimburgBE 2018
PPT
DTrace - Miracle Scotland Database Forum
PPTX
A Forgotten HTTP Invisibility Cloak
PPTX
Professional Help for PowerShell Modules
KEY
I got 99 problems, but ReST ain't one
PDF
Clojure: Simple By Design
PDF
Defcon CTF quals
KEY
PyCon US 2012 - Web Server Bottlenecks and Performance Tuning
PDF
The Lives of Others: Open-Source Development Practices Elsewhere
PPTX
Pwning with powershell
PPTX
Угадываем пароль за минуту
PDF
Yeti DNS - Experimenting at the root
PDF
Ungooglable
Altitude San Francisco 2018: Programming the Edge
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
From crash to testcase
Elastic stack
DEF CON 27- ALBINOWAX - http desync attacks
HTTP2 is Here!
Using Websockets with Play!
Developing cacheable PHP applications - PHPLimburgBE 2018
DTrace - Miracle Scotland Database Forum
A Forgotten HTTP Invisibility Cloak
Professional Help for PowerShell Modules
I got 99 problems, but ReST ain't one
Clojure: Simple By Design
Defcon CTF quals
PyCon US 2012 - Web Server Bottlenecks and Performance Tuning
The Lives of Others: Open-Source Development Practices Elsewhere
Pwning with powershell
Угадываем пароль за минуту
Yeti DNS - Experimenting at the root
Ungooglable
Ad

Viewers also liked (20)

PDF
Database First! О распространённых ошибках использования РСУБД / Николай Само...
PPTX
Погружение в виртуальную память и большие страницы / Константин Новаковский (...
PDF
Настройка kubernetes: tips and tricks / Михаил Прокопчук (Avito)
PDF
Развитие баз данных в Dropbox. Путь от одной глобальной базы MySQL к 6000 шар...
PDF
NoSQL Best Practices for PostgreSQL / Дмитрий Долгов (Mindojo)
PDF
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
PDF
Введение в блокчейн и алгоритмы консенсуса / Филипп Филиппак (Waves Platform)
PDF
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
PPTX
Что нового в nginx? / Максим Дунин (Nginx, Inc.)
PDF
Как писать сервис, поддержка которого не превращается в ад / Антон Резников, ...
PDF
Лучшие практики CI/CD с Kubernetes и GitLab / Дмитрий Столяров (Флант)
PDF
Cassandra для хранения метаданных: успехи и провалы / Андрей Смирнов (Virtust...
PPTX
Масштабирование сети VR-аттракционов CinemaVR / Андрей Татаринов (VRTech)
PDF
Как и зачем создавать NginX-модуль — теория, практика, профит. Часть 2 / Васи...
PPTX
Технологии хранения для больших проектов / Сергей Платонов (RAIDIX)
PDF
Микросервисный фронтенд / Вячеслав Слинько (ЦИАН)
PPTX
Искусство предсказания: как давать более точные оценки времени проекта / Андр...
PDF
Карта граблей на поле сбора и доставки логов. Lazada-way / Юрий Бушмелев (Laz...
PDF
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
PDF
Как мы сделали многопользовательскую браузерную игру для HL++ с воксельной гр...
Database First! О распространённых ошибках использования РСУБД / Николай Само...
Погружение в виртуальную память и большие страницы / Константин Новаковский (...
Настройка kubernetes: tips and tricks / Михаил Прокопчук (Avito)
Развитие баз данных в Dropbox. Путь от одной глобальной базы MySQL к 6000 шар...
NoSQL Best Practices for PostgreSQL / Дмитрий Долгов (Mindojo)
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
Введение в блокчейн и алгоритмы консенсуса / Филипп Филиппак (Waves Platform)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Что нового в nginx? / Максим Дунин (Nginx, Inc.)
Как писать сервис, поддержка которого не превращается в ад / Антон Резников, ...
Лучшие практики CI/CD с Kubernetes и GitLab / Дмитрий Столяров (Флант)
Cassandra для хранения метаданных: успехи и провалы / Андрей Смирнов (Virtust...
Масштабирование сети VR-аттракционов CinemaVR / Андрей Татаринов (VRTech)
Как и зачем создавать NginX-модуль — теория, практика, профит. Часть 2 / Васи...
Технологии хранения для больших проектов / Сергей Платонов (RAIDIX)
Микросервисный фронтенд / Вячеслав Слинько (ЦИАН)
Искусство предсказания: как давать более точные оценки времени проекта / Андр...
Карта граблей на поле сбора и доставки логов. Lazada-way / Юрий Бушмелев (Laz...
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
Как мы сделали многопользовательскую браузерную игру для HL++ с воксельной гр...
Ad

Similar to Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempesta Technologies) (20)

PDF
Web acceleration mechanics
PPTX
Http - All you need to know
PPTX
PDF
Revisiting HTTP/2
PDF
Communicating on the web
ODP
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
PDF
What HTTP/2.0 Will Do For You
PDF
Acus08 Advanced Load Balancing Apache2.2
PDF
ExaProxy
PDF
ApacheConNA 2015: Apache httpd 2.4 Reverse Proxy
PPT
Http
PPTX
Interactive web. O rly?
PPTX
Http2 kotlin
PDF
Http Status Report
PPTX
PPTX
Web technologies: HTTP
PDF
Hidden Gems in HTTP
PDF
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
PDF
Application layer
PPT
Http VS. Https
Web acceleration mechanics
Http - All you need to know
Revisiting HTTP/2
Communicating on the web
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
What HTTP/2.0 Will Do For You
Acus08 Advanced Load Balancing Apache2.2
ExaProxy
ApacheConNA 2015: Apache httpd 2.4 Reverse Proxy
Http
Interactive web. O rly?
Http2 kotlin
Http Status Report
Web technologies: HTTP
Hidden Gems in HTTP
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
Application layer
Http VS. Https

More from Ontico (20)

PDF
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
PDF
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
PPTX
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
PDF
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
PDF
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
PDF
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)
PDF
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
PDF
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
PPTX
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
PPTX
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
PDF
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
PPTX
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
PPTX
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
PDF
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
PPT
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
PPTX
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
PPTX
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
PPTX
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
PPTX
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
PDF
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...

Recently uploaded (20)

PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Lecture Notes Electrical Wiring System Components
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Well-logging-methods_new................
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Project quality management in manufacturing
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT 4 Total Quality Management .pptx
Model Code of Practice - Construction Work - 21102022 .pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Lecture Notes Electrical Wiring System Components
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
bas. eng. economics group 4 presentation 1.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
CH1 Production IntroductoryConcepts.pptx
Well-logging-methods_new................
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Project quality management in manufacturing
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
R24 SURVEYING LAB MANUAL for civil enggi
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT 4 Total Quality Management .pptx

Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempesta Technologies)

  • 1. HTTP Requests Proxying Alexander Krizhanovsky Tempesta Technologies, Inc. ak@tempesta-tech.com
  • 2. Who am I? CEO & CTO at Tempesta Technologies Developing Tempesta FW – open source Linux Application Delivery Controller (ADC) Custom software development in: ● high performance network traffic processing e.g. WAF mentioned in Gartner magic quadrant ● Databases e.g. MariaDB SQL System Versioning https://github.com/tempesta-tech/mariadb https://m17.mariadb.com/session/technical-preview-temporal-queryi ng-asof
  • 3. HTTP requests proxying Load balancing Backend connections management SSL/TLS termination Protocol downgrade
  • 4. HTTP proxying issues How many server connections? What to do if an upstream resets a connection? How to manage HTTP message queues? Is it safe to resend a request to another upstream? TLS is expensive Sockets proxying is expensive HTTP multiplexing - HTTP/2?
  • 5. Server connections New connections or persistent connections HTTP keep-alive connections Keep-Alive: timeout=5, max=10000 Reestablish closed KA connection New connections if all are busy Tempesta FW: connections provisioning for DDoS and flash crowds
  • 6. How many connections? There is optimal connections number for particular Web server and hardware Large connections number: Larger latency Smaller RPS
  • 7. Connection resets & server failure Default for Apache HTTPD & Nginx: reset each 100 requests Dirty hack for messy dynamics Server failure ● Connection reset or I/O timeout ● HTTP error responses ● Backend healthcheck • TCP connection • HTTP response code • HTTP response body
  • 8. HTTP message pipelining Mostly unused by proxies Squid, Tempesta FW, Polipo Messages multiplexing Forwarding and reforwarding issues Security issues ● Breaking authentication ● HTTP Response splitting
  • 9. Connection closing and Keep-Alive Client Connection: close + TCP active close (RFC 7230 3.3.3) no Content-Length no Transfer-Encoding: chunked Backend ● Connection: keep-alive ● Add Content-Length ● Now the message can be pipelined
  • 10. HTTP Response Splitting attack (Web cache poisoning) /redir_lang.jsp?lang=foobar%0d%0aContent-Length:%200%0d%0a%0d%0a HTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0a Content-Length:%2019%0d%0a%0d%0a<html>Shazam</html> HTTP/1.1 302 Moved Temporarily Date: Wed, 24 Dec 2003 15:26:41 GMT Location: http://10.1.1.1/by_lang.jsp?lang=foobar Content-Length: 0 HTTP/1.1 200 OK Content-Type: text/html Content-Length: 19 <html>Shazam</html> Proxy must count number of requests and responses (later detection!) Validate allowed URI alphabet (also for injection attacks)
  • 11. (Non-)indempotent requests RFC 7231 4.2.2: Nonidempotent request changes server state Idempotent (safe) methods: GET, HEAD, TRACE, OPTIONS ● Admin responsibility: GET /action?do=delete ● Can be POST (e.g. web-search) Let a user to specify idempotence of methods and resources: nonidempotent GET prefix “/action”
  • 12. Pipeline queues Tempesta FW: switch off pipelining server_queue_size 1 Use a queue with NI-request only if all connections are busy
  • 13. Resend HTTP requests? Tainted requests: server_forward_retries and server_forward_timeout Request-killers – RFC 7230 6.3.2: “a client MUST NOT pipeline immediately after connection establishment” ● Connection with re-forwarded requests is non-schedulable Nonidempotent requests aren’t reforwarded server_retry_nonidempotent Error messages keep order of responses Resending HTTP messages + TCP retransmission Copying is required… ...unless TCP send queue integreated into a proxy
  • 14. Requests reforwarding (not for persistent sessions!)
  • 15. SSL/TLS: no zero-copying (no sendfile()!) User-kernel space copying ● Copy network data to user space ● Encrypt/decrypt it ● Copy the data to kernel for transmission Kernel-mode TLS ● Facebook, RedHat: https://lwn.net/Articles/666509/ ● Netflix: https://people.freebsd.org/~rrs/asiabsd_2015_tls.pdf ● DDoS: TLS handshake is still an issue ● Tempesta: http://www.netdevconf.org/2.1/papers/https_tcpip_stack.pdf
  • 16. Buffering vs streaming Buffering ● Seems everyone by default ● Performance degradation on large messages ● 200 means OK, no incomplete response Streaming ● Tengine (patched Nginx) w/ proxy_request_buffering & fastcgi_request_buffering ● More performance, but 200 doesn't mean full response
  • 17. HTTP messages adjustment Add/remove/update HTTP headers Build a new HTTP message
  • 18. User space HTTP proxying 1. Receive request at CPU1 2. Copy request to user space 3. Update headers 4. Copy request to kernel space 5. Send the request from CPU2 3 data copies Access TCP control blocks and data buffers from different CPUs
  • 19. HTTP messages adjustment: zero-copy Add/remove/update HTTP headers w/o copies skb and its head are allocated in the same page fragment or a compound page
  • 20. Zero-copy sockets proxying Kernel space or user space TCP/IP stack Socket callbacks call TLS and HTTP processing Everything is processing in softirq (while the data is hot) No receive & accept queues No file descriptors Less locking
  • 21. Tempesta FW: kernel HTTPS/TCP/IP stack Alternative to user space TCP/IP stacks HTTPS is built into TCP/IP stack L7 DDoS mitigation and simple WAF out of the box Very fast HTTP parser and strings processing using AVX2 TODO HTTP QoS for asymmetric DDoS mitigation DSL for multi-layer filter rules
  • 22. Tempesta FW: zero-copy proxying Socket callbacks call TLS and HTTP processing Everything is processing in softirq (while the data is hot) No receive & accept queues No file descriptors Less locking Lock-free inter-CPU transport => faster socket reading => lower latency
  • 23. HTTP/2 Pros ● Responses are sent in parallel and in any order (no head-of-line blocking) ● Compression Cons ● Zero copy techniques aren’t applicable => For client connections (slow network), not for LAN (fast network)
  • 24. Thanks! Web-site: http://tempesta-tech.com (Powered by Tempesta FW) Availability: https://github.com/tempesta-tech/tempesta Blog: http://natsys-lab.blogspot.com E-mail: ak@tempesta-tech.com