High Performance HTTP Load Test
Overview
The goal of (HTTP) load testing is to evaluate if the sites and/or services could handle thousands to millions of access per second, within certain latency range. In Java world, the most popular and free load testing tool is Apache JMeter. In this article, I will describe the alternative tool — gatling, and some data generator combined with it.
Gatling is an open-source load testing framework based on Scala, Akka and Netty
The first and most import feature is its efficiency. There are some performance evaluation results indicates that:
Gatling is able to sustain much higher concurrent volumes without degradation to response time due to in part, its lighter footprint on the JVM
Secondly, writing testing scripts is fairly easy. It is scala based DSL. Here is a self described example:
Finally, the report is are self-contained web pages, with tables are charts, making the analyzing fairly simple.
Log-synth: Random Data Generator
However, gatling itself cannot meat all load testing requirements. In many cases, we need to load test from a large set of data. Gatling provides a data-feed option to achieve that. It supports the data reading from CSV or SQL database. Since Gatling will load whole data feed into memory, it will slow down the process (if not out of memory), if we want to load say one million records for testing. In these cases, we want to generate random names, addresses, or other string patterns right in memory, rather than loading from database. That is where a random data generator comes into the play.
Log-synth generates more or less realistic log data for testing simple aggregation queries.
It is a tool to generate random data, but also can be used a library. It allows user to describe the data using schema in JSON format like this
To integrate this tool with gatling is fairly straightforward, since gatling is Scala based, which can invoke Java methods directly. There are four main steps to achieve the integration:
- Include log-synth as gatling libraries
- Define the data schema e.g. “schema.json”
- Define customized data feed in gatling scripts
The complete example can be found in my github gratling-random
Originally published at tongqqiu.github.io.