so the last number is how many page server this page can support in 1
second if it stops right there.
that number is initially about 1800, and then at the end of the loop, it
is just 20.
this program is not so CPU intensive, it seems... i wonder how come it
drops from 1800 to 20 that quickly? thanks.
after the 1st iteration through the loop you have used (aparently)
1/1800 of a second.
having done 100 iterations, you've used 1/20th of a second ie aprox
1/1800 * 100. How is it a surprise that doing something 100 times
takes roughly 100 times as long as doing it once.
This "benchmark" is also only testing erb - it is not testing any of
the actioncontroller, routing etc... (you might find ab enough for
your needs(
Frederick Cheung wrote:
> after the 1st iteration through the loop you have used (aparently)
> 1/1800 of a second.
> having done 100 iterations, you've used 1/20th of a second ie aprox
> 1/1800 * 100. How is it a surprise that doing something 100 times
> takes roughly 100 times as long as doing it once.
> This "benchmark" is also only testing erb - it is not testing any of
> the actioncontroller, routing etc... (you might find ab enough for
> your needs(
> Fred
hm, i think i am looking for more fixed cost... such as running the loop
1 time, the machine can serve 1800 pages per second and running the loop
100 times, the machine can serve 200 pages per second. so you are
saying that fixed cost is minimal and it is largely just the execution
time? fixed cost involves forking a process, for example... but is it
true that there is no newly created process when a page is served?
thanks.
there is no process created.
I'm not saying that there is no fixed cost, I'm saying that your test
doesn't cover a large portion of the fixed cost
<% t = Time.now %>
<h1>Hello#index</h1>
<p>Find me in app/views/hello/index.rhtml</p>
<pre>
<% for i in 1..100 do %>
<%= Time.now %>
<%= h @ha %>
<%= sanitize @ha %>
<%= u @ha %>
<%= @ha.to_json %>
<%= strip_tags @ha %>
<%= Time.now - t %>
<%= 1 / (Time.now - t) %>
<% end %>
to this:
<% for i in 1..100 do %>
<% t = Time.now %>
<%= h @ha %>
<%= sanitize @ha %>
<%= u @ha %>
<%= @ha.to_json %>
<%= strip_tags @ha %>>
<%= 1 / (Time.now - t) %>
<% end %>
your test is still flawed as the above poster mentioned.. but this will
correct the behavior you were previously seeing..
<% t = Time.now %>
<h1>Hello#index</h1>
<p>Find me in app/views/hello/index.rhtml</p>
<pre>
<% for i in 1..100 do %>
<%= Time.now %>
<%= h @ha %>
<%= sanitize @ha %>
<%= u @ha %>
<%= @ha.to_json %>
<%= strip_tags @ha %>
<%= Time.now - t %>
<%= 1 / (Time.now - t) %>
<% end %>
to this:
<% for i in 1..100 do %>
<% t = Time.now %>
<%= h @ha %>
<%= sanitize @ha %>
<%= u @ha %>
<%= @ha.to_json %>
<%= strip_tags @ha %>>
<%= 1 / (Time.now - t) %>
<% end %>
your test is still flawed as the above poster mentioned.. but this will
correct the behavior you were previously seeing..
ilan
how is my test flawed? I wasn't looking to see if each iteration takes
different duration. I was really try to run a simple loop and see how
many hits the server can take per second. be careful when you say
people's code is flawed, as it insults people. maybe you don't know
about it.
Exactly as I explained previously: you are benchmarking how long it
takes to render an erb template, but there's a lot of other bits of
overhead that will go into your overall requests/second.
Why don't you just use wget in a loop to time the entire rails
application? Something like this will hit your server with 1000
requests and tell you how long it took.
Sure it can test any web server. I just meant that since it is part
of the apache package not everybody would have it installed.
On Apr 23, 12:33�pm, SpringFlowers AutumnMoon <rails-mailing-
oh i see. thanks. fortunately the macbook with Leopard has it. i was
thinking of whether to set up a Linux machine to run Rails... but until
now there seems to be no reason to.