GitXplorerGitXplorer
a

hammer

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
3d196e69ea5c2970a9e81dd54591d67acdcaac31

show the connection rate plot

aadampingel committed 11 years ago
Unverified
75b3568ab62e8a31f7f5ad55dff91b7ad384b73b

changing language of log output

aadampingel committed 11 years ago
Unverified
be6757e7ffecd8ef76475a4372161e06bda8a35e

tick duration to 1 ms

aadampingel committed 11 years ago
Unverified
21af2777674475186a52458d0af3a6d4c3e0475e

note 500 Hz max

aadampingel committed 11 years ago
Unverified
428b38e9cb83e625679fdc20f28d1506e9d53943

log period change after rps adjustment

aadampingel committed 11 years ago
Unverified
00ab9995020dca559ec0de30a30dc49550a42440

set scheduler tick duration to 2 ms

aadampingel committed 11 years ago

README

The README file for this repository.

hammer

Also see Demo.scala.

The Hammer class requires a LoadGenerator.

The following load generator uses Dispatch library to make asynchronous HTTP requests.

import org.pingel.hammer._
import dispatch._ // , Defaults._
import scala.concurrent.ExecutionContext.Implicits.global
import util.Random.nextInt

class HostIpApiLoadGenerator extends LoadGenerator {

  def name() = "hostip.info API"

  val requestBuilders = Vector(
    url("http://api.hostip.info/get_json.php"),
    url("http://api.hostip.info/country.php")
  )

  def randomRequestBuilder() = requestBuilders(nextInt(requestBuilders.size))

  def makeNextRequest(id: Long) = {
    Http(randomRequestBuilder() OK as.String)
  }
}

Start the load generator, issuing 2 requests per second (2 Hz):

import axle.quanta._
import Frequency._

val hammer = new Hammer(new HostIpApiLoadGenerator(), 2 *: Hz)

Log hammer statistics every 5 seconds with:

import Time._
hammer.logStatsEvery(5 *: second)

Example output:

[INFO] [05/02/2013 11:28:55.148] [HammerSystem-akka.actor.default-dispatcher-3] [akka://HammerSystem/user/$a] 
Hammer statistics

  Current time: 2013-05-02T11:28:55.147-07:00
  Target request start rate: 100 Hz
  Average request start rate: 100.0 Hz
  Average request completion rate: 100.0 Hz
  Latency average: 5.022 ms
  Current # pending requests: 0
  Total # requests: 2004

To repeat this output, clone this repository and do sbt run.

Set the target requests/second after the hammer is running:

hammer.rps(30 *: Hz)

Note that the rate is limited by the akka scheduler "tick-duration", which is currently defined as 1 millisecond, meaning that the maximum requests/second is 1 KHz. A future version of hammer may work around this limitation.

Create a plots for

  • latency average
  • target rate as well as the connections opened and closed rate
import axle.visualize._
import axle.algebra.Plottable._

implicit val msP = ms.plottable
show(hammer.latencyPlot())

implicit val hzP = Hz.plottable
show(hammer.connectionRatePlot())

latency

connectionrates