This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
87 lines (70 loc) · 1.68 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'bundler'
require "resque/tasks"
require "rspec/core/rake_task"
Bundler.setup
Bundler::GemHelper.install_tasks
$: << File.dirname(__FILE__)
namespace :examples do
desc "Simply echo jobs to the console"
task :echo do
require "examples/echo"
end
desc "Serial processing when the block doesn't defer"
task :sleep do
require "examples/sleep"
end
desc "Concurrent processing using EM.defer"
task :defer do
require "examples/defer"
end
desc "Concurrent processing by blocking on an HTTP connection"
task :http do
require "examples/http"
end
end
namespace :bench do
desc "Bench Pace just running through its loop"
task :pace_simple do
require "bench/pace_simple"
end
desc "Bench throttled worker"
task :pace_throttled do
require "bench/pace_throttled"
end
desc "Bench Pace with New Relic monitoring"
task :pace_newrelic do
require "bench/pace_newrelic"
end
desc "Bench HTTP calls through Pace"
task :pace_http do
ENV["PACE_QUEUE"] = "normal"
require "bench/pace_http"
end
desc "Bench HTTP calls through Resque"
task :resque_http do
ENV["COUNT"] = "10"
ENV["QUEUE"] = "normal"
# ENV["VERBOSE"] = "1"
Rake::Task["resque:workers"].invoke
end
desc "Inject jobs for benchmarking"
task :jobs do
require "resque"
require "bench/resque_http"
count = (ENV["COUNT"] || 100).to_i
count.times do |n|
Resque.enqueue(ResqueHttp, :n => n)
end
end
end
# For benchmark purposes
namespace :resque do
task :setup do
require "bench/resque_http"
end
end
desc "Run specs"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = "spec/**/*_spec.rb"
end
task :default => :spec