A look at the technologies and the architecture behind the emerging real-time web. We will discuss XMPP/Jabber and AMQP protocols and explore the advantages of each over the commonly used HTTP request-response cycle. As part of the workshop we will look at the available tools and libraries and work through simple examples of creating an event driven, real-time service.
16. Auto Manufacturing circa 1910
2-3 men, 1-2 days / car
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
17. More
workers!
Scaling the manufacturing process
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
18. Then Henry Ford came along…
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
19. And gave us the assembly line!
Scaling the manufacturing process
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
20. Queuing theory
Lean manufacturing
Just in time
Lower response time,
higher throughput!
93 seconds / car
1M + cars / year
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
21. Event Driven Architecture (EDA) = Assembly line
except, we’re not building cars here…
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
22. 1. 5 ms - Receive
2. 30 ms - Verify
Total: 365 ms, ~ 3 req / s
3. 30 ms - Save
4. 200 ms – Generate PDF
5. 50 ms - Email
6. 50 ms - Render
GET /purchase
OK
Monolith Order Processing (example)
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
23. Can someone else do it?
Total: 115 ms, ~ 3 req / s
1. 5 ms – Receive No
~ 70% improvement in
2. 30 ms - Verify No
response time!
3. 30 ms – Save No
4. 200 ms – Generate PDF Yes
5. 50 ms – Email Yes
6. 50 ms – Render Yes
GET /purchase
OK
Assembly Line Order Processing (example)
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
24. 1. 5 ms - Receive
2. 30 ms - Verify
3. 30 ms - Save
1. Generate PDF
4. 10 ms – Dispatch 1. Email PDF
2. Dispatch
5. 50 ms – Render
Total: 125 ms
GET /purchase
OK
Assembly Line Order Processing (example)
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
25. 1. 5 ms - Receive
2. 30 ms - Verify
3. 30 ms - Save
1. Generate PDF
4. 10 ms – Dispatch 1. Email PDF
2. Dispatch
5. 50 ms – Render
Total: 125 ms
GET /purchase
OK
Event-Driven Staged Architecture (SEDA)
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
26. Don’t keep the client waiting!
“Can I defer it?”
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
27. PDF service layer Email service layer
GET /purchase
OK
Services Oriented Architecture (SOA)
helps you maintain your sanity
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
28. Scalability of service layer
GET /purchase
OK
SOA = Simple(r) Scalability
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
41. From: A, To: B From: A, To: B
Hello! Hello!
Extensible Messaging and Presence Protocol (XMPP)
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
42. Event-stream
protocol
Persistent
connections
Presence
Identity and
XMPP Features
authentication
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
43. User Domain Resource
ilya@aiderss.com/office
Jabber Software
Foundation
JID: Federation, Identity & Authentication
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
56. <iq type='set‘ from='hamlet@denmark.lit/blogbot' to='pubsub.shakespeare.lit' id='pub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='princely_musings'>
IQ Stanza
<item>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>Soliloquy<title>
<summary>
To be, or not to be: that is the question!
<summary>
<link rel='alternate' type='text/html'
href='http://denmark.lit/2003/12/13/atom03'/>
<id>tag:denmark.lit,2003:entry-32397</id>
<published>2003-12-13T18:30:02Z</published>
<updated>2003-12-13T18:30:02Z</updated>
</entry>
</item>
</publish>
PubSub Protocol: Client XML
</pubsub>
</iq>
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
57. <iq type='set‘ from='hamlet@denmark.lit/blogbot' to='pubsub.shakespeare.lit' id='pub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='princely_musings'>
<item>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>Soliloquy<title>
<summary>
To be, or not to be: that is the question!
<summary>
<link rel='alternate' type='text/html'
AtomPub
href='http://denmark.lit/2003/12/13/atom03'/>
<id>tag:denmark.lit,2003:entry-32397</id>
<published>2003-12-13T18:30:02Z</published>
<updated>2003-12-13T18:30:02Z</updated>
</entry>
</item>
</publish>
PubSub Protocol: Client XML
</pubsub>
</iq>
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
68. “AMQP is an open Internet Protocol for Business Messaging”
AMQP Working Group (16 companies)
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
71. Routing key: usd.stock.amz
Message: I like AMZ!
Direct Topic Fanout
Exchange Exchange Exchange
AMQP Broker Internals
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
72. Routing key: usd.stock.amz
Message: I like AMZ!
Direct Topic Fanout
Exchange Exchange Exchange
Name: amazon
Queue
Bind: usd.stock.amz
AMQP Direct Exchange
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
73. Routing key: usd.stock.amz
Message: I like AMZ!
Direct Topic Fanout
Exchange Exchange Exchange
Queue Queue Message: I like AMZ!
AMQP Direct Exchange
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
74. Routing key: usd.stock.msft
Message: I like Microsoft!
Direct Topic Fanout
Exchange Exchange Exchange
Name: stocks
Queue
Bind: usd.stock.*
AMQP Topic Exchange
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
75. Routing key: usd.stock.msft
Message: I like Microsoft!
Direct Topic Fanout
Exchange Exchange Exchange
Queue Message: I like Microsoft!
AMQP Topic Exchange
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
79. Routing key: usd.stock.amz
Message: I like AMZ!
Direct Topic Fanout
Exchange Exchange Exchange
Queue Only one client gets the message!
AMQP Load Balancing
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda
80. Bind: purchase.pdf
GET /purchase
OK
Elastic AMQP Load-balancing
Event-Driven Architectures http://bit.ly/eda-mesh @igrigorik #meshu #eda