Railsbench can't parse benchmarks.yml correctly

Apologies in advance for the lengthy/somewhat dry (not DRY) post, but
this is a real frustrating problem here, so I’d love some help:

I installed the railsbench gem, and set up my benchmarks.yml file just
like it said:

default:
index

index:
uri: /test/index
new_session: true

When I run “railsbench perf_run 5” it works fine. But I want to test
1000 URLs, so as the docs suggested I changed benchmarks.yml to this:

default:
index, other

index:
uri: /test/index
new_session: true

other:

uri: /test/list
  • uri: /test/alphabetic
    new_session: true

But this format doesn’t work. When I run “railsbench perf_run 5” it
gives this error:

/usr/lib/ruby/gems/1.8/gems/railsbench-0.9.2/lib/railsbench/
benchmark_specs.rb:41:in `parse’: oops: unknown entry type in
benchmark specification (RuntimeError)

I thought maybe the dashes in the YAML were wrong, so I changed them
to this:

other:
foo:
uri: /test/list
bar:
uri: /test/alphabetic
new_session: true

But that gives this error:

No uri given for benchmark entry: BenchmarkSpec(other,
{“foo”=>{“uri”=>"/test/list"}, “bar”=>{“new_session”=>true, “uri”=>"/
test/alphabetic"}})

Turns out it only works if the objects are not “nested” under the
object named “other”:

foo:
uri: /test/list
bar:
uri: /test/alphabetic
new_session: true

…but this is really clunky because then I have to have to list each
yaml object in my default set at the top of the file:

default:
index, foo, bar, … etc

And it seems weird to list all 1000 of the urls I want to benchmark on
that one line.

Two questions:

  1. Any idea why I’m getting these errors when I’m following the
    example docs exactly?
  2. How many URLs should one benchmark? I wanted to use 1000 to
    exercise different paths through my code, but maybe that’s not what
    railsbench is for.

Any tips or advice would be great. Thanks!

-Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs