Professional Documents
Culture Documents
Fastsocket: Speed Up Your Socket
Fastsocket: Speed Up Your Socket
Fastsocket: Speed Up Your Socket
SINA
Xiaofeng Lin
jerrylin.lxf@gmail.com
Contributor
SINA:
Xiaofeng Lin
Xiaodong Li
Tsinghua:
Yu Chen
Junjie Mao
Jiaquan He
Socket API Problem
• Scalability Performance
• Future Work
Fastsocket
• Scalability Performance
• Future Work
Testing Environment
• HAProxy: Open source TCP/HTTP loadbalancer.
• OS: CentOS-6.2 (Kernel : 2.6.32-220.23.1.el6)
• CPU: Intel Ivy-Bridge E5-2697-v2 (12 core) * 2
• NIC: Intel X520 (Support Flow-Director)
• Scenario: short TCP connections
http_̲l oad
http_̲l oad
Kernel Inefficiency
• Just awkward
What to do
• Hardware Assistance
Limited effects. (NIC offload feature)
Haproxy Haproxy
CPU0 CPU1
Queue-0 Queue-1
RSS
Global TCB Management
• Listen Socket:
– A single listen socket is used for connection setup
• Established Socket:
– A global hash table is used for connection management
Global TCB Management
Haproxy Haproxy
CPU0 CPU1
Listen Socket
Kernel
Queue-0 Queue-1
NIC
VFS Overhead
• Resources Partition
• Local Processing
Design Component
• Fastsocket-aware VFS
Fastsocket Architecture
Fastsocket-aware VFS
NET-RX NET-RX
SoftIRQ SoftIRQ
RSS
NIC
Haproxy Haproxy
CPU0 CPU1
Network Network
Stack Stack
Kernel
Good Path
Bad Path
Queue-0 Queue-1
RSS
Clone the listen socket for each CPU core in LOCAL table.
Haproxy Haproxy
Local Local
Listen Socket Listen Socket
CPU0 CPU1
Queue-0 Queue-1
NIC
Local Established Table
Haproxy Haproxy
Local Local
Establish Table Establish Table
Kernel
CPU0 CPU1
Queue-0 Queue-1
NIC
Fastsocket-aware VFS
Fastsocket-aware VFS
NET-RX NET-RX
SoftIRQ SoftIRQ
RSS
NIC
E5-2697-v2
Fastsocket 406632
Fastsocket-HT 476331(117.2%)
• Scalability Performance
• Future Work
Methodology
• Network Specialization
• Cross-Layer Design
Network Specialization
• Slab
• Epoll
• VFS
• Timer etc.
Motivation:
Solution:
– Direct-TCP
– Receive-CPU-Selection
Fastsocket Direct-TCP
Testing Environment:
Configuration:
Disable Flow-Director:
Enable Flow-Director:
• Scalability Performance
• Future Work
Compatibility & Generality
• Load fastsocket.ko
LD_PRELOAD=./libfsocket.so haproxy
Maintainability
• Flexible Control
– Selectively enable Fastsocket to certain applications (nginx)
– Compatible with regular socket (ssh)
• Quick Rollback
– Restart the application without libfsocket.so
• Easy Updating
– Most of codes are in fastsocket.ko
– Updating fastsocket.ko and libfsocket.so is enough
SINA Deployment
• Scalability Performance
• Future Work
Future Work
• Make it faster
• Linux Mainstream
Open Source
https://github.com/fastos/fastsocket
Recruitment
Join us !
xiaodong2@staff.sina.com
Fastsocket
Thank you!
Q &A