Skip to content
Snippets Groups Projects
Commit e038a9c3 authored by Sean McGivern's avatar Sean McGivern :red_circle:
Browse files

Set job durations based on global quantiles

The p10 is a bit of a fudge, but the rest are broadly right.
parent 48334e4b
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,10 @@ module ApplicationWorker
include Sidekiq::Worker # rubocop:disable Cop/IncludeSidekiqWorker
DECILES = [0.02, 0.028, 0.04, 0.054, 0.076, 0.115, 0.225, 0.389, 0.761]
P95 = 1.374
P99 = 3.647
included do
set_queue
end
......@@ -39,5 +43,9 @@ module ApplicationWorker
.underscore
.tr('/', '_')
end
def job_duration
(([DECILES.first] * 14) + (DECILES[1..-1] * 10) + ([P95] * 5) + [P99]).sample
end
end
end
......@@ -29,9 +29,10 @@ ws.each do |w|
classdef = <<-CLASSDEF
class #{class_name}Worker
include Sidekiq::Worker
include ApplicationWorker
def perform(*args)
sleep = Random.rand * 5
sleep = self.class.job_duration
puts \"#{class_name} sleeping for \#{sleep}\"
sleep(sleep)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment