Skip to content

Instantly share code, notes, and snippets.

@pavana21
Created June 15, 2012 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavana21/2937565 to your computer and use it in GitHub Desktop.
Save pavana21/2937565 to your computer and use it in GitHub Desktop.
Benchmark the project
require 'rest_client'
require 'benchmark'
@res = RestClient.post( "http://localhost:3000/users/sign_in", { "user[email]"=> 'admin@brandscope.com.au', "user[password]"=> '123456' })
cookies = @res.cookies.dup
urls = ["http://localhost:3000", "http://localhost:3000/orders/index_admin", "http://localhost:3000/orders/4f6b115c6d733102540000b4", "http://localhost:3000/orders/4f597fc4de074f1b45000525", "http://localhost:3000/products", "http://localhost:3000/products?release_id=4f32a231de074f4c55000001", "http://localhost:3000/products?release_id=4f683e246d733112ee000001", "http://localhost:3000/releases", "http://localhost:3000/brands/4f2262cdde074f7480000001", "http://localhost:3000/releases/4f683e246d733112ee000001/range_overview", "http://localhost:3000/releases/4f683e246d733112ee000001/products?product_category_id=4f683e406d733112f5000006", "http://localhost:3000/products/4f683e406d733112f5000008", "http://localhost:3000/products/4f683e596d733112f500000c", "http://localhost:3000/registration_profiles/retailers", "http://localhost:3000/registration_profiles/4f3479f0de074f6051000003/company_information/4f3479f0de074f6051000007/edit", "http://localhost:3000/registration_profiles/4f2714afde074f3378000008/users", "http://localhost:3000/registration_profiles/4f2714afde074f3378000008/addresses", "http://localhost:3000/registration_profiles/4f2714afde074f3378000008/retailer_profile/edit", "http://localhost:3000/registration_profiles/4f2714afde074f3378000008/company_information/4f2714afde074f337800000c/edit", "http://localhost:3000/registration_profiles/suppliers", "http://localhost:3000/registration_profiles/4f224fb4de074f7176000003/company_information/4f224fb4de074f7176000007/edit", "http://localhost:3000/registration_profiles/4f226290de074f747b000003/company_information/4f226290de074f747b000007/edit", "http://localhost:3000/registration_profiles/4f226290de074f747b000003/users", "http://localhost:3000/registration_profiles/4f226290de074f747b000003/addresses", "http://localhost:3000/registration_profiles/4f226290de074f747b000003/supplier_profile/edit", "http://localhost:3000/stocked_brands", "http://localhost:3000/todos", "http://localhost:3000/supplier_retailer_associations", "http://localhost:3000/supplier_retailer_associations/query_releases?release_id=4f683e246d733112ee000001", "http://localhost:3000/supplier_retailer_associations/query_brands?brand_profile_id=4f2262cdde074f7480000001", "http://localhost:3000/supplier_retailer_associations/query_brand_retailers?retailer_id=4f2714afde074f337800000d", "http://localhost:3000/supplier_retailer_associations/query_account_codes?brand_profile_id=4f2262cdde074f7480000001"]
Benchmark.bm do |b|
urls.each do |i|
(1..4).each do |k|
b.report("count #{k} #{i}") {
begin
@res = RestClient.get( "#{i}", :cookies => cookies)
rescue Exception => ex
puts ex.message()
end
}
end
puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment