Skip to content

Instantly share code, notes, and snippets.

@kssminus
Created March 31, 2015 09:51
Show Gist options
  • Save kssminus/2fc3d279ef636b17d672 to your computer and use it in GitHub Desktop.
Save kssminus/2fc3d279ef636b17d672 to your computer and use it in GitHub Desktop.
benchmark rufus scheduler
require 'rufus-scheduler'
require 'awesome_print'
require 'logger'
SCHEDULE_COUNT = 1000
MAX_THREAD = 224
schedule_samples = { type: "cron", schedule: "* * * * *"}
$logger = Logger.new("benchmark.log")
scheduler = Rufus::Scheduler.singleton(:max_work_threads => MAX_THREAD)
class Handler
def self.call(job, time)
$logger.info job.last_time - time
end
end
SCHEDULE_COUNT.times do
scheduler.send( schedule_samples[:type].to_sym, schedule_samples[:schedule], Handler)
end
sleep 600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment