enable eager loading in profile mode

correct bench script
This commit is contained in:
Sam 2013-09-10 16:22:58 +10:00
parent ad0bef5ef6
commit 9c6c0f2a3d
2 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,8 @@
Discourse::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.eager_load = true if rails4?
# Code is not reloaded between requests
config.cache_classes = true

View file

@ -93,13 +93,13 @@ puts "Populating Profile DB"
run("bundle exec ruby script/profile_db_generator.rb")
puts "Getting api key"
api_key = `bundle exec rake api_key:get`
api_key = `bundle exec rake api_key:get`.split("\n")[-1]
def bench(path)
puts "Running apache bench warmup"
`ab -n 100 http://127.0.0.1:#{@port}#{path}`
`ab -n 100 "http://127.0.0.1:#{@port}#{path}"`
puts "Benchmarking #{path}"
`ab -n 100 -e tmp/ab.csv http://127.0.0.1:#{@port}#{path}`
`ab -n 100 -e tmp/ab.csv "http://127.0.0.1:#{@port}#{path}"`
percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten]
CSV.foreach("tmp/ab.csv") do |percent, time|
@ -128,6 +128,7 @@ begin
topic_page = bench("/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69")
append = "?api_key=#{api_key}&api_username=admin1"
home_page_admin = bench("/#{append}")
topic_page_admin = bench("/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69#{append}")