Real time fluent communication using SignalR and Cloud (Windows Azure)
Real time web with SignalR
-
Upload
alessandro-melchiori -
Category
Technology
-
view
393 -
download
6
description
Transcript of Real time web with SignalR
![Page 1: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/1.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
WEB06 WEB IN REAL TIME CON ASP.NET SIGNALR
![Page 2: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/2.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
Grazie a
Sponsor
![Page 3: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/3.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
Agenda• What / Why / When
• Event-driven architecture and SignlaR
• Scale-out SignalR
• Performance tips
![Page 4: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/4.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
About meAlessandro MelchioriSoftware architect @ codiceplastico
@amelchiori
http://melkio.blog.codiceplastico.com
![Page 5: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/5.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
demoSignalR.Intro
![Page 6: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/6.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
Pres
enta
tion
Laye
r
Serv
ice
Laye
r
Dom
ain
Mod
el
Storage
Da qui…
![Page 7: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/7.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
Pres
enta
tion
Laye
r
Serv
ice
Laye
r
Dom
ain
Mod
el
Write storage
Read storage
…a qui
![Page 8: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/8.jpg)
message bus
SignalR core architecture: pub/sub
message cache
publisher
client client client client
- serializzazione- salvataggio in cache- “deliverable”
client
worker worker worker
- selezione worker- recupero messaggio
notifica al client (over specific transport)
![Page 9: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/9.jpg)
Pattern 1. Server broadcast
• Low rate broadcast of the same payload to all clients
• One message bus send maps to many users (fan out)
• More clients don’t increase message bus traffic
![Page 10: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/10.jpg)
Pattern 2. Server push
• Low rate broadcast of the unique payload to each client
• One message bus send maps to one user (no fan out)
• More clients means more message bus traffic
![Page 11: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/11.jpg)
Pattern 3. User event driven
• Broadcast on client actions
• One message bus send maps to many users (fan out)
• More clients means more message bus traffic
![Page 12: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/12.jpg)
Pattern 4. High frequency real-time
• Fixed high rate broadcast from servers and clients
• One message bus send maps to one user (no fan out)
• More clients means more message bus traffic
![Page 13: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/13.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
demoEvent-driven architecture & SignalR
![Page 14: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/14.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
Remember…
Have your app do as little as possible. If you do nothing, you can scale infinitely.
Scott Hanselman
![Page 15: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/15.jpg)
Scale-out issues: message delivery
?How do messages from one server get
to the other servers in my web farm?
![Page 16: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/16.jpg)
Scale-out issues: client transience
server 1
client
server 2
When is a client disconnected from
my app?
How do I avoid duplicate & missed
messages as I move from server to
server?
![Page 17: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/17.jpg)
Scale-out issues: client distribution
server 1 server 2
client “foo”
client “foo”
client “foo,bar”
client “foo”
client “bar”
client “bar”
client “foo”
client “foo”
What happens if “foo” clients get many
more messages than others?
![Page 18: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/18.jpg)
Scale-out SignalR
• SQL Server, Redis & Windows Azure Service Bus
• Great for the server broadcast load pattern
• Limited for other scenarios Every message goes to every server, so as traffic increases you’re
limited by how fast any one web server can pull messages off of the backplane
Backplanes are *much* slower than single-server performance
![Page 19: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/19.jpg)
Scale-out provider architecture
web nodes
clients
backplaneMessages sharded
over multiple backplane streams
![Page 20: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/20.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
demoScale-out SignalR
![Page 21: Real time web with SignalR](https://reader036.fdocuments.us/reader036/viewer/2022062405/554fae15b4c9057b298b4f34/html5/thumbnails/21.jpg)
#CDays14 – Milano 25, 26 e 27 Febbraio 2014
Q&ATutto il materiale di questa sessione su
http://www.communitydays.it/
Lascia il feedback su questa sessione,
potrai essere estratto per i nostri premi!
Seguici su
Twitter @CommunityDaysIT
Facebook http://facebook.com/cdaysit
#CDays14