Hi, We have a rails app which is essentially a web UI to a unix filesystem, and which has been performing rather slowly. I''ve been looking at rewriting it in merb, so I did a quick spike where I ported over all the rails code necessary to log in as a user, and generate the same file list page that rails was serving up. However, the numbers appear quite bad (twice as slow as rails, for a naive benchmark), leading me to believe that I''m doing something wrong. I''ll try to get permission to post some code, but on general principles are there any pitfalls to look for when converting rails code to merb? Also, I''m trying to do some sort of rough client-side benchmarking using the following code - is there anything obviously wrong with it? I''m getting numbers of over 10 seconds per page load when I have 50 users repeatedly requesting a dynamic page in a loop: client = HTTPAccess2::Client.new client.set_cookie_store("cookie.dat") client.post(url, {:user_login => login, :user_password => pwd}) client_time = [] all_client_avg = [] all_server_avg = [] $total_client_avg = [] $total_server_avg = [] num_iterations.times do |i| folders = YAML.load(client.get_content("#{url}/folder/all_user_folders")) folders.each do |folder| client_time << Benchmark.realtime do response_size = client.post("#{url}/resources/set_current_folder", {:folder => $folder}).content.length end end client_avg = (client_time.inject(0) {|sum, element| sum + element}) / client_time.length end I''m rather new to both web development and benchmarking, so please feel free to talk to me as if I were an idiot :) martin
Watch this: http://peepcode.com/products/benchmarking-with-httperf and you will no longer be an idiot about benchmarking. :) --R Martin DeMello wrote:> Hi, > > We have a rails app which is essentially a web UI to a unix > filesystem, and which has been performing rather slowly. I''ve been > looking at rewriting it in merb, so I did a quick spike where I ported > over all the rails code necessary to log in as a user, and generate > the same file list page that rails was serving up. However, the > numbers appear quite bad (twice as slow as rails, for a naive > benchmark), leading me to believe that I''m doing something wrong. I''ll > try to get permission to post some code, but on general principles are > there any pitfalls to look for when converting rails code to merb? > > Also, I''m trying to do some sort of rough client-side benchmarking > using the following code - is there anything obviously wrong with it? > I''m getting numbers of over 10 seconds per page load when I have 50 > users repeatedly requesting a dynamic page in a loop: > > client = HTTPAccess2::Client.new > client.set_cookie_store("cookie.dat") > client.post(url, {:user_login => login, :user_password => pwd}) > client_time = [] > all_client_avg = [] > all_server_avg = [] > $total_client_avg = [] > $total_server_avg = [] > num_iterations.times do |i| > folders = YAML.load(client.get_content("#{url}/folder/all_user_folders")) > folders.each do |folder| > client_time << Benchmark.realtime do > response_size = client.post("#{url}/resources/set_current_folder", > {:folder => $folder}).content.length > end > end > > client_avg = (client_time.inject(0) {|sum, element| sum + element}) / > client_time.length > end > > I''m rather new to both web development and benchmarking, so please > feel free to talk to me as if I were an idiot :) > > martin > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel >-- ?When something is too hard it means that you?re not cheating enough.? --DHH
Thamks, grabbed a copy :) martin On 7/31/07, Randall Potter <rpotter at anl.gov> wrote:> Watch this: http://peepcode.com/products/benchmarking-with-httperf and > you will no longer be an idiot about benchmarking. :) > > --R > > Martin DeMello wrote: > > Hi, > > > > We have a rails app which is essentially a web UI to a unix > > filesystem, and which has been performing rather slowly. I''ve been > > looking at rewriting it in merb, so I did a quick spike where I ported > > over all the rails code necessary to log in as a user, and generate > > the same file list page that rails was serving up. However, the > > numbers appear quite bad (twice as slow as rails, for a naive > > benchmark), leading me to believe that I''m doing something wrong. I''ll > > try to get permission to post some code, but on general principles are > > there any pitfalls to look for when converting rails code to merb? > > > > Also, I''m trying to do some sort of rough client-side benchmarking > > using the following code - is there anything obviously wrong with it? > > I''m getting numbers of over 10 seconds per page load when I have 50 > > users repeatedly requesting a dynamic page in a loop: > > > > client = HTTPAccess2::Client.new > > client.set_cookie_store("cookie.dat") > > client.post(url, {:user_login => login, :user_password => pwd}) > > client_time = [] > > all_client_avg = [] > > all_server_avg = [] > > $total_client_avg = [] > > $total_server_avg = [] > > num_iterations.times do |i| > > folders = YAML.load(client.get_content("#{url}/folder/all_user_folders")) > > folders.each do |folder| > > client_time << Benchmark.realtime do > > response_size = client.post("#{url}/resources/set_current_folder", > > {:folder => $folder}).content.length > > end > > end > > > > client_avg = (client_time.inject(0) {|sum, element| sum + element}) / > > client_time.length > > end > > > > I''m rather new to both web development and benchmarking, so please > > feel free to talk to me as if I were an idiot :) > > > > martin > > _______________________________________________ > > Merb-devel mailing list > > Merb-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/merb-devel > > > > -- > "When something is too hard it means that you''re not cheating enough." --DHH > > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel >