mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-25 16:04:22 -05:00
enable eager loading in profile mode
correct bench script
This commit is contained in:
parent
ad0bef5ef6
commit
9c6c0f2a3d
2 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
||||||
Discourse::Application.configure do
|
Discourse::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
config.eager_load = true if rails4?
|
||||||
|
|
||||||
# Code is not reloaded between requests
|
# Code is not reloaded between requests
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
|
|
|
@ -93,13 +93,13 @@ puts "Populating Profile DB"
|
||||||
run("bundle exec ruby script/profile_db_generator.rb")
|
run("bundle exec ruby script/profile_db_generator.rb")
|
||||||
|
|
||||||
puts "Getting api key"
|
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)
|
def bench(path)
|
||||||
puts "Running apache bench warmup"
|
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}"
|
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]
|
percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten]
|
||||||
CSV.foreach("tmp/ab.csv") do |percent, time|
|
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")
|
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"
|
append = "?api_key=#{api_key}&api_username=admin1"
|
||||||
|
|
||||||
home_page_admin = bench("/#{append}")
|
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}")
|
topic_page_admin = bench("/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69#{append}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue