Skip to content

Commit 69c277c

Browse files
committed
some memory stats and use jemalloc
this was recommended by Charlie Sommerville
1 parent 381175a commit 69c277c

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ gem 'yajl-ruby', '~> 1.4.0'
2727
# heroku
2828
gem 'unicorn', '~> 4.6.2'
2929

30+
gem 'jemalloc', git: 'https://github.com/joshk/jemalloc-rb'
31+
3032
group :development, :test do
3133
gem 'pry'
3234
gem 'rspec', '~> 2.9'

Gemfile.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
GIT
2+
remote: https://github.com/joshk/jemalloc-rb
3+
revision: 8c9dbef98f6bd4f96b371ec336b7e0c4fdc02d49
4+
specs:
5+
jemalloc (1.4.5)
6+
17
GIT
28
remote: https://github.com/travis-ci/travis-support
39
revision: 113cff17fe383bb72fcfae3a97a8ce98c228342f
@@ -92,6 +98,7 @@ DEPENDENCIES
9298
activesupport (~> 4.1.11)
9399
backports (= 2.4.0)
94100
foreman (~> 0.41.0)
101+
jemalloc!
95102
metriks
96103
metriks-librato_metrics
97104
pry

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
1+
web: bundle exec je unicorn -p $PORT -c ./config/unicorn.rb
22
console: bundle exec irb -I lib -r travis/listener

lib/travis/listener/app.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class App < Sinatra::Base
4343

4444
# the main endpoint for scm services
4545
post '/' do
46+
report_memory_usage
4647
report_ip_validity
4748
if !ip_validation? || valid_ip?
4849
if valid_request?
@@ -216,6 +217,10 @@ def request_body
216217
request.body.read.force_encoding("utf-8")
217218
end
218219
end
220+
221+
def report_memory_usage
222+
Metriks.gauge("listener.gc.total_allocated_objects").set(GC.stat[:total_allocated_objects])
223+
end
219224
end
220225
end
221226
end

0 commit comments

Comments
 (0)