derailed_benchmarks 1.1.0 → 1.1.1

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: 64e1d95c4daabc83570c1b4414e12e825d412224
4
- data.tar.gz: a199e5d200e859f53aaeb25326d98325a860e959
3
+ metadata.gz: 375f243912a424ba45e64e6fd2c1aeb7c1349f1d
4
+ data.tar.gz: 65bc16f1ba1b5fe109c5971eac8e67c73ba30057
5
5
  SHA512:
6
- metadata.gz: 5e0e983995112c57ce5925e75ff3e2fc1491ecad771f6445158688872625887710299e42cc20650a323f39c891459b99520b61475059efc97e8ebf5f2598dc70
7
- data.tar.gz: b4f2972a0bb9cd35a6bd7b26fd070638b34c4a0e1f403bb2dee84f0dc913df5aae9dfb465a549097c55c9fa54504bc25dbc54f1455e3037da0c1f254e49b4423
6
+ metadata.gz: 7af36f99ed23a45e684fd220c497673f529227530194693fea67cffc3f9ecbecac720adda9e1fa9576f26e3051834b14584d0135e290a3b5148b1c7fd7d75001
7
+ data.tar.gz: 97c8617852ade4dfbf9eabfe995431be69dabf860de03d8066205ed960313d17024722cc9ae5847b5835c280e174f6fdc3661cfeb923491a80b3cf9921950280
data/CHANGELOG.md CHANGED
@@ -1,24 +1,28 @@
1
1
  # A Log of Changes!
2
2
 
3
+ ## [1.1.1] - 2015-10-01
4
+
5
+ - Added ability to create a heap dump `perf:heap`.
6
+
3
7
  ## [1.1.0] - 2015-09-09
4
8
 
5
9
  - Set custom auth user using a lambda in perf.rake
6
10
  - Changed `perf:ram_over_time` changed to `perf:mem_over_time`
7
11
  - Fixed gem warnings
8
12
 
9
- ## [1.0.1] - 2015-20-06
13
+ ## [1.0.1] - 2015-06-20
10
14
 
11
15
  - `bundle:mem` and similar tasks now keep track of duplicate requires and display them along side of memory requirements. This makes it easier to identify where components are used by multiple libraries
12
16
  - Add rake to gemspec which gets rid of `Unresolved specs during Gem::Specification.reset:` warning
13
17
  - Outputs of memory are now done in [mebibytes](https://en.wikipedia.org/wiki/Mebibyte), a more accurate unit for the value we're measuring (hint: it's what you think MB is).
14
18
 
15
- ## [1.0.0] - 2015-15-05
19
+ ## [1.0.0] - 2015-05-14
16
20
 
17
21
  - Added `derailed` command line utility. Can be used with just a Gemfile using command `$ derailed bundle:mem` and `$ derailed bundle:objects`. All existing Rake tasks can now be called with `$ derailed exec` such as `$ derailed exec perf:mem`.
18
22
  - Changed memory_profiler task to be `perf:objects` instead of `perf:mem`.
19
23
  - Changed boot time memory measurement to `perf:mem` instead of `perf:require_bench`
20
24
  - Released seperate [derailed](https://github.com/schneems/derailed) gem that is a wrapper for this gem. I.e. installing that gem installs this one. Easier to remember, less words to type. Also means there's no colision using the `derailed` namespace for executables inside of the `derailed_benchmarks`.
21
25
 
22
- ## [0.0.0] - 2014-15-08
26
+ ## [0.0.0] - 2014-08-15
23
27
 
24
28
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- derailed_benchmarks (1.1.0)
4
+ derailed_benchmarks (1.1.1)
5
5
  benchmark-ips (~> 2)
6
6
  get_process_mem (~> 0)
7
+ heap_inspect (~> 0)
7
8
  memory_profiler (~> 0)
8
9
  rack (~> 1)
9
10
  rake (~> 10)
@@ -58,6 +59,7 @@ GEM
58
59
  warden (~> 1.2.3)
59
60
  erubis (2.7.0)
60
61
  get_process_mem (0.2.0)
62
+ heap_inspect (0.1.0)
61
63
  hike (1.2.3)
62
64
  i18n (0.7.0)
63
65
  journey (1.0.4)
data/README.md CHANGED
@@ -271,6 +271,32 @@ This is an expensive operation, so you likely want to keep the count lowish. Onc
271
271
 
272
272
  This is is similar to `$ bundle exec derailed bundle:objects` however it includes objects created at runtime. It's much more useful for actual production performance debugging, the other is more useful for library authors to debug.
273
273
 
274
+ ## I want a Heap Dump
275
+
276
+ If you're still struggling with runtime memory you can generate a heap dump that can later be analyzed using [heap_inspect](https://github.com/schneems/heap_inspect).
277
+
278
+
279
+ ```
280
+ $ bundle exec derailed exec perf:heap
281
+ Booting: production
282
+ Heap file generated: "tmp/2015-10-01T12:31:03-05:00-heap.dump"
283
+
284
+ Analyzing Heap
285
+ ==============
286
+ Generation: 0 object count: 209307
287
+ Generation: 35 object count: 31236
288
+ Generation: 36 object count: 36705
289
+ Generation: 37 object count: 1301
290
+ Generation: 38 object count: 8
291
+
292
+ Try uploading "tmp/2015-10-01T12:31:03-05:00-heap.dump" to http://tenderlove.github.io/heap-analyzer/
293
+ ```
294
+
295
+ For more help on getting data from a heap dump see
296
+
297
+ ```
298
+ $ heap_inspect --help
299
+ ```
274
300
 
275
301
  ### Memory Is large at boot.
276
302
 
@@ -410,7 +436,7 @@ change this if your app doesn't run locally with `RAILS_ENV` set to
410
436
  `production`. For example:
411
437
 
412
438
  ```
413
- $ RAILS_ENV=development bundle exec derailed exec perf:mem
439
+ $ RAILS_ENV=development bundle exec derailed exec perf:mem
414
440
  ```
415
441
 
416
442
  ## perf.rake
@@ -464,6 +490,26 @@ end
464
490
 
465
491
  Set the constant `DERAILED_APP` to your Rack app. See [schneems/derailed_benchmarks#1](https://github.com/schneems/derailed_benchmarks/pull/1) for more info.
466
492
 
493
+ An example of setting this up could look like:
494
+
495
+
496
+ ```ruby
497
+ # perf.rake
498
+
499
+ require 'bundler'
500
+ Bundler.setup
501
+
502
+ require 'derailed_benchmarks'
503
+ require 'derailed_benchmarks/tasks'
504
+
505
+ namespace :perf do
506
+ task :rack_load do
507
+ require_relative 'lib/application'
508
+ DERAILED_APP = MyApplication::Routes
509
+ end
510
+ end
511
+ ```
512
+
467
513
  ## Authentication
468
514
 
469
515
  If you're trying to test an endpoint that has authentication you'll need to tell your task how to bypass that authentication. Authentication is controlled by the `DerailedBenchmarks.auth` object. There is a built in support for Devise. If you're using some other authentication method, you can write your own authentication strategy.
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
+ gem.add_dependency "heap_inspect", "~> 0"
21
22
  gem.add_dependency "memory_profiler", "~> 0"
22
23
  gem.add_dependency "get_process_mem", "~> 0"
23
24
  gem.add_dependency "benchmark-ips", "~> 2"
@@ -263,4 +263,24 @@ namespace :perf do
263
263
  end
264
264
  report.pretty_print
265
265
  end
266
+
267
+ desc "heap analyzer"
268
+ task :heap => [:setup] do
269
+ require 'objspace'
270
+
271
+ file_name = "tmp/#{Time.now.iso8601}-heap.dump"
272
+ ObjectSpace.trace_object_allocations_start
273
+ call_app
274
+ GC.start
275
+
276
+ puts "Heap file generated: #{ file_name.inspect }"
277
+ ObjectSpace.dump_all(output: File.open(file_name, 'w'))
278
+
279
+ require 'heap_inspect'
280
+
281
+ HeapInspect::Analyzer.new(file_name).analyze
282
+
283
+ puts ""
284
+ puts "Try uploading #{file_name.inspect} to http://tenderlove.github.io/heap-analyzer/"
285
+ end
266
286
  end
@@ -1,3 +1,3 @@
1
1
  module DerailedBenchmarks
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: derailed_benchmarks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: heap_inspect
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: memory_profiler
15
29
  requirement: !ruby/object:Gem::Requirement