Project

crusher

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A scriptable, multiprocessing load generator designed to bring web applications to their knees
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Agent Framework

Use the Crusher::HttpLoadGenerator as a base class for defining new load generators:

  class WebUser < Crusher::HttpLoadGenerator

    def initialize(crush_session, email, password, options)
      super(crush_session, options)
    end

    def prepare!
      # Do any preparatory work before beginning the test
      log "Prepared!"
    end

    def start!
      # Do any work required when this agent has been commanded 
      # to start generating load
      log "Starting!"
    end

    def act!
      # Called ~ once per second during the test
      request(:get, "www.google.com"){|response, duration| log("RECIEVED: #{response[:status]}")} if rand < .01
    end

  end

Crushfile DSL

The Crushfile provides a ruby DSL for configuring Crusher with targets and load generation scenarios.

Here's an annotated example:

  target :test do |t|
    # Sets the base URI of the target to crush
    t.uri 'http://www.test.com'
  end
  
  scenario :normal do |s|
    
    # Launch commands create load generators; the blocks should return new 
    # load generator objects
    s.launch 250, 'test.com-user' do |target, scenario, options, job_id| do
      WebUser.new(...)
    end
  
    # Multiple launch commands can be used to launch other types of generators
    s.launch 3, 'test.com-admin' do |target, scenario, options, job_id| do
      AdminUser.new(...)
    end
    
    # Phase commands slowly iterate the set of launched load generators and issue commands
    s.phase :spinup, :over => 10.minutes do |load_generator|
      load_generator.prepare!
    end
    
    # Phase commands are executed sequentially in time, and can be used to inject
    # a scheduled period of inactivity.
    s.phase :cool, :wait => 1.minute
    
    s.phase :start, :over => 5.minutes do |load_generator|
      load_generator.start!
    end
    
    # Log entries are clearly marked with phase names for easy grepping
    s.phase :run, :wait => 20.minutes
    
    # Phases without timespans are executed as fast as possible
    s.phase :stop do |load_generator|
      load_generator.stop!
    end
  
  end

crush command

Reads the Crushfile in the CWD for targets and scenarios, invoke unleash like this:

$ crush target_name scenario_name [log_file]

Eventmachine dependency

Crusher currently requires a non-standard version of the eventmachine gem, as it depends on features which are not currently available in http://github.com/eventmachine/eventmachine

A pull request has been submitted: eventmachine/eventmachine#173

In the meantime, check out "crusher-eventmachine" here: http://github.com/socialcast/eventmachine

Authors

Geoffrey Hichborn (phene) Mitch Williams (thatothermitch) Sean Cashin (scashin133)

Copyright

Copyright (c) 2011 Socialcast, Inc. See LICENSE for details.