Server Check.in - Node.js and Drupal Working Together

2,957 views
2,946 views

Published on

This presentation was given to the STL.JS meetup group on May 15, 2014: http://www.meetup.com/STL-JS-meetup/events/151436472/

"Midwestern Mac, LLC has integrated a small, scalable Node.js application into their Drupal-powered Server Check.in service. Jeff will take us on an exploration of integrating the two platforms, and explain how this work has enabled the service to scale to hundreds of thousands of ICMP ping and HTTP status checks per day."

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,957
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Server Check.in - Node.js and Drupal Working Together

  1. 1. Server Check.in Node.js Case Study by Jeff Geerling
  2. 2. Jeff Geerling • jeffgeerling.com / geerlingguy • Senior Application Developer, Mercy • Owner, Midwestern Mac, LLC
  3. 3. Agenda • About the service • A love story (Drupal + Node.js) • Hosting, Marketing, Monitoring • Q&A
  4. 4. Why build another uptime monitor?
  5. 5. Why build another uptime monitor?
  6. 6. Server Check.in • Dogfood project • Simple, cheap, reliable service • Notify me when my servers are down • Launched December, 2012 https://servercheck.in @servercheckin
  7. 7. Demo
  8. 8. External Services • Twilio • Stripe • Disqus
  9. 9. External Services • Twilio • Stripe • Disqus (for sms notifications)
  10. 10. External Services • Twilio • Stripe • Disqus (for sms notifications) (for payment processing)
  11. 11. External Services • Twilio • Stripe • Disqus (for sms notifications) (for payment processing) (for comments)
  12. 12. External Code/Libraries • Flot (jQuery graphing library) ! ! • MailChimp email templates !
  13. 13. ♥+
  14. 14. Server Checking • Originally: DB Queue + multithreaded cron batch • Problems: • Wasn’t scaling with growth • Synchronous server checking via PHP cURL (slow even with 8-16 threads) • 10 min interval maximum
  15. 15. Server Checking Source: https://servercheck.in/blog/moving-functionality-nodejs-increased-server
  16. 16. Server Checking Source: https://servercheck.in/blog/moving-functionality-nodejs-increased-server 10s 3s 5s 1s 7s 26 seconds total
  17. 17. Server Checking Source: https://servercheck.in/blog/moving-functionality-nodejs-increased-server 10s 3s 5s 1s 7s 26 seconds total 10s 3s 5s 1s 7s 10 seconds total
  18. 18. Server Checking Source: https://servercheck.in/blog/moving-functionality-nodejs-increased-server Asynchronous tasks can be done in PHP (or many other languages), but Node.js makes them easier. 10s 3s 5s 1s 7s 26 seconds total 10s 3s 5s 1s 7s 10 seconds total
  19. 19. Server Checking • Now: External Node.js application • Allows: • Scalability, geographically-diverse checking • Servers are checked asynchronously • 1 minute check intervals for everyone (yay!)
  20. 20. Server Check Overview • Drupal! • Callback - JSON list of servers to check • Callback - accept POST of JSON server check result data • Node.js! • Cron-based mini app: • retrieve list of servers • check all servers (async) • post batch of data back to Drupal
  21. 21. Code
  22. 22. • For HTTP requests: mikeal/request • For ICMP pings: geerlingguy/jjg-ping • For Async control flow: caolan/async
  23. 23. Hosting on the Cheap • Cheap Low End Box servers (~$15/year VPS) • Main need: geographically-diverse, decent network I/O - not CPU, disk, reliability, etc. • Infrastructure managed with Ansible • New servers in < 10 min. (aside: check out Ansible for DevOps) • Cheap service + cheap servers + frequent changes == 99.9% uptime? • (testing + automation == reliability)
  24. 24. Launch / Marketing “If you build it, they will come.”
  25. 25. Launch / Marketing “If you build it, they will come.”
  26. 26. Launch / Marketing • Some things I’ve tried: • Drupal.org case study • Hacker News post • Sponsoring blogs • Blogging (servercheck.in/blog) • Keep trying new things!
  27. 27. Metrics - CRM/Dashboard Track important metrics!
  28. 28. Metrics - Munin Monitor resource usage!
  29. 29. Summary • Drupal/PHP is a solid platform for user-based web applications • Node.js is a solid platform for lightweight asynchronous, I/O-heavy work • And maybe more… • You can do a lot with a little (hosting, marketing, monitoring)
  30. 30. Thanks! (Use coupon code STL14 for 20% off!) • More Resources: • Simple Node.js Dev VM (Ansible + Vagrant) • Server Check.in Blog / @servercheckin • Ansible for DevOps

×