Posted over 9 years ago. Visible to the public.

Using Apache Benchmark (ab) on sites with authentication

Apache HTTP server benchmarking tool Archive (ab) is a nice tool to test performance on sites delivered by HTTP. If the site you're about to test is placed behind a login, follow these steps to successfully use ab on it.

  1. Open the site to test in the browser of your choice. Do not login yet.
  2. Use developer tools to show all cookies used by the site. (Chrome: Ctrl+Shift+i, open the 'Resources' tab and click on the site below 'Cookies' on the left. Firefox: Right-click on the site, open 'Web Developer -> Cookies -> View cookie information)
  3. In order to see which cookies are really necessary, delete all cookies, reload the page, log into the site and reload the cookie information site. For Rails powered sites, you should see a cookie named '_your_site_session' and -- depending on your authentication solution -- something like 'remember_token'.
  4. Prepare the cookie string for ab by appending the pairs of cookies name and value like this: cookie_name_1=cookie_value_1;cookie_name_2=cookie_value_2;cookie_name_3=cookie_value_3 ...
  5. Open a terminal and run your benchmark: ab -n 100 -c 10 -C $cookie_string http://your_site/admin/site-to-load. man ab to find out about -n and -c.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Thomas Eisenbarth
Last edit:
about 9 years ago
rails, ab, apache, bench
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Thomas Eisenbarth to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more