tunemygc 1.0.64 → 1.0.65

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 172da6df0caaa73b0a26c279e93f0b0af740ce9d
4
- data.tar.gz: 906de1d1d11a0a3c6381036f2ae93b5584631526
3
+ metadata.gz: e456b67daee462454a91d41bfb7bffeb4bbbba00
4
+ data.tar.gz: 3a94a780936d276e6a2e7f224d107119760927d3
5
5
  SHA512:
6
- metadata.gz: f9fc76ed9759f275a25976606a981c5199d1eacce003dcf38d360621d1b9c835c29ebb229b6f3b0ac7c66906997ef7bc9607e09ab6f3031102a8e3e20860e152
7
- data.tar.gz: 8f7cd6021df5647f4779b199523d5c4426ed364c23181d6cde8961b203a565ffc227da9d8c865b3489b8b9cf964dde91a59f24541d7530f25cf587a9d3d46a74
6
+ metadata.gz: f14abe4c4b39b0e6558eb4a61d46d815b98c8886687fb5bf6604d5994505e642ba90934638b15cf7d9868fe3d046f12976c3409029fe4ca6fe8bb7c3a6a9971b
7
+ data.tar.gz: dd36f2c2b63d3614b4f969349867150486184f72ee626c47985e88bc364a35b2b3ef61ac97844e602e66fc563181839174a90351366b48ed54a84ee35d2b657f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tunemygc (1.0.62)
4
+ tunemygc (1.0.65)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -58,9 +58,12 @@ GEM
58
58
  nokogiri (>= 1.5.9)
59
59
  mail (2.6.3)
60
60
  mime-types (>= 1.16, < 3)
61
+ metaclass (0.0.4)
61
62
  mime-types (2.4.3)
62
63
  mini_portile (0.6.2)
63
64
  minitest (5.5.0)
65
+ mocha (1.1.0)
66
+ metaclass (~> 0.0.1)
64
67
  multi_json (1.10.1)
65
68
  nokogiri (1.6.5)
66
69
  mini_portile (~> 0.6.0)
@@ -120,6 +123,7 @@ DEPENDENCIES
120
123
  activejob (~> 4.2, >= 4.2.0)
121
124
  activesupport (~> 4.1)
122
125
  delayed_job (~> 4.0.6, >= 4.0.6)
126
+ mocha (~> 1.1.0)
123
127
  rails
124
128
  rake (~> 10.3)
125
129
  rake-compiler (~> 0.9, >= 0.9.5)
@@ -24,6 +24,14 @@ module TuneMyGc
24
24
  interposer.check_uninstall
25
25
  end
26
26
 
27
+ def terminated
28
+ snapshot(:TERMINATED, count_objects)
29
+ end
30
+
31
+ def count_objects
32
+ ObjectSpace.count_objects.merge(:memsize => ObjectSpace.memsize_of_all)
33
+ end
34
+
27
35
  def snapshot(stage, meta = nil)
28
36
  snapshotter.take(stage, meta)
29
37
  end
@@ -41,7 +41,7 @@ module TuneMyGc
41
41
  if @installed
42
42
  TuneMyGc.log "at_exit"
43
43
  @spies.each{|s| s.uninstall }
44
- TuneMyGc.snapshot(:TERMINATED, ObjectSpace.count_objects.merge(:memsize => ObjectSpace.memsize_of_all))
44
+ TuneMyGc.terminated
45
45
  TuneMyGc.recommendations
46
46
  end
47
47
  end
@@ -63,9 +63,9 @@ module TuneMyGc
63
63
 
64
64
  def kamikaze
65
65
  Thread.new do
66
- TuneMyGc.snapshot(:TERMINATED, ObjectSpace.count_objects.merge(:memsize => ObjectSpace.memsize_of_all))
66
+ TuneMyGc.terminated
67
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
68
+ Timeout.timeout(TuneMyGc::KAMIZE_SYNC_TIMEOUT) do
69
69
  begin
70
70
  TuneMyGc.recommendations
71
71
  reset
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module TuneMyGc
4
- VERSION = "1.0.64"
4
+ VERSION = "1.0.65"
5
5
  end
@@ -5,5 +5,7 @@ require 'time'
5
5
  module Fixtures
6
6
  STAGE_BOOTED = [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"=>nil, "gc_by"=>"newobj", "have_finalizer"=>false, "immediate_sweep"=>false}, nil,70201748333020]
7
7
 
8
+ STAGE_TERMINATED = [1457439029.721803, 44163072, 44163072, :TERMINATED, [35, 423, 424, 2, 172416, 101940, 70476, 0, 88739, 83678, 421, 2, 423, 0, 812388, 710448, 3906512, 16777216, 20, 15, 1037, 2074, 86916, 173832, 3906896, 16777216], {:major_by=>:force, :gc_by=>:method, :have_finalizer=>false, :immediate_sweep=>true, :state=>:none}, {:TOTAL=>172416, :FREE=>70481, :T_OBJECT=>4700, :T_CLASS=>2664, :T_MODULE=>327, :T_FLOAT=>15, :T_STRING=>45833, :T_REGEXP=>1010, :T_ARRAY=>19765, :T_HASH=>5847, :T_STRUCT=>129, :T_BIGNUM=>4, :T_FILE=>3, :T_DATA=>11096, :T_MATCH=>34, :T_COMPLEX=>1, :T_RATIONAL=>59, :T_SYMBOL=>57, :T_NODE=>10063, :T_ICLASS=>328, :memsize=>27802912}, nil]
9
+
8
10
  CONFIG = {"Memory"=>{"RUBY_GC_HEAP_INIT_SLOTS"=>307562,"RUBY_GC_HEAP_FREE_SLOTS"=>6151,"RUBY_GC_HEAP_GROWTH_FACTOR"=>0.07,"RUBY_GC_HEAP_GROWTH_MAX_SLOTS"=>6151,"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR"=>0.11,"RUBY_GC_MALLOC_LIMIT"=>2000000,"RUBY_GC_MALLOC_LIMIT_MAX"=>4000000,"RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR"=>0.11,"RUBY_GC_OLDMALLOC_LIMIT"=>2000000,"RUBY_GC_OLDMALLOC_LIMIT_MAX"=>4000000,"RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR"=>0.11},"Speed"=>{"RUBY_GC_HEAP_INIT_SLOTS"=>369074,"RUBY_GC_HEAP_FREE_SLOTS"=>184537,"RUBY_GC_HEAP_GROWTH_FACTOR"=>1.2,"RUBY_GC_HEAP_GROWTH_MAX_SLOTS"=>123024,"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.2,"RUBY_GC_OLDMALLOC_LIMIT"=>64000000,"RUBY_GC_OLDMALLOC_LIMIT_MAX"=>128000000,"RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR"=>1.2}, "callback"=>"https://tunemygc.com/configs/8d07e13cc5a7bba2da3510b9ca5e75f4.json"}
9
11
  end
@@ -7,6 +7,7 @@ require 'tunemygc'
7
7
  require "tunemygc/syncer"
8
8
  require 'minitest/autorun'
9
9
  require 'webmock/minitest'
10
+ require 'mocha/mini_test'
10
11
 
11
12
  WebMock.disable_net_connect!
12
13
 
@@ -7,20 +7,15 @@ class TestKamikaze < MiniTest::Unit::TestCase
7
7
  syncer = TuneMyGc::Syncer.new
8
8
  snapshots = TuneMyGc::Snapshotter.new
9
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
-
10
+ TuneMyGc.stubs(:terminated).returns(Fixtures::STAGE_TERMINATED)
15
11
  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 => {})
12
+ with(:body => "[#{ActiveSupport::JSON.encode(syncer.environment(snapshots))},[1457436980.906017,42086400,42086400,\"TERMINATED\",[25,423,424,0,172410,170706,1704,0,88657,9006,423,0,423,0,793852,623146,1211456,16777216,20,5,1013,1354,86740,113636,13091056,16777216],{\"major_by\":null,\"gc_by\":\"newobj\",\"have_finalizer\":false,\"immediate_sweep\":false,\"state\":\"sweeping\"},{\"TOTAL\":172414,\"FREE\":85621,\"T_OBJECT\":4602,\"T_CLASS\":2521,\"T_MODULE\":287,\"T_FLOAT\":14,\"T_STRING\":43165,\"T_REGEXP\":996,\"T_ARRAY\":15116,\"T_HASH\":1737,\"T_STRUCT\":122,\"T_BIGNUM\":4,\"T_FILE\":3,\"T_DATA\":10450,\"T_MATCH\":8,\"T_COMPLEX\":1,\"T_RATIONAL\":59,\"T_SYMBOL\":57,\"T_NODE\":7340,\"T_ICLASS\":311,\"memsize\":22896062},null]]",
13
+ :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}"}).to_return(:status => 200, :body => "", :headers => {})
19
14
  out, err = capture_io do
20
15
  TuneMyGc.logger = Logger.new($stdout)
21
- TuneMyGc.interposer.kamikaze
16
+ TuneMyGc.interposer.kamikaze.join(1)
22
17
  end
23
- sleep 1
24
18
  assert_match(/kamikaze\: synching \d GC sample snapshots ahead of time \(usually only on process exit\)/, out)
19
+ assert_match(/Syncing \d snapshots/, out)
25
20
  end
26
21
  end
@@ -28,4 +28,5 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency('webmock', '~> 1.2', '>= 1.2.0')
29
29
  s.add_development_dependency('activejob', '~> 4.2', '>= 4.2.0')
30
30
  s.add_development_dependency('delayed_job', '~> 4.0.6', '>= 4.0.6')
31
+ s.add_development_dependency('mocha', '~> 1.1.0')
31
32
  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.64
4
+ version: 1.0.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bear Metal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-20 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -118,6 +118,20 @@ dependencies:
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: 4.0.6
121
+ - !ruby/object:Gem::Dependency
122
+ name: mocha
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: 1.1.0
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - "~>"
133
+ - !ruby/object:Gem::Version
134
+ version: 1.1.0
121
135
  description: Agent for the GC tuning webservice https://www.tunemygc.com - optimal
122
136
  settings for throughput and memory usage of Ruby applications
123
137
  email: