License Maven Central


massive-attack is a simple and configurable load generator test tool written in Scala originally to test Apache Thrift endpoints, but it can be used to benchmark any method that returns a Scala or Twitter Future.


Because I needed to load test a Thrift endpoint in one of my APIs, and could not find an easy to use tool after looking around for days, at least not one that did not require me to develop JMeter plugins, or one that has been updated in the past few years.


So I decided to create one which is easy to use:

  1. It can easily be added as a dependency to your API or application
  2. It is configurable as much or as little as you need it to be
  3. It is extensible


  1. Add it as a dependency to build.sbt:

libraryDependencies ++= Seq("com.delprks" %% "massive-attack" % "1.0.0" % "test")

  1. Create your test in ScalaTest or Specs2 (this library might change to be a testing framework in future)

To test a long running method that returns a Future:

"long running method should have average response times of less than 40ms" in {
  val testProperties = MethodPerformanceProps(
    invocations = 10000,
    threads = 50,
    duration = 35,
    report = true,
    reportName = Some("scala_future_performance_test")

  val methodPerformance = new MethodPerformance(testProperties)

  val testResultF: Future[MethodPerformanceResult] = methodPerformance.measure(() => method())
  val testResult = Await.result(testResultF, futureSupportTimeout)
  testResult.responseTimeAvg should be < 40

Which will result in:


And (if enabled) generate a report containing the test results:


Test properties

Following properties are available and configurable through MassiveAttackProperties:


Specifies how many times the method should be invoked.


You can set how many threads you want to run the load test on - beware that Thrift clients can run only on single threads.


Specifies how long the method should be tested for in seconds - whichever comes first (duration or invocations) determines the length of the test.


This is by default set to true to avoid cold start times affecting the test results - set it to false if you want to test cold starts.


If warmUp is set to true, warmUpInvocations determines how many times the method should be invoked before the load test starts.


This is used to decide which response times should be considered as spikes, by multiplying the average response time and spikeFactor. It has the default value of 3.0.


Set this to true if you want to see invocation times when the load test is in progress.


Set this to true if you want to save test results in a CSV file.


If report is set to true, results will be saved to this file. If no reportName is specified, one will be generated.


massive-attack is open source software released under the Apache 2 License.