vaadin scalability-slides
DESCRIPTION
Маштабируемость приложений. Узнайте как приложения Vaadin масштабируются при большом числе пользователей.Joonas Lehtinen, VaadinVaadin Developer Meetup, Санкт-Петербург, 24 января 2011 годаTRANSCRIPT
![Page 1: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/1.jpg)
Joonas Lehtinen, PhDVaadin Ltd, CEO
Server-side RIA Scalability
perjantaina 21. tammikuuta 2011
![Page 2: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/2.jpg)
Vaadin is a UI framework
for desktop-like web apps
perjantaina 21. tammikuuta 2011
![Page 3: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/3.jpg)
htmljava
perjantaina 21. tammikuuta 2011
![Page 4: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/4.jpg)
Vaadin valueproposition
simplerforget the web cost-effective
no JavaScript debuggingmodular
extensible ♲
powerfulall Java tools& libraries
more securecode stays in server
open sourcefree Apachelicense
perjantaina 21. tammikuuta 2011
![Page 5: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/5.jpg)
BUTperjantaina 21. tammikuuta 2011
![Page 6: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/6.jpg)
Does ItScale?
perjantaina 21. tammikuuta 2011
![Page 7: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/7.jpg)
Server-side RIA?
perjantaina 21. tammikuuta 2011
![Page 8: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/8.jpg)
“Web 1.0”
DOM
Client Server
ViewHTML Page
over HttpResponse
Controller
Model
Parameters overHttpRequest
DB2
3
4
5
1
perjantaina 21. tammikuuta 2011
![Page 9: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/9.jpg)
Client-side RIA
DOM
Client Server
View
Controller
Model
DB2
3
4
5
1
Requested datato view as
XML / JSON
Changes to modelencoded as parameters
perjantaina 21. tammikuuta 2011
![Page 10: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/10.jpg)
Server-side RIA
DOM
Client Server
ViewHTML Pageover HttpResponse
Controller
Model
Parameters overHttpRequest
DB4
5
6
2
Term
inalAdapter
Term
inalAdapter
Automated bythe RIA framework
3
7
1
9
8
Handled by the framework
perjantaina 21. tammikuuta 2011
![Page 11: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/11.jpg)
Scale?
perjantaina 21. tammikuuta 2011
![Page 12: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/12.jpg)
Server-side RIA Scalability questions
Initial application download and Ajax traffic
Server-side CPUusage by the user interface logic
Server-side memory consumption per session
Top 3 Questions
perjantaina 21. tammikuuta 2011
![Page 13: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/13.jpg)
AnswerDepends on your application
perjantaina 21. tammikuuta 2011
![Page 14: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/14.jpg)
Useful AnswerScales enough for most applications
perjantaina 21. tammikuuta 2011
![Page 15: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/15.jpg)
Big enough application toprove the point?
perjantaina 21. tammikuuta 2011
![Page 16: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/16.jpg)
Movie ticket reservationsystem
perjantaina 21. tammikuuta 2011
![Page 17: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/17.jpg)
Think BIG
perjantaina 21. tammikuuta 2011
![Page 18: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/18.jpg)
238 countries
perjantaina 21. tammikuuta 2011
![Page 19: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/19.jpg)
6 624 theaters
perjantaina 21. tammikuuta 2011
![Page 20: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/20.jpg)
69 347 rooms
perjantaina 21. tammikuuta 2011
![Page 21: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/21.jpg)
20.7M seats
perjantaina 21. tammikuuta 2011
![Page 22: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/22.jpg)
3 movies per night
perjantaina 21. tammikuuta 2011
![Page 23: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/23.jpg)
up to
1.9 billiontickets per month
perjantaina 21. tammikuuta 2011
![Page 24: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/24.jpg)
up to
224 billion! per year[ assuming 10! / ticket ]
perjantaina 21. tammikuuta 2011
![Page 25: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/25.jpg)
which is 10X total global box office sales of 30 billion USD in 2009 estimated by MPAA
perjantaina 21. tammikuuta 2011
![Page 26: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/26.jpg)
assume• 10% fill rate to reach global sales in 2009• 2 tickets per sales transaction
we should be able to handle2140 sales transactions per minute on average - 24/7(assuming uniform load)
perjantaina 21. tammikuuta 2011
![Page 27: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/27.jpg)
How it’s made?
perjantaina 21. tammikuuta 2011
![Page 28: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/28.jpg)
Vaadin Framework
Business Logic
User Interface Logic
MySQL DB
perjantaina 21. tammikuuta 2011
![Page 29: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/29.jpg)
Business Logic
MySQL DB
countriescities
theatersshows
... rese
rvat
ions
paid
tick
ets
perjantaina 21. tammikuuta 2011
![Page 30: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/30.jpg)
Business Logic
Memcached
MySQL DB
cities, ...
reservations
paidtickets
cities, ...
perjantaina 21. tammikuuta 2011
![Page 31: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/31.jpg)
Vaadin
Logic
UI
Cache
MySQL DB
Tomcat
Vaadin
Logic
UI
Cache
Tomcat
Vaadin
Logic
UI
Cache
Tomcat
perjantaina 21. tammikuuta 2011
![Page 32: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/32.jpg)
Tomcat Tomcat Tomcat
MySQL
ELB
EC2-Large• 7.5GB mem• 2 CPU cores• $0.34 / hour
EC2-Large• 7.5GB mem• 2 CPU cores• $0.34 / hour
EC2-Large• 7.5GB mem• 2 CPU cores• $0.34 / hour
RDS-Large• $0.44 / hour
perjantaina 21. tammikuuta 2011
![Page 33: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/33.jpg)
Benchmark
perjantaina 21. tammikuuta 2011
![Page 34: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/34.jpg)
Test Tomcat Tomcat
ELB
Apache JMetertestrecording
perjantaina 21. tammikuuta 2011
![Page 35: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/35.jpg)
Test Tomcat Tomcat
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
t t t t 14 JMeter servers (EC2-Large)2000 threads per server
ELB
perjantaina 21. tammikuuta 2011
![Page 36: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/36.jpg)
Test Tomcat Tomcat
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
Apa
che
JMet
er
t t t t 14 JMeter servers (EC2-Large)2000 threads per server
perjantaina 21. tammikuuta 2011
![Page 37: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/37.jpg)
Scenarios per minute
One Tomcat Server
0
600
1200
1800
2400
3000
Sales / Minute0
30
60
90
120
150
Avg response (ms)
2000 3000 4000 5000 6000
Average ajax response (ms)
Concurrent simulated users usersperjantaina 21. tammikuuta 2011
![Page 38: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/38.jpg)
Scenarios per minute
One Tomcat Server
0
600
1200
1800
2400
3000
Sales / Minute0
30
60
90
120
150
Avg response (ms)
2000 3000 4000 5000 6000
Average ajax response (ms)
Concurrent simulated users users
GOAL all tickets in 20092140
perjantaina 21. tammikuuta 2011
![Page 39: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/39.jpg)
Goal of selling all tickets in the
world reached with only one
server!
perjantaina 21. tammikuuta 2011
![Page 40: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/40.jpg)
What happens with multiple servers?
perjantaina 21. tammikuuta 2011
![Page 41: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/41.jpg)
Scenarios per minute
Three Tomcat Servers
0
1200
2400
3600
4800
6000
Sales / Minute0
80
160
240
320
400
Avg response (ms)
2000 3000 4000 5000 6000 18000
Average ajax response (ms)
Concurrent simulated users users
3 se
rver
s
3 se
rver
s
1 server 1 server
perjantaina 21. tammikuuta 2011
![Page 42: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/42.jpg)
3 xservers
2.6 xtransactions
perjantaina 21. tammikuuta 2011
![Page 43: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/43.jpg)
What if we overload the server?
perjantaina 21. tammikuuta 2011
![Page 44: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/44.jpg)
Scenarios per minute
Three Tomcat Servers
0
1200
2400
3600
4800
6000
Sales / Minute0
400
800
1200
1600
2000
Avg response (ms)
2000 3000 4000 5000 6000 18000 28000
Average ajax response (ms)
Concurrent simulated users users
3 se
rver
s
3 se
rver
s
1 server
2 se
rver
s
2 se
rver
s
1 server
perjantaina 21. tammikuuta 2011
![Page 45: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/45.jpg)
Too many users
5 x latency
98% of the transactions
per server
perjantaina 21. tammikuuta 2011
![Page 46: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/46.jpg)
Optimizations
perjantaina 21. tammikuuta 2011
![Page 47: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/47.jpg)
1. Profile memory
perjantaina 21. tammikuuta 2011
![Page 48: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/48.jpg)
2. Explicit session clear in the end
perjantaina 21. tammikuuta 2011
![Page 49: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/49.jpg)
3. Minimize database use
perjantaina 21. tammikuuta 2011
![Page 50: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/50.jpg)
4. Move static resources to AWS CloudFront
perjantaina 21. tammikuuta 2011
![Page 51: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/51.jpg)
Expected hostingcosts?
perjantaina 21. tammikuuta 2011
![Page 52: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/52.jpg)
Servers
3 x Tomcat Server (EC2-Large)$2730 / year total (reserved instance)
1 x MySQL Server (RDS-Large)$910 / year (reserved instance)
Total $3640 / year
perjantaina 21. tammikuuta 2011
![Page 53: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/53.jpg)
Network
Elastic Load Balancing$8819 / year
1050TB traffic$86000 / year
Total $94819 / year
perjantaina 21. tammikuuta 2011
![Page 54: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/54.jpg)
Total hosting costs
Hosting costs are 0.00043% of the ticket sales revenues sales
$87 per million sales transactions
Total hosting costs: $100.000 / year
perjantaina 21. tammikuuta 2011
![Page 55: Vaadin scalability-slides](https://reader033.vdocument.in/reader033/viewer/2022052505/554e28f5b4c9056b798b5233/html5/thumbnails/55.jpg)
QuestionsComments
[email protected]+358-40-5035001skype://joonaslehtinen
perjantaina 21. tammikuuta 2011