memstat 0.1.1 → 0.1.2

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: 90119832e41e4b1f94fa4d5ed312c21d8b7a152b
4
- data.tar.gz: b4b527bfb4596bda0a4597beef32b6fb402a1d2a
3
+ metadata.gz: 2ecbb34062ad5ab1f96df42d10a8a76914786b7a
4
+ data.tar.gz: 2eb1e6ac83385e2acffee47e5241ed2d763d8ef4
5
5
  SHA512:
6
- metadata.gz: 60a9c14475244b516db3eac3f375cb4cbf39161849a91e58949b4cd16ee75f1802a05fd3fa0f593aea0f4a81cda6eb1d59e767cb89ebec7a32589a0db8688709
7
- data.tar.gz: c82ce0b893f7ac0b7e3a4f5202fc11e3dcf4b33333104b4e4114dee2c609cbe3f26d836463923d86108d3ca08b17257d5be901f0dbb2670749cf48b5361b88bb
6
+ metadata.gz: 00ec8d94f9596b90e6d2b10d90c35ef713dd73e44530acec3ab765d23a71514fdfa6ca12c0bf24944451753fcc910722c6e0169eb15efa6a6fb2b885da7ad07f
7
+ data.tar.gz: b89d256ee555f1804fb9a66ae0a48ddeb374901c402871ec49fca735d04eaa0aac969abf21d1eb6ac2440d23df144777017ae85347823d124d891bc915a00078
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - rbx
7
+ - ruby-head
8
+ - jruby-head
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Memstat: Fast memory statistics & better out-of-band GC
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/kenn/memstat.png)](http://travis-ci.org/kenn/memstat)
4
+
3
5
  Ruby 2.1 introduced generational garbage collection. It is a major improvement in terms of shorter GC pauses and overall higher throughput, but that comes with a [drawback of potential memory bloat](http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/).
4
6
 
5
7
  You can mitigate the bloat by manually running `GC.start`, but like Unicorn's out-of-band GC, doing it after every request can seriously hurt the performance. You want to run `GC.start` only when the process gets larger than X MB.
@@ -79,7 +81,7 @@ status.swap # Swap size
79
81
 
80
82
  See [details](http://ewx.livejournal.com/579283.html) for each item.
81
83
 
82
- ## Commandline
84
+ ## Command Line
83
85
 
84
86
  memstat also comes with a command line utility to report detailed memory statistics by aggregating `/proc/[pid]/smaps`.
85
87
 
@@ -111,10 +113,7 @@ In this case, 103,536 kB out of 131,020 kB is shared, which means 79% of its mem
111
113
 
112
114
  For more details, [read this gist](https://gist.github.com/kenn/5105175).
113
115
 
114
- ## Contributing
116
+ ## Changelog
115
117
 
116
- 1. Fork it
117
- 2. Create your feature branch (`git checkout -b my-new-feature`)
118
- 3. Commit your changes (`git commit -am 'Add some feature'`)
119
- 4. Push to the branch (`git push origin my-new-feature`)
120
- 5. Create new Pull Request
118
+ ### 0.1.0, release 2014-04-03
119
+ * Initial release
@@ -8,10 +8,13 @@ module Memstat
8
8
 
9
9
  def process_client(client)
10
10
  super(client) # Unicorn::HttpServer#process_client
11
- status = Memstat::Proc::Status.new(:pid => Process.pid)
12
11
 
13
- if status.rss > OOBGC_THRESHOLD
14
- GC.start
12
+ if Memstat.linux?
13
+ status = Memstat::Proc::Status.new(:pid => Process.pid)
14
+
15
+ if status.rss > OOBGC_THRESHOLD
16
+ GC.start
17
+ end
15
18
  end
16
19
  end
17
20
  end
@@ -1,3 +1,3 @@
1
1
  module Memstat
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/test/test_memstat.rb CHANGED
@@ -42,11 +42,15 @@ class TestCli < Minitest::Test
42
42
  assert_equal status.swap, 0 * 1024
43
43
  end
44
44
 
45
+ def test_oobgc
46
+ Memstat::OobGC::Unicorn
47
+ end
48
+
45
49
  def test_benchmark
46
50
  n = 100
47
51
  Benchmark.bm(10) do |x|
48
- x.report("ps:") { n.times.each { `ps -o rss -p #{Process.pid}`.strip.split.last.to_i } }
49
- x.report("memstat:") { n.times.each { Memstat::Proc::Status.new(:pid => Process.pid).rss } }
52
+ x.report("ps:") { n.times.each { `ps -o rss -p #{Process.pid}`.strip.to_i } }
53
+ x.report("memstat:") { n.times.each { Memstat::Proc::Status.new(:path => STATUS_PATH).rss } }
50
54
  end
51
55
  end
52
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memstat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenn Ejima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2014-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - ".travis.yml"
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md