No commit activity in last 3 years
No release in over 3 years
A simple command line tool for stress testing remote resources.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

trample¶ ↑

Trample is a flexible load simulation tool.

Most load sim tools make requests to a static list of urls. They spawn n threads and make requests to the urls on the list in succession, in each thread. Unfortunately, though, if your applicaition makes use of any kind of caching (including your database’s internal caching facilities), this kind of load simulation is unrealistic.

The data required to serve a single set of urls is likely to fit nicely in the database server’s cache (even on a small server). So, having a single user hammer a finite set of pages will make your application look much faster than it really is.

Trample allows you to provide parameter values inside of a block (a lambda function, for non-rubyists). The block is executed each time the parameters are needed. So, if you use randomization in the block, you should (theoretically) get different values every time.

That way, you can have trample log in as several different users and request different data in each session.

How To¶ ↑

Trample uses a ruby DSL for configuration.

Trample.configure do
  concurrency 5
  iterations  10

  #
  # GETs & POSTs that follow are executed sequentially inside a thread.
  # Results are stored in thread local storage in Thread.current[:result]
  # Any intermediate results you want to use also need to go into thread local storage!
  #
  # YOU HAVE BEEN WARNED!
  #

  login do
    post "http://yoursite.com/login" do
      {:username => User.random.username, :password => "swordfish"}
    end
  end
  get  "http://yoursite.com/somewhere"
  post "http://yoursite.com/something" do
    {:a_parameter => "a value"}
  end
  get  "http://yoursite.com/someresources/:id" do
    {:id => SomeResource.random.id}
  end

  # By default, get will accept 'application/xml', so you may run into
  # odd behavior with rails respond_to blocks.  This will allow you
  # to send a request that Rails will handle and return a 200 instead of
  # a 406 status message.
  get "http://yoursite.com/path/to/resource", :headers => {:accept => 'text/html'}
end

The above configuration will start 5 (concurrency) sessions by logging in as a random user at the url in the login block. Then, it’ll hit the three urls underneath it 10 (iterations) times during each session.

To run trample, save your configuration somewhere and run:

trample start /path/to/your/trample/config.rb

Copyright © 2009 James Golick. See LICENSE for details.