Merge pull request #3020 from bear-metal/master
Minor additions to script/bench.rb
This commit is contained in:
commit
c46b4bd12c
1 changed files with 8 additions and 4 deletions
|
@ -2,6 +2,7 @@ require "socket"
|
||||||
require "csv"
|
require "csv"
|
||||||
require "yaml"
|
require "yaml"
|
||||||
require "optparse"
|
require "optparse"
|
||||||
|
require "fileutils"
|
||||||
|
|
||||||
@include_env = false
|
@include_env = false
|
||||||
@result_file = nil
|
@result_file = nil
|
||||||
|
@ -102,16 +103,18 @@ end
|
||||||
ENV["RAILS_ENV"] = "profile"
|
ENV["RAILS_ENV"] = "profile"
|
||||||
|
|
||||||
|
|
||||||
|
gc_env_vars = %w(RUBY_GC_HEAP_INIT_SLOTS RUBY_GC_HEAP_FREE_SLOTS RUBY_GC_HEAP_GROWTH_FACTOR RUBY_GC_HEAP_GROWTH_MAX_SLOTS RUBY_GC_MALLOC_LIMIT RUBY_GC_OLDMALLOC_LIMIT RUBY_GC_MALLOC_LIMIT_MAX RUBY_GC_OLDMALLOC_LIMIT_MAX RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR)
|
||||||
|
|
||||||
if @include_env
|
if @include_env
|
||||||
puts "Running with tuned environment"
|
puts "Running with tuned environment"
|
||||||
ENV["RUBY_GC_MALLOC_LIMIT"] = "50_000_000"
|
ENV["RUBY_GC_MALLOC_LIMIT"] = "50_000_000"
|
||||||
ENV.delete "RUBY_HEAP_SLOTS_GROWTH_FACTOR"
|
gc_env_vars - %w(RUBY_GC_MALLOC_LIMIT).each do |v|
|
||||||
ENV.delete "RUBY_HEAP_MIN_SLOTS"
|
ENV.delete v
|
||||||
ENV.delete "RUBY_FREE_MIN"
|
end
|
||||||
else
|
else
|
||||||
# clean env
|
# clean env
|
||||||
puts "Running with the following custom environment"
|
puts "Running with the following custom environment"
|
||||||
%w{RUBY_GC_MALLOC_LIMIT RUBY_HEAP_MIN_SLOTS RUBY_FREE_MIN}.each do |w|
|
gc_env_vars.each do |w|
|
||||||
puts "#{w}: #{ENV[w]}"
|
puts "#{w}: #{ENV[w]}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -168,6 +171,7 @@ begin
|
||||||
|
|
||||||
pid = if @unicorn
|
pid = if @unicorn
|
||||||
ENV['UNICORN_PORT'] = @port.to_s
|
ENV['UNICORN_PORT'] = @port.to_s
|
||||||
|
FileUtils.mkdir_p(File.join('tmp', 'pids'))
|
||||||
spawn("bundle exec unicorn -c config/unicorn.conf.rb")
|
spawn("bundle exec unicorn -c config/unicorn.conf.rb")
|
||||||
else
|
else
|
||||||
spawn("bundle exec thin start -p #{@port}")
|
spawn("bundle exec thin start -p #{@port}")
|
||||||
|
|
Reference in a new issue