SlideShare a Scribd company logo
1
VOXXED DAYS MINSK 2018
BUILDING SCALABLE
WEBSOCKET BACKEND
KONSTANTIN SLISENKO
LEAD SOFTWARE ENGINEER
MAY 26, 2018
2
kslisenko@gmail.com
Konstantin Slisenko
• Java Team Lead at EPAM
• I’m building trading software
• 8+ years with Java
• 3+ years with WebSocket
github.com/kslisenko
3
4
5
WHAT IS WEBSOCKET
standard: tools.ietf.org/html/rfc6455
6
HTTP
WHAT IS WEBSOCKET
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
standard: tools.ietf.org/html/rfc6455
7
HTTP
WHAT IS WEBSOCKET
HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
standard: tools.ietf.org/html/rfc6455
8
TCP
HTTP
WHAT IS WEBSOCKET
HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
DATA DATA DATA DATA DATA
DATA DATA DATA DATA DATA
standard: tools.ietf.org/html/rfc6455
9
• Permanent connection
WEBSOCKET PROVIDES
10
• Permanent connection
• Bidirectional communication
WEBSOCKET PROVIDES
11
• Permanent connection
• Bidirectional communication
• Sending text or binary data
WEBSOCKET PROVIDES
12
• Permanent connection
• Bidirectional communication
• Sending text or binary data
• Guaranteed delivery (TCP/IP)
WEBSOCKET PROVIDES
13
• API and application protocol
WEBSOCKET DOESN’T PROVIDE
14
• API and application protocol
• Network failure handling*
WEBSOCKET DOESN’T PROVIDE
*Only basic handling
15
• API and application protocol
• Network failure handling*
• Network slowness handling*
WEBSOCKET DOESN’T PROVIDE
*Only basic handling
16
• API and application protocol
• Network failure handling*
• Network slowness handling*
• Bandwidth/frequency limitation
WEBSOCKET DOESN’T PROVIDE
*Only basic handling
17
ONE DOES NOT SIMPLY
BUILD HIGH PERFORMANCE APPLICATION
USING ONLY STANDARD WEBSOCKET FEATURES
18
High performance WebSocket backend
Basic WebSocket backend
19
BACKEND
BASIC WEBSOCKET
20
data
subscribe
WebSocket
data
subscribe
WebSocket
21
data
subscribe
WebSocket
data
subscribe
WebSocket
any
protocol
data
subscribe
22
data
subscribe
WebSocket
any
protocol
data
data
subscribe
WebSocket
subscribe
IBM
AAPL
IBM
AAPL
23
AAPL
data
subscribe
WebSocket
AAPL
IBM
any
protocol
data
IBM
EPAM
data
subscribe
WebSocket
subscribe
IBM
TSLA
24
BACKEND
BASIC WEBSOCKET
LIVE DEMO
25
26
TOO MUCH DATA?
SEND LESS DATA!
27
High performance WebSocket backend
Max frequency limit
Basic WebSocket backend
28
HOW DO WE
SEND LESS DATA?
29
RESAMPLING
No limits (10 updates/s)
30
RESAMPLING
No limits (10 updates/s)
2 updates/s
31
No limits (10 updates/s)
200 300 400 500 700 900
2 updates/s (last available)
900 1000600
600
100
100
RESAMPLING + CONFLATION
32
No limits (10 updates/s)
100 200 300 400 500 600 700 800
2 updates/s (average)
300
900 1000
RESAMPLING + CONFLATION
800
100 + 200 + 300 + 400 + 500
5
= 300
600 + 700 + 800 + 900 + 1000
5
= 800
33
data
data
subscribe
data
subscribe
subscribe
AAPL
IBM
IBM
TSLA
WebSocket
WebSocket
any
protocol
RECEIVINGTHREAD(S)
34
data
data
subscribe
data
subscribe
subscribe
AAPL
IBM
IBM
TSLA
WebSocket
WebSocket
any
protocol
SHAREDMEMORY
RECEIVINGTHREAD(S)
35
data
data
subscribe
data
subscribe
subscribe
AAPL
IBM
IBM
TSLA
WebSocket
WebSocket
SENDINGTHREAD(S)
any
protocol
SHAREDMEMORY
RECEIVINGTHREAD(S)
36
data
data
subscribe
data
subscribe
subscribeAAPL
IBM
IBM
TSLA
TSLA
data
IBM
data
AAPL
data
37
data
data
subscribe
data
subscribe
subscribeAAPL
IBM
IBM
TSLA
TSLA
data
info
info
info
info
rate limit
rate limit
rate limit
rate limit
IBM
data
AAPL
data
38
WEBSOCKET
FREQUENCY LIMIT
LIVE DEMO
39
MAX FREQUENCY LIMIT
2 KB/s*
Max frequency limit
33 KB/s*
No limits
-95%
* for demo application including gzip compression
40
WHAT ELSE, CAP?
41
WHAT ELSE, CAP?
SEND EVEN LESS DATA!
42
High performance WebSocket backend
Schema
Max frequency limit
Basic WebSocket backend
43
AAPL
snapshot
BID=10
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
SCHEMA
44
AAPL
snapshot
BID=10
schema
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=10
ASK=15
SCHEMA
BID
ASK
45
AAPL
snapshot
BID=10
schema
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=10
ASK=15
BID=10
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
SCHEMA
BID
ASK
schema
*
46
High performance WebSocket backend
Max frequency limit
Basic WebSocket backend
Delta delivery
Schema
47
DELTA DELIVERY
BID=10
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=15
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=20
ASK=20
LAST=12
BID SIZE=20
ASK SIZE=30
BID=20
ASK=20
LAST=12
BID SIZE=50
ASK SIZE=30
message message message message
48
DELTA DELIVERY
BID=10
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=15
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=20
ASK=20
LAST=12
BID SIZE=20
ASK SIZE=30
BID=20
ASK=20
LAST=12
BID SIZE=50
ASK SIZE=30
message message message message
49
DELTA DELIVERY
BID=10
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=15
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30
BID=20
ASK=20
LAST=12
BID SIZE=20
ASK SIZE=30
BID=20
ASK=20
LAST=12
BID SIZE=50
ASK SIZE=30
message message message message
BID=10
ASK=15
LAST=12
BID SIZE=20
ASK SIZE=30 BID=15
BID=20
ASK=20 BID SIZE=50
snapshot update update update
50
High performance WebSocket backend
Delta delivery
Schema
Max frequency limit
Basic WebSocket backend
Position-based protocol
51
{
symbol: AAPL,
bid: 10,
ask: 12,
last: 11,
bidSize: 100,
askSize: 200
}
AAPL|10|12|11|100|200
? bytes ? bytes
52
{
symbol: AAPL,
bid: 10,
ask: 12,
last: 11,
bidSize: 100,
askSize: 200
}
AAPL|10|12|11|100|200
85 bytes 21 bytes
53
{
symbol: AAPL,
bid: 10,
ask: 12,
last: 11,
bidSize: 100,
askSize: 200
}
AAPL||12|||200
46 bytes 14 bytes
54
BANDWIDTH
OPTIMIZATION
LIVE DEMO
55
SCHEMA + DELTA DELIVERY + POSITION-BASED PROTOCOL
400 B/s*
Using schema
2 KB/s*
No schema
-80%
* for demo application including gzip compression
370 B/s*
Delta delivery
-8%
310 B/s*
Position-based
-15%
56
GOOD JOB!
57
High performance WebSocket backend
Position-based protocol
Delta delivery
Schema
Max frequency limit
Basic WebSocket backend
Dynamic bandwidth control
58
59
DYNAMIC BANDWIDTH CONTROL
60
DYNAMIC BANDWIDTH CONTROL
Data
61
DYNAMIC BANDWIDTH CONTROL
Data
62
DYNAMIC BANDWIDTH CONTROL
DataData
63
DYNAMIC BANDWIDTH CONTROL
DataData
Data Data
ACK ACK ACK ACK ACK
64
DYNAMIC
LIVE DEMO
BANDWIDTH CONTROL
65
DYNAMIC BANDWIDTH CONTROL
420 B/s*
Bandwidth control
310 B/s*
No control
+35%
* for demo application including gzip compression
66
ARE WE READY
FOR PRODUCTION?
67
68
http://lightstreamer.com
69
LIGHTSTREAMER SERVER
70
LIGHTSTREAMER SERVER
Data
adapter
71
LIGHTSTREAMER SERVER
Data
adapter
Metadata
adapter
72
CONCLUSION
73
No improvements
2 KB/s*Max frequency limit
400 B/s*Schema
370 B/s*Delta delivery
310 B/s*Position-based
420 B/s*Bandwidth control
-95%
-80%
-8%
-15%
+35%
33 KB/s*
* for demo application including gzip compression
BANDWIDTH OPTIMIZATION*
74
READ
High Performance Browser Networking
What every web developer should know
about networking and web performance
Free reading: https://hpbn.co/
By Ilya Grigorik
Publisher: O'Reilly Media
Release Date: September 2013
75
http://lightstreamer.com/docs
76
More Than Just WebSockets for Real-Time
Multiplayer Games and Collaboration
On YouTube and Slideshare
By Alessandro Alinone (CEO of Lightstreamer)
77
1. Improve user-experience
2. Reduce bandwidth
3. Handle network failures
TAKE AWAYS
78
QUESTIONS?
THANK YOU!
79
github.com/kslisenko/streaming

More Related Content

What's hot (20)

PDF
Configure proxy firewall on SuSE Linux Enterprise Server 11
Tola LENG
 
PDF
DDoS Attacks - Scenery, Evolution and Mitigation
Wilson Rogerio Lopes
 
DOCX
Ad, dns, dhcp, file server
Tola LENG
 
PDF
P&G BT Global Services - LLD Final Revision Year 2008.
Kapil Sabharwal
 
PDF
02 - IDNOG04 - Sheryl Hermoso (APNIC) - IPv6 Deployment at APNIC
Indonesia Network Operators Group
 
PDF
Http2 right now
Daniel Stenberg
 
PPTX
APRICOT 2015 - NetConf for Peering Automation
Tom Paseka
 
PPTX
Cache aware-server-push in H2O version 1.5
Kazuho Oku
 
PDF
Securing Asterisk: A practical approach
Bangladesh Network Operators Group
 
PDF
Ripe71 FastNetMon open source DoS / DDoS mitigation
Pavel Odintsov
 
PDF
Scalable Networking
l xf
 
PDF
DEF CON 27 - MAKSIM SHUDRAK - zero bugs found hold my beer afl how to improve...
Felipe Prado
 
PDF
Http3 fullstackfest-2019
Daniel Stenberg
 
PDF
Kamailio - SIP Servers Everywhere
Daniel-Constantin Mierla
 
PDF
Configure DHCP Server and DHCP-Relay
Tola LENG
 
PPTX
DeiC DDoS Prevention System - DDPS
Pavel Odintsov
 
PPTX
Building Scalable Data Center Networks
Cumulus Networks
 
PDF
SRX Automation at Groupon
Alejandro Salinas
 
PDF
Learning Erlang And Developing A Sip Server Stack With 30k Potential Users
l xf
 
PDF
Handy Networking Tools and How to Use Them
Sneha Inguva
 
Configure proxy firewall on SuSE Linux Enterprise Server 11
Tola LENG
 
DDoS Attacks - Scenery, Evolution and Mitigation
Wilson Rogerio Lopes
 
Ad, dns, dhcp, file server
Tola LENG
 
P&G BT Global Services - LLD Final Revision Year 2008.
Kapil Sabharwal
 
02 - IDNOG04 - Sheryl Hermoso (APNIC) - IPv6 Deployment at APNIC
Indonesia Network Operators Group
 
Http2 right now
Daniel Stenberg
 
APRICOT 2015 - NetConf for Peering Automation
Tom Paseka
 
Cache aware-server-push in H2O version 1.5
Kazuho Oku
 
Securing Asterisk: A practical approach
Bangladesh Network Operators Group
 
Ripe71 FastNetMon open source DoS / DDoS mitigation
Pavel Odintsov
 
Scalable Networking
l xf
 
DEF CON 27 - MAKSIM SHUDRAK - zero bugs found hold my beer afl how to improve...
Felipe Prado
 
Http3 fullstackfest-2019
Daniel Stenberg
 
Kamailio - SIP Servers Everywhere
Daniel-Constantin Mierla
 
Configure DHCP Server and DHCP-Relay
Tola LENG
 
DeiC DDoS Prevention System - DDPS
Pavel Odintsov
 
Building Scalable Data Center Networks
Cumulus Networks
 
SRX Automation at Groupon
Alejandro Salinas
 
Learning Erlang And Developing A Sip Server Stack With 30k Potential Users
l xf
 
Handy Networking Tools and How to Use Them
Sneha Inguva
 

Similar to VoxxedDays Minsk - Building scalable WebSocket backend (20)

PPTX
Web Front End Performance
Chris Love
 
PDF
NYC WebPerf Meetup Feb 2020 - Measuring the Adoption of Web Performance Techn...
Paul Calvano
 
PDF
Bringing JAMStack to the Enterprise
C4Media
 
PPTX
Delivering High Performance Websites with NGINX
NGINX, Inc.
 
PDF
Bringing the JAMstack to the Enterprise
Jamund Ferguson
 
PPTX
Best practices of building data streaming API
Constantine Slisenka
 
PDF
Linux Kernel vs DPDK: HTTP Performance Showdown
ScyllaDB
 
PDF
From Web Acceleration to Content Delivery with Varnish - Howest Brugge 2024
Thijs Feryn
 
PPTX
Content Acceleration Beyond Caching, Understanding Dynamic Content
CDNetworks
 
PDF
Nginx, PHP, Apache and Spelix
Harald Zeitlhofer
 
KEY
The HTML5 WebSocket API
David Lindkvist
 
PDF
Linux Native, HTTP Aware Network Security
Thomas Graf
 
PPTX
ENSURING FAST AND SECURE GAMING APPLICATION DOWNLOADS GLOBALLY
CDNetworks
 
PDF
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
Nicolas Martignole
 
PDF
High Performance TensorFlow in Production - Big Data Spain - Madrid - Nov 15 ...
Chris Fregly
 
PDF
HTTP logging with varnishlog (Brussels PHP 2022)
Thijs Feryn
 
PPTX
Practical webRTC - from API to Solution - webRTC Summit 2014 @ NYC
Alexandre Gouaillard
 
PDF
The value of reactive
Stéphane Maldini
 
PDF
The Value of Reactive
VMware Tanzu
 
Web Front End Performance
Chris Love
 
NYC WebPerf Meetup Feb 2020 - Measuring the Adoption of Web Performance Techn...
Paul Calvano
 
Bringing JAMStack to the Enterprise
C4Media
 
Delivering High Performance Websites with NGINX
NGINX, Inc.
 
Bringing the JAMstack to the Enterprise
Jamund Ferguson
 
Best practices of building data streaming API
Constantine Slisenka
 
Linux Kernel vs DPDK: HTTP Performance Showdown
ScyllaDB
 
From Web Acceleration to Content Delivery with Varnish - Howest Brugge 2024
Thijs Feryn
 
Content Acceleration Beyond Caching, Understanding Dynamic Content
CDNetworks
 
Nginx, PHP, Apache and Spelix
Harald Zeitlhofer
 
The HTML5 WebSocket API
David Lindkvist
 
Linux Native, HTTP Aware Network Security
Thomas Graf
 
ENSURING FAST AND SECURE GAMING APPLICATION DOWNLOADS GLOBALLY
CDNetworks
 
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
Nicolas Martignole
 
High Performance TensorFlow in Production - Big Data Spain - Madrid - Nov 15 ...
Chris Fregly
 
HTTP logging with varnishlog (Brussels PHP 2022)
Thijs Feryn
 
Practical webRTC - from API to Solution - webRTC Summit 2014 @ NYC
Alexandre Gouaillard
 
The value of reactive
Stéphane Maldini
 
The Value of Reactive
VMware Tanzu
 
Ad

More from Constantine Slisenka (8)

PDF
Unlocking the secrets of successful architects: what skills and traits do you...
Constantine Slisenka
 
PPTX
Lyft talks #4 Orchestrating big data and ML pipelines at Lyft
Constantine Slisenka
 
PDF
What does it take to be architect (for Cjicago JUG)
Constantine Slisenka
 
PDF
What does it take to be an architect
Constantine Slisenka
 
PDF
Latency tracing in distributed Java applications
Constantine Slisenka
 
PDF
Distributed transactions in SOA and Microservices
Constantine Slisenka
 
PDF
Database transaction isolation and locking in Java
Constantine Slisenka
 
PDF
Profiling distributed Java applications
Constantine Slisenka
 
Unlocking the secrets of successful architects: what skills and traits do you...
Constantine Slisenka
 
Lyft talks #4 Orchestrating big data and ML pipelines at Lyft
Constantine Slisenka
 
What does it take to be architect (for Cjicago JUG)
Constantine Slisenka
 
What does it take to be an architect
Constantine Slisenka
 
Latency tracing in distributed Java applications
Constantine Slisenka
 
Distributed transactions in SOA and Microservices
Constantine Slisenka
 
Database transaction isolation and locking in Java
Constantine Slisenka
 
Profiling distributed Java applications
Constantine Slisenka
 
Ad

Recently uploaded (20)

PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Dipole Tech Innovations – Global IT Solutions for Business Growth
dipoletechi3
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PDF
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
PPTX
iaas vs paas vs saas :choosing your cloud strategy
CloudlayaTechnology
 
PDF
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Dipole Tech Innovations – Global IT Solutions for Business Growth
dipoletechi3
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
iaas vs paas vs saas :choosing your cloud strategy
CloudlayaTechnology
 
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 

VoxxedDays Minsk - Building scalable WebSocket backend