sidekiq 5.2.5 → 6.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.circleci/config.yml +82 -0
- data/.gitignore +0 -2
- data/.standard.yml +20 -0
- data/6.0-Upgrade.md +72 -0
- data/COMM-LICENSE +11 -9
- data/Changes.md +136 -0
- data/Ent-2.0-Upgrade.md +37 -0
- data/Ent-Changes.md +32 -1
- data/Gemfile +12 -17
- data/Gemfile.lock +196 -0
- data/Pro-5.0-Upgrade.md +25 -0
- data/Pro-Changes.md +26 -2
- data/README.md +19 -31
- data/Rakefile +5 -4
- data/bin/sidekiqload +33 -25
- data/bin/sidekiqmon +8 -0
- data/lib/generators/sidekiq/templates/worker_test.rb.erb +1 -1
- data/lib/generators/sidekiq/worker_generator.rb +20 -12
- data/lib/sidekiq/api.rb +230 -214
- data/lib/sidekiq/cli.rb +111 -174
- data/lib/sidekiq/client.rb +55 -46
- data/lib/sidekiq/delay.rb +5 -6
- data/lib/sidekiq/exception_handler.rb +10 -12
- data/lib/sidekiq/extensions/action_mailer.rb +10 -20
- data/lib/sidekiq/extensions/active_record.rb +9 -7
- data/lib/sidekiq/extensions/class_methods.rb +9 -7
- data/lib/sidekiq/extensions/generic_proxy.rb +4 -4
- data/lib/sidekiq/fetch.rb +11 -12
- data/lib/sidekiq/job_logger.rb +45 -7
- data/lib/sidekiq/job_retry.rb +71 -60
- data/lib/sidekiq/launcher.rb +57 -51
- data/lib/sidekiq/logger.rb +165 -0
- data/lib/sidekiq/manager.rb +7 -9
- data/lib/sidekiq/middleware/chain.rb +14 -4
- data/lib/sidekiq/middleware/i18n.rb +5 -7
- data/lib/sidekiq/monitor.rb +133 -0
- data/lib/sidekiq/paginator.rb +18 -14
- data/lib/sidekiq/processor.rb +83 -75
- data/lib/sidekiq/rails.rb +23 -29
- data/lib/sidekiq/redis_connection.rb +31 -37
- data/lib/sidekiq/scheduled.rb +28 -29
- data/lib/sidekiq/testing/inline.rb +2 -1
- data/lib/sidekiq/testing.rb +34 -23
- data/lib/sidekiq/util.rb +17 -16
- data/lib/sidekiq/version.rb +2 -1
- data/lib/sidekiq/web/action.rb +14 -10
- data/lib/sidekiq/web/application.rb +64 -66
- data/lib/sidekiq/web/helpers.rb +89 -71
- data/lib/sidekiq/web/router.rb +17 -14
- data/lib/sidekiq/web.rb +41 -49
- data/lib/sidekiq/worker.rb +129 -97
- data/lib/sidekiq.rb +61 -42
- data/sidekiq.gemspec +16 -16
- data/web/assets/javascripts/dashboard.js +4 -23
- data/web/assets/stylesheets/application-dark.css +125 -0
- data/web/assets/stylesheets/application.css +9 -0
- data/web/assets/stylesheets/bootstrap.css +1 -1
- data/web/locales/de.yml +14 -2
- data/web/locales/ja.yml +2 -1
- data/web/views/_job_info.erb +2 -1
- data/web/views/busy.erb +4 -1
- data/web/views/dead.erb +2 -2
- data/web/views/layout.erb +1 -0
- data/web/views/morgue.erb +4 -1
- data/web/views/queue.erb +10 -1
- data/web/views/queues.erb +1 -1
- data/web/views/retries.erb +4 -1
- data/web/views/retry.erb +2 -2
- data/web/views/scheduled.erb +4 -1
- metadata +21 -32
- data/.travis.yml +0 -17
- data/Appraisals +0 -9
- data/bin/sidekiqctl +0 -237
- data/gemfiles/rails_4.gemfile +0 -31
- data/gemfiles/rails_5.gemfile +0 -31
- data/lib/sidekiq/core_ext.rb +0 -1
- data/lib/sidekiq/logging.rb +0 -122
- data/lib/sidekiq/middleware/server/active_record.rb +0 -23
data/Gemfile.lock
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sidekiq (6.0.2)
|
5
|
+
connection_pool (>= 2.2.2)
|
6
|
+
rack (>= 2.0.0)
|
7
|
+
rack-protection (>= 2.0.0)
|
8
|
+
redis (>= 4.1.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actioncable (6.0.0)
|
14
|
+
actionpack (= 6.0.0)
|
15
|
+
nio4r (~> 2.0)
|
16
|
+
websocket-driver (>= 0.6.1)
|
17
|
+
actionmailbox (6.0.0)
|
18
|
+
actionpack (= 6.0.0)
|
19
|
+
activejob (= 6.0.0)
|
20
|
+
activerecord (= 6.0.0)
|
21
|
+
activestorage (= 6.0.0)
|
22
|
+
activesupport (= 6.0.0)
|
23
|
+
mail (>= 2.7.1)
|
24
|
+
actionmailer (6.0.0)
|
25
|
+
actionpack (= 6.0.0)
|
26
|
+
actionview (= 6.0.0)
|
27
|
+
activejob (= 6.0.0)
|
28
|
+
mail (~> 2.5, >= 2.5.4)
|
29
|
+
rails-dom-testing (~> 2.0)
|
30
|
+
actionpack (6.0.0)
|
31
|
+
actionview (= 6.0.0)
|
32
|
+
activesupport (= 6.0.0)
|
33
|
+
rack (~> 2.0)
|
34
|
+
rack-test (>= 0.6.3)
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
+
actiontext (6.0.0)
|
38
|
+
actionpack (= 6.0.0)
|
39
|
+
activerecord (= 6.0.0)
|
40
|
+
activestorage (= 6.0.0)
|
41
|
+
activesupport (= 6.0.0)
|
42
|
+
nokogiri (>= 1.8.5)
|
43
|
+
actionview (6.0.0)
|
44
|
+
activesupport (= 6.0.0)
|
45
|
+
builder (~> 3.1)
|
46
|
+
erubi (~> 1.4)
|
47
|
+
rails-dom-testing (~> 2.0)
|
48
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
+
activejob (6.0.0)
|
50
|
+
activesupport (= 6.0.0)
|
51
|
+
globalid (>= 0.3.6)
|
52
|
+
activemodel (6.0.0)
|
53
|
+
activesupport (= 6.0.0)
|
54
|
+
activerecord (6.0.0)
|
55
|
+
activemodel (= 6.0.0)
|
56
|
+
activesupport (= 6.0.0)
|
57
|
+
activestorage (6.0.0)
|
58
|
+
actionpack (= 6.0.0)
|
59
|
+
activejob (= 6.0.0)
|
60
|
+
activerecord (= 6.0.0)
|
61
|
+
marcel (~> 0.3.1)
|
62
|
+
activesupport (6.0.0)
|
63
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
64
|
+
i18n (>= 0.7, < 2)
|
65
|
+
minitest (~> 5.1)
|
66
|
+
tzinfo (~> 1.1)
|
67
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
68
|
+
ast (2.4.0)
|
69
|
+
builder (3.2.3)
|
70
|
+
byebug (11.0.1)
|
71
|
+
coderay (1.1.2)
|
72
|
+
concurrent-ruby (1.1.5)
|
73
|
+
connection_pool (2.2.2)
|
74
|
+
crass (1.0.4)
|
75
|
+
docile (1.3.2)
|
76
|
+
erubi (1.8.0)
|
77
|
+
globalid (0.4.2)
|
78
|
+
activesupport (>= 4.2.0)
|
79
|
+
hiredis (0.6.3)
|
80
|
+
i18n (1.6.0)
|
81
|
+
concurrent-ruby (~> 1.0)
|
82
|
+
jaro_winkler (1.5.3)
|
83
|
+
json (2.2.0)
|
84
|
+
loofah (2.2.3)
|
85
|
+
crass (~> 1.0.2)
|
86
|
+
nokogiri (>= 1.5.9)
|
87
|
+
mail (2.7.1)
|
88
|
+
mini_mime (>= 0.1.1)
|
89
|
+
marcel (0.3.3)
|
90
|
+
mimemagic (~> 0.3.2)
|
91
|
+
method_source (0.9.2)
|
92
|
+
mimemagic (0.3.3)
|
93
|
+
mini_mime (1.0.2)
|
94
|
+
mini_portile2 (2.4.0)
|
95
|
+
minitest (5.11.3)
|
96
|
+
nio4r (2.5.1)
|
97
|
+
nokogiri (1.10.4)
|
98
|
+
mini_portile2 (~> 2.4.0)
|
99
|
+
parallel (1.17.0)
|
100
|
+
parser (2.6.4.1)
|
101
|
+
ast (~> 2.4.0)
|
102
|
+
pry (0.12.2)
|
103
|
+
coderay (~> 1.1.0)
|
104
|
+
method_source (~> 0.9.0)
|
105
|
+
pry-byebug (3.7.0)
|
106
|
+
byebug (~> 11.0)
|
107
|
+
pry (~> 0.10)
|
108
|
+
rack (2.0.7)
|
109
|
+
rack-protection (2.0.7)
|
110
|
+
rack
|
111
|
+
rack-test (1.1.0)
|
112
|
+
rack (>= 1.0, < 3)
|
113
|
+
rails (6.0.0)
|
114
|
+
actioncable (= 6.0.0)
|
115
|
+
actionmailbox (= 6.0.0)
|
116
|
+
actionmailer (= 6.0.0)
|
117
|
+
actionpack (= 6.0.0)
|
118
|
+
actiontext (= 6.0.0)
|
119
|
+
actionview (= 6.0.0)
|
120
|
+
activejob (= 6.0.0)
|
121
|
+
activemodel (= 6.0.0)
|
122
|
+
activerecord (= 6.0.0)
|
123
|
+
activestorage (= 6.0.0)
|
124
|
+
activesupport (= 6.0.0)
|
125
|
+
bundler (>= 1.3.0)
|
126
|
+
railties (= 6.0.0)
|
127
|
+
sprockets-rails (>= 2.0.0)
|
128
|
+
rails-dom-testing (2.0.3)
|
129
|
+
activesupport (>= 4.2.0)
|
130
|
+
nokogiri (>= 1.6)
|
131
|
+
rails-html-sanitizer (1.2.0)
|
132
|
+
loofah (~> 2.2, >= 2.2.2)
|
133
|
+
railties (6.0.0)
|
134
|
+
actionpack (= 6.0.0)
|
135
|
+
activesupport (= 6.0.0)
|
136
|
+
method_source
|
137
|
+
rake (>= 0.8.7)
|
138
|
+
thor (>= 0.20.3, < 2.0)
|
139
|
+
rainbow (3.0.0)
|
140
|
+
rake (12.3.3)
|
141
|
+
redis (4.1.2)
|
142
|
+
redis-namespace (1.6.0)
|
143
|
+
redis (>= 3.0.4)
|
144
|
+
rubocop (0.72.0)
|
145
|
+
jaro_winkler (~> 1.5.1)
|
146
|
+
parallel (~> 1.10)
|
147
|
+
parser (>= 2.6)
|
148
|
+
rainbow (>= 2.2.2, < 4.0)
|
149
|
+
ruby-progressbar (~> 1.7)
|
150
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
151
|
+
rubocop-performance (1.4.1)
|
152
|
+
rubocop (>= 0.71.0)
|
153
|
+
ruby-progressbar (1.10.1)
|
154
|
+
simplecov (0.17.0)
|
155
|
+
docile (~> 1.1)
|
156
|
+
json (>= 1.8, < 3)
|
157
|
+
simplecov-html (~> 0.10.0)
|
158
|
+
simplecov-html (0.10.2)
|
159
|
+
sprockets (3.7.2)
|
160
|
+
concurrent-ruby (~> 1.0)
|
161
|
+
rack (> 1, < 3)
|
162
|
+
sprockets-rails (3.2.1)
|
163
|
+
actionpack (>= 4.0)
|
164
|
+
activesupport (>= 4.0)
|
165
|
+
sprockets (>= 3.0.0)
|
166
|
+
sqlite3 (1.4.1)
|
167
|
+
standard (0.1.4)
|
168
|
+
rubocop (~> 0.72.0)
|
169
|
+
rubocop-performance (~> 1.4.0)
|
170
|
+
thor (0.20.3)
|
171
|
+
thread_safe (0.3.6)
|
172
|
+
toxiproxy (1.0.3)
|
173
|
+
tzinfo (1.2.5)
|
174
|
+
thread_safe (~> 0.1)
|
175
|
+
unicode-display_width (1.6.0)
|
176
|
+
websocket-driver (0.7.1)
|
177
|
+
websocket-extensions (>= 0.1.0)
|
178
|
+
websocket-extensions (0.1.4)
|
179
|
+
zeitwerk (2.1.9)
|
180
|
+
|
181
|
+
PLATFORMS
|
182
|
+
ruby
|
183
|
+
|
184
|
+
DEPENDENCIES
|
185
|
+
activerecord-jdbcsqlite3-adapter
|
186
|
+
hiredis
|
187
|
+
minitest
|
188
|
+
pry-byebug
|
189
|
+
rails
|
190
|
+
rake
|
191
|
+
redis-namespace
|
192
|
+
sidekiq!
|
193
|
+
simplecov
|
194
|
+
sqlite3
|
195
|
+
standard
|
196
|
+
toxiproxy
|
data/Pro-5.0-Upgrade.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Welcome to Sidekiq Pro 5.0!
|
2
|
+
|
3
|
+
Sidekiq Pro 5.0 is mainly a cleanup release for Sidekiq 6.0. The
|
4
|
+
migration should be as close to trivial as a major version bump can be.
|
5
|
+
Note that Sidekiq 6.0 does have major breaking changes.
|
6
|
+
|
7
|
+
## What's New
|
8
|
+
|
9
|
+
* New localizations for the Sidekiq Pro Web UI: ES, ZH, PT, JA, RU
|
10
|
+
* Removed deprecated APIs and warnings.
|
11
|
+
* Various changes for Sidekiq 6.0
|
12
|
+
* Requires Ruby 2.5+ and Redis 4.0+
|
13
|
+
* Requires Sidekiq 6.0+.
|
14
|
+
|
15
|
+
## Upgrade
|
16
|
+
|
17
|
+
* Upgrade to the latest Sidekiq Pro 4.x.
|
18
|
+
```ruby
|
19
|
+
gem 'sidekiq-pro', '< 5'
|
20
|
+
```
|
21
|
+
* Fix any deprecation warnings you see.
|
22
|
+
* Upgrade to 5.x.
|
23
|
+
```ruby
|
24
|
+
gem 'sidekiq-pro', '< 6'
|
25
|
+
```
|
data/Pro-Changes.md
CHANGED
@@ -4,11 +4,35 @@
|
|
4
4
|
|
5
5
|
Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
|
6
6
|
|
7
|
-
|
7
|
+
5.0.1
|
8
8
|
---------
|
9
9
|
|
10
|
+
- Rejigger batch failures UI to add direct links to retries and scheduled jobs [#4209]
|
11
|
+
- Delete batch data with `UNLINK` [#4155]
|
12
|
+
- Fix bug where a scheduled job can lose its scheduled time when using reliable push [#4267]
|
13
|
+
- Sidekiq::JobSet#scan and #find_job APIs have been promoted to Sidekiq OSS. [#4259]
|
14
|
+
|
15
|
+
5.0.0
|
16
|
+
---------
|
17
|
+
|
18
|
+
- There is no significant migration from Sidekiq Pro 4.0 to 5.0
|
19
|
+
but make sure you read the [update notes for Sidekiq
|
20
|
+
6.0](https://github.com/mperham/sidekiq/blob/master/6.0-Upgrade.md).
|
21
|
+
- Removed various deprecated APIs and associated warnings.
|
22
|
+
- **BREAKING CHANGE** Remove the `Sidekiq::Batch::Status#dead_jobs` API in favor of
|
23
|
+
`Sidekiq::Batch::Status#dead_jids`. [#4217]
|
24
|
+
- Update Sidekiq Pro codebase to use StandardRB formatting
|
25
|
+
- Fix lingering "b-XXX-died" elements in Redis which could cause
|
26
|
+
excessive memory usage. [#4217]
|
27
|
+
- Add ES translations, see issues [#3949](https://github.com/mperham/sidekiq/issues/3949) and [#3951](https://github.com/mperham/sidekiq/issues/3951) to add your own language.
|
28
|
+
|
29
|
+
4.0.5
|
30
|
+
---------
|
31
|
+
|
32
|
+
- Increase super\_fetch retriever thread count from 1 to 2 to make it
|
33
|
+
less sensitive to Redis latency.
|
10
34
|
- Better handling of invalid job JSON by reliable scheduler [#4053]
|
11
|
-
- Added ZH, PT, JA and RU translations
|
35
|
+
- Added ZH, PT, JA and RU translations.
|
12
36
|
|
13
37
|
4.0.4
|
14
38
|
---------
|
data/README.md
CHANGED
@@ -3,7 +3,8 @@ Sidekiq
|
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/mperham/sidekiq.svg)](https://codeclimate.com/github/mperham/sidekiq)
|
6
|
-
[![
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/mperham/sidekiq/badges/coverage.svg)](https://codeclimate.com/github/mperham/sidekiq/coverage)
|
7
|
+
[![Build Status](https://circleci.com/gh/mperham/sidekiq/tree/master.svg?style=svg)](https://circleci.com/gh/mperham/sidekiq/tree/master)
|
7
8
|
[![Gitter Chat](https://badges.gitter.im/mperham/sidekiq.svg)](https://gitter.im/mperham/sidekiq)
|
8
9
|
|
9
10
|
|
@@ -13,32 +14,27 @@ Sidekiq uses threads to handle many jobs at the same time in the
|
|
13
14
|
same process. It does not require Rails but will integrate tightly with
|
14
15
|
Rails to make background processing dead simple.
|
15
16
|
|
16
|
-
Sidekiq is compatible with Resque. It uses the exact same
|
17
|
-
message format as Resque so it can integrate into an existing Resque processing farm.
|
18
|
-
You can have Sidekiq and Resque run side-by-side at the same time and
|
19
|
-
use the Resque client to enqueue jobs in Redis to be processed by Sidekiq.
|
20
|
-
|
21
17
|
Performance
|
22
18
|
---------------
|
23
19
|
|
24
|
-
Version | Latency | Garbage created for
|
25
|
-
|
26
|
-
Sidekiq
|
27
|
-
Sidekiq
|
28
|
-
|
29
|
-
|
20
|
+
Version | Latency | Garbage created for 10k jobs | Time to process 100k jobs | Throughput | Ruby
|
21
|
+
-----------------|------|---------|---------|------------------------|-----
|
22
|
+
Sidekiq 6.0.2 | 3 ms | 156 MB | 14.0 sec| **7100 jobs/sec** | MRI 2.6.3
|
23
|
+
Sidekiq 6.0.0 | 3 ms | 156 MB | 19 sec | 5200 jobs/sec | MRI 2.6.3
|
24
|
+
Sidekiq 4.0.0 | 10 ms | 151 MB | 22 sec | 4500 jobs/sec |
|
25
|
+
Sidekiq 3.5.1 | 22 ms | 1257 MB | 125 sec | 800 jobs/sec |
|
26
|
+
Resque 1.25.2 | - | - | 420 sec | 240 jobs/sec |
|
27
|
+
DelayedJob 4.1.1 | - | - | 465 sec | 215 jobs/sec |
|
30
28
|
|
31
|
-
|
29
|
+
This benchmark can be found in `bin/sidekiqload` and assumes a Redis network latency of 1ms.
|
32
30
|
|
33
31
|
Requirements
|
34
32
|
-----------------
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
All Rails releases >= 4.0 are officially supported.
|
34
|
+
- Redis: 4.0+
|
35
|
+
- Ruby: MRI 2.5+ or JRuby 9.2+.
|
39
36
|
|
40
|
-
|
41
|
-
installations with thousands of worker threads.
|
37
|
+
Sidekiq 6.0 supports Rails 5.0+ but does not require it.
|
42
38
|
|
43
39
|
|
44
40
|
Installation
|
@@ -63,7 +59,7 @@ Want to Upgrade?
|
|
63
59
|
I also sell Sidekiq Pro and Sidekiq Enterprise, extensions to Sidekiq which provide more
|
64
60
|
features, a commercial-friendly license and allow you to support high
|
65
61
|
quality open source development all at the same time. Please see the
|
66
|
-
[Sidekiq](
|
62
|
+
[Sidekiq](https://sidekiq.org/) homepage for more detail.
|
67
63
|
|
68
64
|
Subscribe to the **[quarterly newsletter](https://tinyletter.com/sidekiq)** to stay informed about the latest
|
69
65
|
features and changes to Sidekiq and its bigger siblings.
|
@@ -77,24 +73,16 @@ Problems?
|
|
77
73
|
If you have a problem, please review the [FAQ](https://github.com/mperham/sidekiq/wiki/FAQ) and [Troubleshooting](https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting) wiki pages.
|
78
74
|
Searching the [issues](https://github.com/mperham/sidekiq/issues) for your problem is also a good idea.
|
79
75
|
|
80
|
-
Sidekiq Pro and Sidekiq Enterprise customers get private email support. You can purchase at
|
76
|
+
Sidekiq Pro and Sidekiq Enterprise customers get private email support. You can purchase at https://sidekiq.org; email support@contribsys.com for help.
|
81
77
|
|
82
78
|
Useful resources:
|
83
79
|
|
84
80
|
* Product documentation is in the [wiki](https://github.com/mperham/sidekiq/wiki).
|
85
|
-
*
|
81
|
+
* Occasional announcements are made to the [@sidekiq](https://twitter.com/sidekiq) Twitter account.
|
86
82
|
* The [Sidekiq tag](https://stackoverflow.com/questions/tagged/sidekiq) on Stack Overflow has lots of useful Q & A.
|
87
83
|
|
88
|
-
**No support via Twitter**
|
89
|
-
|
90
84
|
Every Friday morning is Sidekiq happy hour: I video chat and answer questions.
|
91
|
-
See the [Sidekiq support page](
|
92
|
-
|
93
|
-
Thanks
|
94
|
-
-----------------
|
95
|
-
|
96
|
-
Sidekiq stays fast by using the [JProfiler java profiler](http://www.ej-technologies.com/products/jprofiler/overview.html) to find and fix
|
97
|
-
performance problems on JRuby. Unfortunately MRI does not have good multithreaded profiling tools.
|
85
|
+
See the [Sidekiq support page](https://sidekiq.org/support.html) for details.
|
98
86
|
|
99
87
|
|
100
88
|
License
|
@@ -106,4 +94,4 @@ Please see [LICENSE](https://github.com/mperham/sidekiq/blob/master/LICENSE) for
|
|
106
94
|
Author
|
107
95
|
-----------------
|
108
96
|
|
109
|
-
Mike Perham, [@mperham](https://
|
97
|
+
Mike Perham, [@mperham@mastodon.xyz](https://mastodon.xyz/@mperham) / [@sidekiq](https://twitter.com/sidekiq), [https://www.mikeperham.com](https://www.mikeperham.com) / [https://www.contribsys.com](https://www.contribsys.com)
|
data/Rakefile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
require "standard/rake"
|
3
4
|
|
4
5
|
Rake::TestTask.new(:test) do |test|
|
5
6
|
test.warning = true
|
6
|
-
test.pattern =
|
7
|
+
test.pattern = "test/**/test_*.rb"
|
7
8
|
end
|
8
9
|
|
9
|
-
task default: :test
|
10
|
+
task default: [:standard, :test]
|
data/bin/sidekiqload
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
$TESTING = false
|
6
6
|
|
7
7
|
#require 'ruby-prof'
|
8
|
-
|
8
|
+
require 'bundler/setup'
|
9
|
+
Bundler.require(:default, :load_test)
|
9
10
|
|
10
11
|
require_relative '../lib/sidekiq/cli'
|
11
12
|
require_relative '../lib/sidekiq/launcher'
|
@@ -13,8 +14,8 @@ require_relative '../lib/sidekiq/launcher'
|
|
13
14
|
include Sidekiq::Util
|
14
15
|
|
15
16
|
Sidekiq.configure_server do |config|
|
16
|
-
|
17
|
-
config.redis = { db: 13 }
|
17
|
+
config.options[:concurrency] = 10
|
18
|
+
config.redis = { db: 13, port: 6380, driver: :hiredis }
|
18
19
|
config.options[:queues] << 'default'
|
19
20
|
config.logger.level = Logger::ERROR
|
20
21
|
config.average_scheduled_poll_interval = 2
|
@@ -28,7 +29,8 @@ class LoadWorker
|
|
28
29
|
1
|
29
30
|
end
|
30
31
|
|
31
|
-
def perform(idx)
|
32
|
+
def perform(idx, ts=nil)
|
33
|
+
puts(Time.now.to_f - ts) if ts != nil
|
32
34
|
#raise idx.to_s if idx % 100 == 1
|
33
35
|
end
|
34
36
|
end
|
@@ -36,14 +38,15 @@ end
|
|
36
38
|
# brew tap shopify/shopify
|
37
39
|
# brew install toxiproxy
|
38
40
|
# gem install toxiproxy
|
39
|
-
#
|
41
|
+
# run `toxiproxy-server` in a separate terminal window.
|
42
|
+
require 'toxiproxy'
|
40
43
|
# simulate a non-localhost network for realer-world conditions.
|
41
44
|
# adding 1ms of network latency has an ENORMOUS impact on benchmarks
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
Toxiproxy.populate([{
|
46
|
+
"name": "redis",
|
47
|
+
"listen": "127.0.0.1:6380",
|
48
|
+
"upstream": "127.0.0.1:6379"
|
49
|
+
}])
|
47
50
|
|
48
51
|
self_read, self_write = IO.pipe
|
49
52
|
%w(INT TERM TSTP TTIN).each do |sig|
|
@@ -65,7 +68,7 @@ def handle_signal(launcher, sig)
|
|
65
68
|
# http://jira.codehaus.org/browse/JRUBY-4637
|
66
69
|
raise Interrupt
|
67
70
|
when 'TERM'
|
68
|
-
# Heroku sends TERM and then waits
|
71
|
+
# Heroku sends TERM and then waits 30 seconds for process to exit.
|
69
72
|
raise Interrupt
|
70
73
|
when 'TSTP'
|
71
74
|
Sidekiq.logger.info "Received TSTP, no longer accepting new work"
|
@@ -100,21 +103,26 @@ iter.times do
|
|
100
103
|
end
|
101
104
|
Sidekiq.logger.error "Created #{count*iter} jobs"
|
102
105
|
|
106
|
+
start = Time.now
|
107
|
+
|
103
108
|
Monitoring = Thread.new do
|
104
109
|
watchdog("monitor thread") do
|
105
110
|
while true
|
106
|
-
sleep
|
107
|
-
qsize
|
108
|
-
conn.
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
end.map(&:to_i)
|
113
|
-
total = qsize + retries
|
114
|
-
#GC.start
|
115
|
-
Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
|
111
|
+
sleep 0.2
|
112
|
+
qsize = Sidekiq.redis do |conn|
|
113
|
+
conn.llen "queue:default"
|
114
|
+
end
|
115
|
+
total = qsize
|
116
|
+
#Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
|
116
117
|
if total == 0
|
117
|
-
Sidekiq.logger.error("Done")
|
118
|
+
Sidekiq.logger.error("Done, #{iter * count} jobs in #{Time.now - start} sec")
|
119
|
+
Sidekiq.logger.error("Now here's the latency for three jobs")
|
120
|
+
|
121
|
+
LoadWorker.perform_async(1, Time.now.to_f)
|
122
|
+
LoadWorker.perform_async(2, Time.now.to_f)
|
123
|
+
LoadWorker.perform_async(3, Time.now.to_f)
|
124
|
+
|
125
|
+
sleep 0.2
|
118
126
|
exit(0)
|
119
127
|
end
|
120
128
|
end
|
@@ -125,8 +133,8 @@ begin
|
|
125
133
|
#RubyProf::exclude_threads = [ Monitoring ]
|
126
134
|
#RubyProf.start
|
127
135
|
fire_event(:startup)
|
128
|
-
|
129
|
-
|
136
|
+
Sidekiq.logger.error "Simulating 1ms of latency between Sidekiq and redis"
|
137
|
+
Toxiproxy[:redis].downstream(:latency, latency: 1).apply do
|
130
138
|
launcher = Sidekiq::Launcher.new(Sidekiq.options)
|
131
139
|
launcher.run
|
132
140
|
|
@@ -134,7 +142,7 @@ begin
|
|
134
142
|
signal = readable_io.first[0].gets.strip
|
135
143
|
handle_signal(launcher, signal)
|
136
144
|
end
|
137
|
-
|
145
|
+
end
|
138
146
|
rescue SystemExit => e
|
139
147
|
#Sidekiq.logger.error("Profiling...")
|
140
148
|
#result = RubyProf.stop
|
data/bin/sidekiqmon
ADDED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
<% module_namespacing do -%>
|
3
|
-
class <%= class_name %>WorkerTest <
|
3
|
+
class <%= class_name %>WorkerTest < Minitest::Test
|
4
4
|
def test_example
|
5
5
|
skip "add some examples to (or delete) #{__FILE__}"
|
6
6
|
end
|
@@ -1,21 +1,23 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/named_base"
|
2
2
|
|
3
3
|
module Sidekiq
|
4
4
|
module Generators # :nodoc:
|
5
5
|
class WorkerGenerator < ::Rails::Generators::NamedBase # :nodoc:
|
6
|
-
desc
|
6
|
+
desc "This generator creates a Sidekiq Worker in app/workers and a corresponding test"
|
7
7
|
|
8
|
-
check_class_collision suffix:
|
8
|
+
check_class_collision suffix: "Worker"
|
9
9
|
|
10
10
|
def self.default_generator_root
|
11
11
|
File.dirname(__FILE__)
|
12
12
|
end
|
13
13
|
|
14
14
|
def create_worker_file
|
15
|
-
template
|
15
|
+
template "worker.rb.erb", File.join("app/workers", class_path, "#{file_name}_worker.rb")
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_test_file
|
19
|
+
return unless test_framework
|
20
|
+
|
19
21
|
if defined?(RSpec)
|
20
22
|
create_worker_spec
|
21
23
|
else
|
@@ -27,23 +29,29 @@ module Sidekiq
|
|
27
29
|
|
28
30
|
def create_worker_spec
|
29
31
|
template_file = File.join(
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
"spec/workers",
|
33
|
+
class_path,
|
34
|
+
"#{file_name}_worker_spec.rb"
|
33
35
|
)
|
34
|
-
template
|
36
|
+
template "worker_spec.rb.erb", template_file
|
35
37
|
end
|
36
38
|
|
37
39
|
def create_worker_test
|
38
40
|
template_file = File.join(
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
"test/workers",
|
42
|
+
class_path,
|
43
|
+
"#{file_name}_worker_test.rb"
|
42
44
|
)
|
43
|
-
template
|
45
|
+
template "worker_test.rb.erb", template_file
|
44
46
|
end
|
45
47
|
|
48
|
+
def file_name
|
49
|
+
@_file_name ||= super.sub(/_?worker\z/i, "")
|
50
|
+
end
|
46
51
|
|
52
|
+
def test_framework
|
53
|
+
::Rails.application.config.generators.options[:rails][:test_framework]
|
54
|
+
end
|
47
55
|
end
|
48
56
|
end
|
49
57
|
end
|