Successfully reported this slideshow.
How To Develop Innovative,
Scalable Systems?
Chat System
How hard can it be?
• Authentication
• Slowmode
• Moderator
• Admins
• Subscribers
• Timeout
• Ban
• Limits per user
• Notify messages
• Image...
Realtime
No IRC!
WebSocket
Web Server
UI
Let’s try this
PHP
Mysql
Auto scaling
Less than 2k
Back to the drawing Board!
WebSocket Load
balancing
Permission and
security model
(Admin, Mods, ...)
Frontend Server Backend Server
UI
Ok, so let’s t...
• Small, cheap machines
• Handle the connections, no logic
• When it breaks it breaks only for a few user
• Automatic Fail...
• Small, cheap machines
• Handles all the logic
• Stateless, can be restarted/upgraded any time
• Easy expandable with new...
• Fast
• I mean, REALLY fast!
• You can cluster it
• Easy to back up
Redis
No single point of failure
Websockets...
WebSocket Load
balancing
Permission and
security model
(Admin, Mods, ...)
Frontend Server Backend Server
UI
Ok, let’s fix ...
Script Kiddies
Validate everything!
• Frontend servers report CPU load every 10 Seconds
• Lowest X frontend servers are send to the UI
• UI selects a frontend...
2000 Messages/seconds
Async.js for the win!
„Self“ DDOS
Cache early, Cache often!
Stupid Software Design
Sometimes Realtime is bad!
Monitor Everything!
Etsy‘s statsd
So, is it Working?
Thank you!
max@hitbox.tv
We are hiring!
jobs.hitbox.tv
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
How to develop innovative, scalable systems
Nächste SlideShare
Wird geladen in …5
×

How to develop innovative, scalable systems

1.421 Aufrufe

Veröffentlicht am

My talk at the wearedevelopers.org conference and at the ViennaJS meetup

Veröffentlicht in: Internet
  • Als Erste(r) kommentieren

How to develop innovative, scalable systems

  1. 1. How To Develop Innovative, Scalable Systems?
  2. 2. Chat System
  3. 3. How hard can it be?
  4. 4. • Authentication • Slowmode • Moderator • Admins • Subscribers • Timeout • Ban • Limits per user • Notify messages • Imagelog • Unlimited Rooms Not that easy! • IP-Ban • Raffle • Voting • Whisper • Blacklist • Block user • Posting Images • DDOS Protection • Limits per channel • Chatlog • System messages
  5. 5. Realtime
  6. 6. No IRC!
  7. 7. WebSocket Web Server UI Let’s try this PHP Mysql Auto scaling
  8. 8. Less than 2k
  9. 9. Back to the drawing Board!
  10. 10. WebSocket Load balancing Permission and security model (Admin, Mods, ...) Frontend Server Backend Server UI Ok, so let’s try this! Frontend Server NodeJs data storage Redis Cluster hitbox REST-API PHP Nginx Backend Server NodeJs Auto scalingAuto scaling Average roundtrip / message: < 300ms
  11. 11. • Small, cheap machines • Handle the connections, no logic • When it breaks it breaks only for a few user • Automatic Failover to another chat frontend server • Socket.io for handling websockets • Carrier for sending messages between front & back • Up & Downscale possible as needed Frontend Server
  12. 12. • Small, cheap machines • Handles all the logic • Stateless, can be restarted/upgraded any time • Easy expandable with new features • Up & Downscale possible as needed • Load balancing via round robin Backend Server
  13. 13. • Fast • I mean, REALLY fast! • You can cluster it • Easy to back up Redis
  14. 14. No single point of failure
  15. 15. Websockets...
  16. 16. WebSocket Load balancing Permission and security model (Admin, Mods, ...) Frontend Server Backend Server UI Ok, let’s fix Websockets Frontend Server NodeJs data storage Redis Cluster hitbox REST-API PHP Nginx Backend Server NodeJs Auto scaling Auto scaling Long Polling Fallback Fallback Server NodeJs
  17. 17. Script Kiddies
  18. 18. Validate everything!
  19. 19. • Frontend servers report CPU load every 10 Seconds • Lowest X frontend servers are send to the UI • UI selects a frontend server randomly from this five • If UI gets disconnected it removes server from list • UI tries another frontend server • IF no servers left UI gets X new frontend servers from API Load Balancing
  20. 20. 2000 Messages/seconds
  21. 21. Async.js for the win!
  22. 22. „Self“ DDOS
  23. 23. Cache early, Cache often!
  24. 24. Stupid Software Design
  25. 25. Sometimes Realtime is bad!
  26. 26. Monitor Everything!
  27. 27. Etsy‘s statsd
  28. 28. So, is it Working?
  29. 29. Thank you! max@hitbox.tv
  30. 30. We are hiring! jobs.hitbox.tv

×