Slide 1

Slide 1 text

Distributed Comet with Lift and Amazon SNS Richard Dallaway @d6y Jono Ferguson @jonoabroad [email protected]

Slide 2

Slide 2 text

You have multiple users chatting to your server, real-time using comet. server1:8080 "Hi" "Hi" Load balancer for http://myapp:80 Easy. All is good in the world.

Slide 3

Slide 3 text

You add another server. server1:8080 "Hi" "Hi" Load balancer for http://myapp:80 server2:8081 "yo!" "yo!" How does the "Hi" message get to the "yo" users too?

Slide 4

Slide 4 text

Here's how...

Slide 5

Slide 5 text

During boot, each server registers with a Simple Notification Service topic... server1:8080 Load balancer for http://myapp:80 server2:8081 AWS SNS: topic = "chat" Register me to "chat" R server1:/8080/ confirmed! C

Slide 6

Slide 6 text

When someone chats, the message goes to SNS first.... server1:8080 "Hi" Load balancer for http://myapp:80 server2:8081 AWS SNS: topic = "chat" "Hi"

Slide 7

Slide 7 text

SNS distributes it back to all registered servers (that's what SNS does).... server1:8080 Load balancer for http://myapp:80 server2:8081 AWS SNS: topic = "chat" "Hi"

Slide 8

Slide 8 text

Finally, each server can push back to all connected clients. server1:8080 Load balancer for http://myapp:80 server2:8081 AWS SNS: topic = "chat" "Hi" "Hi" "Hi" "Hi"

Slide 9

Slide 9 text

Huzzah.

Slide 10

Slide 10 text

Servers are identical. (no special per-instance configuration)

Slide 11

Slide 11 text

Servers don't have to know about each other. (and SNS is cheap, fast & reliable)

Slide 12

Slide 12 text

Doesn't have to be SNS. Anything with a publish/subscribe model can do this (e.g., RabbitMQ)

Slide 13

Slide 13 text

https://github.com/SpiralArm/liftmodules-aws-sns