ruby daemons

of 21 /21
Ruby Daemons Creston Jamison Ruby Tree Software, Inc

Author: creston-jamison

Post on 20-Jun-2015

96 views

Category:

Software


4 download

Embed Size (px)

DESCRIPTION

Learn how to use daemons with your ruby based application like Ruby on Rails. See how it compares to other queueing systems like Queue Classic, Sidekiq, or Delayed Job.

TRANSCRIPT

  • 1. Ruby Daemons Creston Jamison RubyTree Software, Inc.

2. GAMEhud HTTPAPI accepts event and player based data from game clients. Incoming data needs to be distributed between 10-20 tables. Dont want to do that in the request. Need to do background processing! 3. 1. Reliability 2. Speed 4. Background Processing Options Delayed Job Beanstalkd Resque Sidekiq Queue Classic Daemons 5. Delayed Job Uses rake Uses full rails environment Best for long running and infrequent jobs 6. Beanstalkd Fast queue Does not poll Good for raw speed Authentication and queue management ? 7. Resque Redis based queue system Requires Redis Comes with an admin interface Uses polling 8. Sidekiq Redis based queue system Requires Redis Comes with an admin interface Uses polling Uses threads Code needs to be thread safe 9. Queue Classic Postgres based queue system Requires postgresql Avoids separate queue process Can avoid polling 10. Queue vs. Worker 11. Daemons Converts a script into a daemon Not a queue system A way to create a worker process 12. What is a daemon? A computer program that runs as a background process Daemon processes typically end in d For example: sshd 13. Setting up a daemon Install daemons gem Create a control file event_worker_control.rb Create a loop in the script called by the control file event_worker.rb 14. Create a control file require 'rubygems' require 'bundler/setup' require 'daemons' Daemons.run('lib/daemons/event_worker.rb') 15. Loop in your script $: