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

Highly Scalable WebSockets with AWS

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

Highly Scalable WebSockets with AWS

Avatar for Henry Pate

Henry Pate

May 13, 2015

Other Decks in Technology

Transcript

  1. Why WebSockets? • Real-time communication • Full duplex connection •

    Low complexity • Less network chatter • Reduced latency
  2. Basic Steps • Register with Route53 • Register for SNS

    Topics • Wait for clients to subscribe • Listen for matching SNS notifications • Emit matches to clients over a WebSocket
  3. Configuration Tweaks • ELB Idle Timeout must be greater than

    the WebSocket heartbeat time • Increase number of open files per process
 
 
 
 • Increase file descriptor limits, and NAT limits
 File: /etc/security/limits.d/websockets.conf root soft nofile 1000000 root hard nofile 1000000 * soft nofile 1000000 * hard nofile 1000000 File: /etc/sysctl.conf fs.file-max = 1000000 fs.nr_open = 1000000 net.ipv4.netfilter.ip_conntrack_max = 1048576 net.nf_conntrack_max = 1048576
  4. Returning results to clients We test each SNS notification we

    receive against queries that clients have registered, if we have a match we send it to the client.
  5. Unsubscribing from SNS This is another init.d script that runs

    on termination and unsubscribes from all SNS topics