Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Distributed Comet with Lift and Amazon SNS

Distributed Comet with Lift and Amazon SNS

Description of using Amazon SNS to distribute comet messages around a cluster of Liftweb machines.

Richard Dallaway

October 06, 2012
Tweet

More Decks by Richard Dallaway

Other Decks in Technology

Transcript

  1. 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.
  2. 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?
  3. 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
  4. 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"
  5. 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"
  6. 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"