Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
delayed_job benchmarks with multiple workers
require 'spec/spec_helper'
require 'logger'
require 'benchmark'
workers = 4
puts "#{workers} workers"
Benchmark.bm(10) do |x|
Delayed::Job.delete_all
(1000...10001).step(500).each do |n|
n.times { "foo".delay.length }
x.report("#{n} jobs") do
Delayed::Worker.backend.before_fork
workers.times do
fork do
Delayed::Worker.backend.after_fork
Delayed::Worker.new(:quiet => true).work_off(n)
end
end
Process.waitall
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment