tunemygc 1.0.21 → 1.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -12
- data/lib/tunemygc.rb +4 -0
- data/lib/tunemygc/agent.rb +0 -4
- data/lib/tunemygc/cli.rb +2 -2
- data/lib/tunemygc/spies.rb +1 -0
- data/lib/tunemygc/spies/rspec.rb +59 -0
- data/lib/tunemygc/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9672bbb45047e92d9539dc1cb38852dfbb0e2cc6
|
4
|
+
data.tar.gz: 1d3f3d06a6c128a0d982ede89904f237d78610f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ef450dba0017bf54915abda65be2fbbba8729f1fb096df36bea2d4bf30d50532d64d04f3db3c42bf3629378186fc2a6b649893d0e77a8f8ee0e1971ac127b3
|
7
|
+
data.tar.gz: e631316dc487e2dd4d7ca190ccd33c062f1e614305abc8c854d3093f5a4b28e3230b96d012e9d5a975c4842366bcadfe966f5f01a496be054e39fd1c49669c11
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/bear-metal/tunemygc.svg)](https://travis-ci.org/bear-metal/tunemygc)
|
4
4
|
|
5
|
-
The Ruby garbage collector has been flagged as the crux of Ruby performance and memory use for a long time. It has improved a lot over the last years, but there's still a lot to tune and control. *The default configuration is not suitable and optimal for
|
5
|
+
The Ruby garbage collector has been flagged as the crux of Ruby performance and memory use for a long time. It has improved a lot over the last years, but there's still a lot to tune and control. *The default configuration is not suitable and optimal for large Ruby applications, and neither is there a one-size-fits-all set of tuned parameters that would suit every app.* However, hand-tuning the GC parameters is a slippery slope to navigate for most developers.
|
6
6
|
|
7
7
|
## We're fixing this
|
8
8
|
|
@@ -33,11 +33,7 @@ Add to your Gemfile and run `bundle install`
|
|
33
33
|
``` sh
|
34
34
|
gem 'tunemygc'
|
35
35
|
```
|
36
|
-
This gem linterposes itself into the
|
37
|
-
|
38
|
-
#### Windows
|
39
|
-
|
40
|
-
Has not been tested at all.
|
36
|
+
This gem linterposes itself into the application and piggy backs off the new GC events in Ruby 2.x for introspection. Tuning recommendations are handled through a web service at `https://tunemygc.com`. You will need MRI Ruby `2.1`, or later. [Rails](http://www.rubyonrails.org) applications, background jobs, tests and any proprietary Ruby scripts and frameworks are supported.
|
41
37
|
|
42
38
|
## Getting started
|
43
39
|
|
@@ -50,7 +46,7 @@ Application registered. Use RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 in yo
|
|
50
46
|
|
51
47
|
We require a valid email address as a canonical reference for tuner tokens for your applications.
|
52
48
|
|
53
|
-
For the above command sequences, to sample your
|
49
|
+
For the above command sequences, to sample your app or script for tuning, run (inject `RUBY_GC_TOKEN` and `RUBY_GC_TUNE` to your env):
|
54
50
|
|
55
51
|
``` sh
|
56
52
|
RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 RUBY_GC_TUNE=1 bundle exec rails s
|
@@ -61,8 +57,8 @@ The CLI interface supports retrieving configuration options for your application
|
|
61
57
|
``` sh
|
62
58
|
$ bundle exec tunemygc
|
63
59
|
Usage: tunemygc [options]
|
64
|
-
-r, --register EMAIL Register this
|
65
|
-
-c, --config TOKEN Fetch the last known config for a given
|
60
|
+
-r, --register EMAIL Register this application with the https://tunemygc.com service
|
61
|
+
-c, --config TOKEN Fetch the last known config for a given application
|
66
62
|
-h, --help How to use the TuneMyGC agent CLI
|
67
63
|
```
|
68
64
|
|
@@ -93,9 +89,9 @@ RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 RUBY_GC_TUNE=1 bundle exec rails
|
|
93
89
|
|
94
90
|
#### Advanced
|
95
91
|
|
96
|
-
* `RUBY_GC_SPY=action_controller` (Spy on the GC for this type of processing. `action_controller`, `active_job` or `
|
92
|
+
* `RUBY_GC_SPY=action_controller` (Spy on the GC for this type of processing. `action_controller`, `active_job`, `minitest` or `rspec` are supported)
|
97
93
|
|
98
|
-
Defines what type of processing you would like to sample for GC activity. An Action Controller spy is the default, but [ActiveJob](https://github.com/rails/rails/tree/master/activejob)
|
94
|
+
Defines what type of processing you would like to sample for GC activity. An Action Controller spy is the default, but [ActiveJob](https://github.com/rails/rails/tree/master/activejob), [minitest](https://github.com/seattlerb/minitest) and [rspec](http://rspec.info) are also supported as experimental features.
|
99
95
|
|
100
96
|
* `RUBY_GC_TUNE_REQUESTS=x` (a numeric value eg. `200`)
|
101
97
|
|
@@ -107,7 +103,7 @@ Controls the interposer lifetime for sampling ActiveJob jobs. It will enable its
|
|
107
103
|
|
108
104
|
* `RUBY_GC_TUNE_TESTS=x` (a numeric value eg. `200`)
|
109
105
|
|
110
|
-
Controls the interposer lifetime for sampling a [minitest](https://github.com/seattlerb/minitest) based test suite. It will enable itself, then remove request instrumentation after the specified number of tests has been run. A good minimum ballpark sample set would be 200.
|
106
|
+
Controls the interposer lifetime for sampling a [minitest](https://github.com/seattlerb/minitest) or [rspec](http://rspec.info) based test suite. It will enable itself, then remove request instrumentation after the specified number of tests has been run. A good minimum ballpark sample set would be 200.
|
111
107
|
|
112
108
|
## How do I use this?
|
113
109
|
|
data/lib/tunemygc.rb
CHANGED
data/lib/tunemygc/agent.rb
CHANGED
data/lib/tunemygc/cli.rb
CHANGED
@@ -13,10 +13,10 @@ module TuneMyGc
|
|
13
13
|
OptionParser.new do |opts|
|
14
14
|
opts.banner = "Usage: tunemygc [options]"
|
15
15
|
|
16
|
-
opts.on("-r ", "--register EMAIL", "Register this
|
16
|
+
opts.on("-r ", "--register EMAIL", "Register this application with the https://tunemygc.com service") do |email|
|
17
17
|
options[:email] = email
|
18
18
|
end
|
19
|
-
opts.on("-c ", "--config TOKEN", "Fetch the last known config for a given
|
19
|
+
opts.on("-c ", "--config TOKEN", "Fetch the last known config for a given application") do |token|
|
20
20
|
options[:config] = token
|
21
21
|
end
|
22
22
|
opts.on_tail("-h", "--help", "How to use the TuneMyGC agent CLI") do
|
data/lib/tunemygc/spies.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rspec'
|
4
|
+
|
5
|
+
module TuneMyGc
|
6
|
+
module Spies
|
7
|
+
class Rspec
|
8
|
+
def initialize
|
9
|
+
@tests_processed = 0
|
10
|
+
@tests_limit = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def install
|
14
|
+
RSpec::Core.__send__(:include, hooks_module)
|
15
|
+
TuneMyGc.log "hooked: rspec"
|
16
|
+
end
|
17
|
+
|
18
|
+
def uninstall
|
19
|
+
TuneMyGc.uninstall_gc_tracepoint
|
20
|
+
TuneMyGc.log "uninstalled GC tracepoint"
|
21
|
+
RSpec::Core.__send__(:include, disabled_hooks_module)
|
22
|
+
TuneMyGc.log "uninstalled rspec spy"
|
23
|
+
end
|
24
|
+
|
25
|
+
def check_uninstall
|
26
|
+
if ENV["RUBY_GC_TUNE_TESTS"]
|
27
|
+
@tests_limit ||= Integer(ENV["RUBY_GC_TUNE_TESTS"])
|
28
|
+
@tests_processed += 1
|
29
|
+
if @tests_processed == @tests_limit
|
30
|
+
uninstall
|
31
|
+
TuneMyGc.log "kamikaze after #{@tests_processed} of #{@tests_limit} tests"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def hooks_module
|
37
|
+
Module.new do
|
38
|
+
RSpec.configure do |c|
|
39
|
+
c.before(:all) { TuneMyGc.processing_started }
|
40
|
+
c.after(:all) { TuneMyGc.processing_ended }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def disabled_hooks_module
|
46
|
+
Module.new do
|
47
|
+
private
|
48
|
+
def tunemygc_before_setup
|
49
|
+
# noop
|
50
|
+
end
|
51
|
+
|
52
|
+
def tunemygc_after_teardown
|
53
|
+
# noop
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/tunemygc/version.rb
CHANGED
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.22
|
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-
|
11
|
+
date: 2015-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- lib/tunemygc/spies/active_job.rb
|
150
150
|
- lib/tunemygc/spies/manual.rb
|
151
151
|
- lib/tunemygc/spies/minitest.rb
|
152
|
+
- lib/tunemygc/spies/rspec.rb
|
152
153
|
- lib/tunemygc/subscriber.rb
|
153
154
|
- lib/tunemygc/syncer.rb
|
154
155
|
- lib/tunemygc/version.rb
|