tunemygc 1.0.42 → 1.0.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/Gemfile.lock +1 -1
- data/lib/tunemygc/syncer.rb +38 -33
- data/lib/tunemygc/version.rb +1 -1
- data/test/test_syncer.rb +6 -6
- data/tunemygc.gemspec +0 -20
- metadata +3 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f66238f6398dc9b02f0f12ba5ab8a38196167cf1
|
4
|
+
data.tar.gz: 8777657a4b0c208f8d7a863bec45644eab0ba4d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 186f1b4955e0c59a2f7e265a18094a548e0cfde95800c2bc8c7e9e3b7069846c539c23a9364e70031fa085ece2e5363c6c4bf7f701b82f7dd9e61ae615dc7194
|
7
|
+
data.tar.gz: b2a9349344ece06752c89c637dcf88a72b91db5525e3a2fe46bb7205bdb6ff605b0fff2e8f02b8100d4d09e290783029d96a760d6b30b19fa01642a3902033ba
|
data/.travis.yml
CHANGED
@@ -6,16 +6,15 @@ rvm:
|
|
6
6
|
- 2.1.2
|
7
7
|
- 2.1.5
|
8
8
|
- 2.2.0
|
9
|
+
- 2.2.1
|
9
10
|
- ruby-head
|
10
11
|
script: "bundle exec rake"
|
11
|
-
env: RUBY_GC_TUNE=
|
12
|
+
env: RUBY_GC_TUNE=200 RUBY_GC_TUNE_DEBUG=1 RUBY_GC_SYNC_ALWAYS=1
|
12
13
|
gemfile:
|
13
14
|
- Gemfile
|
14
15
|
notifications:
|
15
16
|
recipients:
|
16
|
-
-
|
17
|
+
- info@bearmetal.eu
|
17
18
|
branches:
|
18
19
|
only:
|
19
20
|
- master
|
20
|
-
- compact-samples
|
21
|
-
- minitest
|
data/Gemfile.lock
CHANGED
data/lib/tunemygc/syncer.rb
CHANGED
@@ -14,16 +14,41 @@ module TuneMyGc
|
|
14
14
|
|
15
15
|
def sync(snapshotter)
|
16
16
|
if sync_required?(snapshotter)
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
snapshots = snapshotter.size
|
18
|
+
TuneMyGc.log "Syncing #{snapshots} snapshots"
|
19
|
+
payload = [environment(snapshotter)]
|
20
|
+
debug = ENV["RUBY_GC_TUNE_DEBUG"]
|
21
|
+
TuneMyGc.log "=== Snapshots ===" if debug
|
22
|
+
while !snapshotter.empty?
|
23
|
+
snapshot = snapshotter.deq
|
24
|
+
TuneMyGc.log(snapshot) if debug
|
25
|
+
payload << snapshot
|
26
|
+
end
|
27
|
+
data = ActiveSupport::JSON.encode(payload)
|
28
|
+
begin
|
29
|
+
3.times do |retries|
|
30
|
+
Timeout.timeout(NETWORK_TIMEOUT + 1) do
|
31
|
+
response = sync_with_tuner(data, snapshots)
|
32
|
+
if response
|
33
|
+
if response == :retryable
|
34
|
+
TuneMyGc.log "Retrying in #{retries} seconds ..."
|
35
|
+
sleep(retries)
|
36
|
+
else
|
37
|
+
process_config_callback(response)
|
38
|
+
break
|
39
|
+
end
|
40
|
+
else
|
41
|
+
break
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
true
|
46
|
+
ensure
|
47
|
+
payload.clear
|
20
48
|
end
|
21
|
-
timeout do
|
22
|
-
process_config_callback(response)
|
23
|
-
end if response
|
24
49
|
else
|
25
50
|
TuneMyGc.log "Nothing to sync, discarding #{snapshotter.size} snapshots"
|
26
|
-
|
51
|
+
false
|
27
52
|
end
|
28
53
|
end
|
29
54
|
|
@@ -37,26 +62,8 @@ module TuneMyGc
|
|
37
62
|
end
|
38
63
|
|
39
64
|
private
|
40
|
-
def
|
41
|
-
Timeout.timeout(NETWORK_TIMEOUT + 1){ block.call }
|
42
|
-
end
|
43
|
-
|
44
|
-
def sync_with_tuner(snapshotter)
|
45
|
-
snapshots = 0
|
46
|
-
# Fallback to Timeout if Net::HTTP read timeout fails
|
47
|
-
snapshots = snapshotter.size
|
48
|
-
TuneMyGc.log "Syncing #{snapshots} snapshots"
|
49
|
-
payload = [environment(snapshotter)]
|
50
|
-
debug = ENV["RUBY_GC_TUNE_DEBUG"]
|
51
|
-
TuneMyGc.log "=== Snapshots ===" if debug
|
52
|
-
while !snapshotter.empty?
|
53
|
-
snapshot = snapshotter.deq
|
54
|
-
TuneMyGc.log(snapshot) if debug
|
55
|
-
payload << snapshot
|
56
|
-
end
|
57
|
-
data = ActiveSupport::JSON.encode(payload)
|
65
|
+
def sync_with_tuner(data, snapshots)
|
58
66
|
response = client.post('/ruby', data, TuneMyGc::HEADERS)
|
59
|
-
snapshotter.unit_of_work = false
|
60
67
|
if Net::HTTPNotFound === response
|
61
68
|
TuneMyGc.log "Invalid application token. Please generate one with 'bundle exec tunemygc <a_valid_email_address>' and set the RUBY_GC_TOKEN environment variable"
|
62
69
|
return false
|
@@ -73,20 +80,18 @@ module TuneMyGc
|
|
73
80
|
TuneMyGc.log "Invalid payload (#{response.body}). Failed to sync #{snapshots} snapshots"
|
74
81
|
return false
|
75
82
|
elsif Net::HTTPInternalServerError === response
|
76
|
-
TuneMyGc.log "An internal error occurred (#{response.body}). Failed to sync #{snapshots} snapshots"
|
77
|
-
return
|
83
|
+
TuneMyGc.log "An internal error occurred (#{response.body}). Failed to sync #{snapshots} snapshots."
|
84
|
+
return :retryable
|
78
85
|
elsif Net::HTTPSuccess === response
|
79
86
|
response
|
80
87
|
else
|
81
88
|
TuneMyGc.log "Unknown error: #{response.body}"
|
82
89
|
return false
|
83
90
|
end
|
84
|
-
rescue
|
91
|
+
rescue Timeout::Error, Errno::ETIMEDOUT, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED,
|
92
|
+
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, IOError => e
|
85
93
|
TuneMyGc.log "Failed to sync #{snapshots} snapshots (error: #{e})"
|
86
|
-
return
|
87
|
-
ensure
|
88
|
-
# Prefer to loose data points than accumulate buffers indefinitely on error or other conditions
|
89
|
-
snapshotter.clear
|
94
|
+
return :retryable
|
90
95
|
end
|
91
96
|
|
92
97
|
def process_config_callback(response)
|
data/lib/tunemygc/version.rb
CHANGED
data/test/test_syncer.rb
CHANGED
@@ -46,7 +46,7 @@ class TestSyncer < TuneMyGcTestCase
|
|
46
46
|
|
47
47
|
out, err = capture_io do
|
48
48
|
TuneMyGc.logger = Logger.new($stdout)
|
49
|
-
|
49
|
+
assert syncer.sync(snapshots)
|
50
50
|
end
|
51
51
|
assert_match(/Ruby version/, out)
|
52
52
|
assert_match(/Rails version/, out)
|
@@ -65,7 +65,7 @@ class TestSyncer < TuneMyGcTestCase
|
|
65
65
|
|
66
66
|
out, err = capture_io do
|
67
67
|
TuneMyGc.logger = Logger.new($stdout)
|
68
|
-
|
68
|
+
assert syncer.sync(snapshots)
|
69
69
|
end
|
70
70
|
assert_match(/The GC is already tuned by environment variables/, out)
|
71
71
|
assert_match(/Failed to sync 1 snapshots/, out)
|
@@ -82,7 +82,7 @@ class TestSyncer < TuneMyGcTestCase
|
|
82
82
|
|
83
83
|
out, err = capture_io do
|
84
84
|
TuneMyGc.logger = Logger.new($stdout)
|
85
|
-
|
85
|
+
assert syncer.sync(snapshots)
|
86
86
|
end
|
87
87
|
assert_match(/Invalid payload/, out)
|
88
88
|
assert_match(/snapshot timestamp/, out)
|
@@ -100,7 +100,7 @@ class TestSyncer < TuneMyGcTestCase
|
|
100
100
|
|
101
101
|
out, err = capture_io do
|
102
102
|
TuneMyGc.logger = Logger.new($stdout)
|
103
|
-
|
103
|
+
assert syncer.sync(snapshots)
|
104
104
|
end
|
105
105
|
assert_match(/Invalid application token/, out)
|
106
106
|
end
|
@@ -116,7 +116,7 @@ class TestSyncer < TuneMyGcTestCase
|
|
116
116
|
|
117
117
|
out, err = capture_io do
|
118
118
|
TuneMyGc.logger = Logger.new($stdout)
|
119
|
-
|
119
|
+
assert syncer.sync(snapshots)
|
120
120
|
end
|
121
121
|
assert_match(/Agent version 2 required/, out)
|
122
122
|
assert_match(/Failed to sync 1 snapshots/, out)
|
@@ -132,7 +132,7 @@ class TestSyncer < TuneMyGcTestCase
|
|
132
132
|
|
133
133
|
out, err = capture_io do
|
134
134
|
TuneMyGc.logger = Logger.new($stdout)
|
135
|
-
|
135
|
+
assert syncer.sync(snapshots)
|
136
136
|
end
|
137
137
|
assert_match(/Failed to sync 1 snapshots/, out)
|
138
138
|
assert_match(/dang/, out)
|
data/tunemygc.gemspec
CHANGED
@@ -21,26 +21,6 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.test_files = `git ls-files test`.split($/)
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
s.required_ruby_version = '>= 2.1.0'
|
24
|
-
s.post_install_message = <<-eos
|
25
|
-
[TuneMyGC] Getting started:
|
26
|
-
|
27
|
-
Run this setup command from your application root to register your application with the `https://tunemygc.com` service:
|
28
|
-
|
29
|
-
$ bundle exec tunemygc -r your@email.address
|
30
|
-
|
31
|
-
You should get back a token reference to identify this Rails app:
|
32
|
-
|
33
|
-
Application registered. Use RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d32 in your environment.
|
34
|
-
|
35
|
-
Then sample your Rails app for tuning:
|
36
|
-
|
37
|
-
$ RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d32 RUBY_GC_TUNE=200 bundle exec rails s
|
38
|
-
|
39
|
-
We require a valid email address as a canonical reference for tuner tokens for your applications.
|
40
|
-
|
41
|
-
Happy hacking,
|
42
|
-
- the Bear Metal cubs
|
43
|
-
eos
|
44
24
|
|
45
25
|
s.add_development_dependency('activesupport', '~> 4.1')
|
46
26
|
s.add_development_dependency('rake', '~> 10.3')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tunemygc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bear Metal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -148,25 +148,7 @@ homepage: https://tunemygc.com
|
|
148
148
|
licenses:
|
149
149
|
- MIT
|
150
150
|
metadata: {}
|
151
|
-
post_install_message:
|
152
|
-
[TuneMyGC] Getting started:
|
153
|
-
|
154
|
-
Run this setup command from your application root to register your application with the `https://tunemygc.com` service:
|
155
|
-
|
156
|
-
$ bundle exec tunemygc -r your@email.address
|
157
|
-
|
158
|
-
You should get back a token reference to identify this Rails app:
|
159
|
-
|
160
|
-
Application registered. Use RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d32 in your environment.
|
161
|
-
|
162
|
-
Then sample your Rails app for tuning:
|
163
|
-
|
164
|
-
$ RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d32 RUBY_GC_TUNE=200 bundle exec rails s
|
165
|
-
|
166
|
-
We require a valid email address as a canonical reference for tuner tokens for your applications.
|
167
|
-
|
168
|
-
Happy hacking,
|
169
|
-
- the Bear Metal cubs
|
151
|
+
post_install_message:
|
170
152
|
rdoc_options: []
|
171
153
|
require_paths:
|
172
154
|
- lib
|