How to run bench.rb in docker container?


(Gerhard Schlager) #1

I’d like to compare the performance of the Discourse docker container on different servers.
I’ve seen that there is a bench.rb script which is mentioned in Benchmarking Discourse locally.
However, I’m not completely sure how to use it correctly.

I’ve installed apache2-utils inside the container and tried running the script as user root and as user discourse (with sudo -u discourse -i). As expected it doesn’t work as root. The user discourse worked quite well after granting it enough permissions in PostgreSQL (ALTER USER discourse SUPERUSER;). During the benchmark were a few exceptions and at the end I’ve got a permission denied… I guess I’m on the right track, but not quite there yet. Any hints what I’ve done wrong?

BTW: I guess I should stop the running instance of Discourse during the benchmark, shouldn’t I? What’s the best way to stop all it’s components or at least the ones that shouldn’t be running during the benchmark?


Error in post_creator.rb when using bench.rb
(Sam Saffron) #2

See how we run out tests (search for it, adapt that)


(Gerhard Schlager) #3

Thanks for the hint. I guess you referred to Running our test suite inside a docker container?
I’ll try to adapt that. Looks quite simple…


(Gerhard Schlager) #4

I’ve got it running. Currently I have to do lots of things manually (e.g. start postgres, create role in postgres, change database.yml and add template: template0, otherwise I get an error during database creation), but the benchmark works quite well.

Still, at the end I get the following exception and no results :frowning:

script/memstats.rb:99:in `eof?': Permission denied @ io_fillbuf - fd:7 /proc/4515/smaps (Errno::EACCES)
        from script/memstats.rb:99:in `block (2 levels) in <main>'
        from script/memstats.rb:98:in `loop'
        from script/memstats.rb:98:in `block in <main>'
        from script/memstats.rb:94:in `open'
        from script/memstats.rb:94:in `<main>'
script/bench.rb:235:in `<main>': undefined method `[]' for false:FalseClass (NoMethodError)

Looks like it’s not possible to access /proc/<pid>/smaps inside a container. Is this important or can I remove the memstats stuff?


(Sam Saffron) #5

Add some protection there, if it fails its no big deal.