alicorn 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/alicorn.gemspec +2 -2
- data/lib/alicorn/log_parser.rb +5 -5
- data/lib/alicorn/scaler.rb +2 -1
- metadata +13 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
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.0.
|
8
|
+
s.version = "0.0.6"
|
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-16"
|
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/log_parser.rb
CHANGED
@@ -10,21 +10,21 @@ module Alicorn
|
|
10
10
|
def parse
|
11
11
|
f = File.open(filename)
|
12
12
|
f.each do |line|
|
13
|
-
if line.match(
|
13
|
+
if line.match(/"Sampling/)
|
14
14
|
@sample_hash = {} # this will reset every sample
|
15
|
-
elsif line.match(
|
15
|
+
elsif line.match(/"calling:\[(.+)\]"/)
|
16
16
|
data = $1.split(", ").map(&:to_i)
|
17
17
|
calling << data
|
18
18
|
@sample_hash[:calling] = data
|
19
|
-
elsif line.match(
|
19
|
+
elsif line.match(/"calling avg:([\d]+)"/)
|
20
20
|
data = $1.to_i
|
21
21
|
calling_avg << data
|
22
22
|
@sample_hash[:calling_avg] = data
|
23
|
-
elsif line.match(
|
23
|
+
elsif line.match(/"active:\[(.+)\]"/)
|
24
24
|
data = $1.split(", ").map(&:to_i)
|
25
25
|
active << data
|
26
26
|
@sample_hash[:active] = data
|
27
|
-
elsif line.match(
|
27
|
+
elsif line.match(/"active avg:([\d]+)"/)
|
28
28
|
data = $1.to_i
|
29
29
|
active_avg << data
|
30
30
|
@sample_hash[:active_avg] = data
|
data/lib/alicorn/scaler.rb
CHANGED
@@ -36,6 +36,7 @@ module Alicorn
|
|
36
36
|
protected
|
37
37
|
|
38
38
|
def auto_scale(data, worker_count)
|
39
|
+
return nil if data[:active].empty?
|
39
40
|
# Calculate target
|
40
41
|
target = data[:active].max * target_ratio + buffer
|
41
42
|
|
@@ -64,7 +65,7 @@ module Alicorn
|
|
64
65
|
private
|
65
66
|
|
66
67
|
def collect_data
|
67
|
-
logger.debug "Sampling #{sample_count} times
|
68
|
+
logger.debug "Sampling #{sample_count} times"
|
68
69
|
calling, writing, active, queued = DataSet.new, DataSet.new, DataSet.new, DataSet.new
|
69
70
|
sample_count.times do
|
70
71
|
raindrops = get_raindrops(raindrops_url)
|
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.0.
|
4
|
+
version: 0.0.6
|
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-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: curb
|
16
|
-
requirement: &
|
16
|
+
requirement: &70324496613000 !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: *70324496613000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &70324496612520 !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: *70324496612520
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70324496611760 !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: *70324496611760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70324496611060 !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: *70324496611060
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70324496610220 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 1.8.3
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70324496610220
|
69
69
|
description: Highly configurable dumb auto-scaler for managing unicorn web servers
|
70
70
|
email: somers.ben@gmail.com
|
71
71
|
executables:
|
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
segments:
|
109
109
|
- 0
|
110
|
-
hash:
|
110
|
+
hash: 4528028483231414856
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
113
113
|
requirements:
|