tunemygc 1.0.62 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tunemygc/interposer.rb +17 -0
- data/lib/tunemygc/network.rb +1 -0
- data/lib/tunemygc/spies/base.rb +1 -0
- data/lib/tunemygc/syncer.rb +3 -1
- data/lib/tunemygc/version.rb +1 -1
- data/test/test_kamikaze.rb +26 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f3cff9c60663d4fbf8c11bc5096958f142e054a
|
4
|
+
data.tar.gz: b01919539d52fe6aeee7ce2d27d39731e94d9499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00295573d71f3f0f67ca0169f260a917cf8fee2cf28e8a7f7b200f56568d9c81ded00c30a5c9ff6f8a32b9618ae7d4254da8fbd56f40abb92c734c2f745cf5c6
|
7
|
+
data.tar.gz: 1f14012d156fd467a0850391235de2e732766af61212375aca720b68f111d0a3e4102d9a53e9a3d04588d2058acbe40137931801647583950dbcf8da8f0e1850
|
data/lib/tunemygc/interposer.rb
CHANGED
@@ -61,6 +61,23 @@ module TuneMyGc
|
|
61
61
|
reset
|
62
62
|
end
|
63
63
|
|
64
|
+
def kamikaze
|
65
|
+
Thread.new do
|
66
|
+
TuneMyGc.snapshot(:TERMINATED, ObjectSpace.count_objects.merge(:memsize => ObjectSpace.memsize_of_all))
|
67
|
+
TuneMyGc.log "kamikaze: synching #{TuneMyGc.snapshotter.size} GC sample snapshots ahead of time (usually only on process exit)"
|
68
|
+
Timeout.timeout(TuneMyGC::KAMIZE_SYNC_TIMEOUT) do
|
69
|
+
begin
|
70
|
+
TuneMyGc.recommendations
|
71
|
+
reset
|
72
|
+
rescue Timeout::Error
|
73
|
+
# Discard the TERMINATED snapshot, retry in the at_exit block
|
74
|
+
TuneMyGc.snapshotter.deq
|
75
|
+
TuneMyGc.log "kamikaze: timeout syncing #{TuneMyGc.snapshotter.size} GC samples ahead of time"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
64
81
|
private
|
65
82
|
def reset
|
66
83
|
@installed = false
|
data/lib/tunemygc/network.rb
CHANGED
data/lib/tunemygc/spies/base.rb
CHANGED
data/lib/tunemygc/syncer.rb
CHANGED
@@ -48,7 +48,9 @@ module TuneMyGc
|
|
48
48
|
payload.clear
|
49
49
|
end
|
50
50
|
else
|
51
|
-
|
51
|
+
TunemMyGc.log "The TuneMyGC service requires an instrumented application to do at least one unit of work (an ActionController request / response cycle, processing a background job through ActiveJob etc.) in order to suggest a configuration."
|
52
|
+
TuneMyGc.log "During the last instrumented run, the agent observed #{snapshotter.size} GC events of interest, but none of them happened within the context of a unit of work and is thus not representative of your application's GC profile."
|
53
|
+
TuneMyGc.log "Therefore, we're discarding #{snapshotter.size} snapshots and will generate a configuration when there's more context available for the agent to get a representative sample size."
|
52
54
|
false
|
53
55
|
end
|
54
56
|
end
|
data/lib/tunemygc/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'helper')
|
4
|
+
|
5
|
+
class TestKamikaze < MiniTest::Unit::TestCase
|
6
|
+
def test_kamikaze
|
7
|
+
syncer = TuneMyGc::Syncer.new
|
8
|
+
snapshots = TuneMyGc::Snapshotter.new
|
9
|
+
snapshots.take_raw(Fixtures::STAGE_BOOTED)
|
10
|
+
|
11
|
+
stub_request(:get, "https://tunemygc.com/configs/xxxxxxx").
|
12
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
13
|
+
to_return(:status => 200, :body => ActiveSupport::JSON.encode({:Memory=>{:RUBY_GC_HEAP_INIT_SLOTS=>477268, :RUBY_GC_HEAP_FREE_SLOTS=>106607, :RUBY_GC_HEAP_GROWTH_FACTOR=>1.05, :RUBY_GC_HEAP_GROWTH_MAX_SLOTS=>10661, :RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=>1.05, :RUBY_GC_MALLOC_LIMIT=>2000000, :RUBY_GC_MALLOC_LIMIT_MAX=>4000000, :RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=>1.1, :RUBY_GC_OLDMALLOC_LIMIT=>2000000, :RUBY_GC_OLDMALLOC_LIMIT_MAX=>4000000, :RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=>1.05}, :Speed=>{:RUBY_GC_HEAP_INIT_SLOTS=>572722, :RUBY_GC_HEAP_FREE_SLOTS=>553800, :RUBY_GC_HEAP_GROWTH_FACTOR=>1.2, :RUBY_GC_HEAP_GROWTH_MAX_SLOTS=>83070, :RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=>2.0, :RUBY_GC_MALLOC_LIMIT=>64000000, :RUBY_GC_MALLOC_LIMIT_MAX=>128000000, :RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=>1.56, :RUBY_GC_OLDMALLOC_LIMIT=>64000000, :RUBY_GC_OLDMALLOC_LIMIT_MAX=>33554432, :RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=>1.32}}), :headers => {})
|
14
|
+
|
15
|
+
stub_request(:post, "https://tunemygc.com/ruby").
|
16
|
+
with(:body => "[#{ActiveSupport::JSON.encode(syncer.environment(snapshots))},[1420152606.1162581,\"BOOTED\",[32,950,1519,569,385225,2014,0,101119,950,0,2184137,1798912,9665288,16777216,26,6,5145,6032,230164,301030,11715304,24159190],{\"major_by\":null,\"gc_by\":\"newobj\",\"have_finalizer\":false,\"immediate_sweep\":false},null,70201748333020]]",
|
17
|
+
:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"TuneMyGC #{TuneMyGc::VERSION}"}).
|
18
|
+
to_return(:status => 200, :body => "https://www.tunemygc.com/configs/xxxxxxx", :headers => {})
|
19
|
+
out, err = capture_io do
|
20
|
+
TuneMyGc.logger = Logger.new($stdout)
|
21
|
+
TuneMyGc.interposer.kamikaze
|
22
|
+
end
|
23
|
+
sleep 1
|
24
|
+
assert_match(/kamikaze\: synching \d GC sample snapshots ahead of time \(usually only on process exit\)/, out)
|
25
|
+
end
|
26
|
+
end
|
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.63
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bear Metal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- test/test_active_job_interposer.rb
|
169
169
|
- test/test_agent.rb
|
170
170
|
- test/test_delayed_job_interposer.rb
|
171
|
+
- test/test_kamikaze.rb
|
171
172
|
- test/test_minitest_interposer.rb
|
172
173
|
- test/test_railtie.rb
|
173
174
|
- test/test_snapshotter.rb
|
@@ -205,6 +206,7 @@ test_files:
|
|
205
206
|
- test/test_active_job_interposer.rb
|
206
207
|
- test/test_agent.rb
|
207
208
|
- test/test_delayed_job_interposer.rb
|
209
|
+
- test/test_kamikaze.rb
|
208
210
|
- test/test_minitest_interposer.rb
|
209
211
|
- test/test_railtie.rb
|
210
212
|
- test/test_snapshotter.rb
|