alicorn 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/alicorn.gemspec +2 -2
- data/lib/alicorn/scaler.rb +2 -2
- data/lib/alicorn/version.rb +1 -1
- data/test/test_scaler.rb +11 -0
- metadata +17 -17
data/alicorn.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "alicorn"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Somers"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-23"
|
13
13
|
s.description = "Highly configurable dumb auto-scaler for managing unicorn web servers"
|
14
14
|
s.email = "somers.ben@gmail.com"
|
15
15
|
s.executables = ["alicorn", "alicorn_profiler"]
|
data/lib/alicorn/scaler.rb
CHANGED
@@ -19,7 +19,7 @@ module Alicorn
|
|
19
19
|
@sample_count = options[:sample_count] || 30
|
20
20
|
@app_name = options[:app_name] || "unicorn"
|
21
21
|
@dry_run = options[:dry_run]
|
22
|
-
@signal_delay =
|
22
|
+
@signal_delay = 0.5
|
23
23
|
log_path = options[:log_path] || "/dev/null"
|
24
24
|
|
25
25
|
self.logger = Logger.new(log_path)
|
@@ -59,7 +59,7 @@ module Alicorn
|
|
59
59
|
target = target.ceil
|
60
60
|
|
61
61
|
logger.debug "target calculated at: #{target}, worker count at #{worker_count}"
|
62
|
-
if target
|
62
|
+
if worker_count == max_workers and target == max_workers
|
63
63
|
logger.warn "at maximum capacity! cannot scale up"
|
64
64
|
return nil, 0
|
65
65
|
elsif connections.avg > worker_count and data[:queued].avg > 1
|
data/lib/alicorn/version.rb
CHANGED
data/test/test_scaler.rb
CHANGED
@@ -173,6 +173,17 @@ class TestScaler < Test::Unit::TestCase
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
+
context "when we really, really need to panic" do
|
177
|
+
setup do
|
178
|
+
@data[:queued] << 20
|
179
|
+
@data[:active] << 20
|
180
|
+
end
|
181
|
+
|
182
|
+
should "return TTIN to jump straight to max_workers" do
|
183
|
+
assert_equal ["TTIN", 15], @scaler.auto_scale(@data, @worker_count)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
176
187
|
context "when we don't need to scale at all" do
|
177
188
|
setup do
|
178
189
|
@data[:active] << 6
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: curb
|
16
|
-
requirement: &
|
16
|
+
requirement: &70188874602160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70188874602160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &70188874601680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.0.1
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70188874601680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70188874601200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.12'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70188874601200
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70188874600720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70188874600720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70188874600240 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.8.3
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70188874600240
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mocha
|
71
|
-
requirement: &
|
71
|
+
requirement: &70188874599720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.11.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70188874599720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov
|
82
|
-
requirement: &
|
82
|
+
requirement: &70188874599220 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 0.6.4
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70188874599220
|
91
91
|
description: Highly configurable dumb auto-scaler for managing unicorn web servers
|
92
92
|
email: somers.ben@gmail.com
|
93
93
|
executables:
|
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash: -
|
136
|
+
hash: -3962588628776347487
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|