Do we still need to test our servers in 2015? Hell yes we do.
Whether it's a CDN that you need to know will work as fast as promised when you're throwing 100 visitors a second at it, a customised tracker that keeps your data private but you need to know will stand up to the heat of a campaign, or a landing page server hosting a complex lander funnel, a server that can't stand the strain can screw your affiliate business.
And whilst Real-User Monitoring is great, if you're operating at scale you need to know if your server's going to die before you place the Insert Order and start the traffic flowing.
Back in the day, I used to recommend a tool called Blitz.io. It's still pretty good but it has become a lot more expensive, and in the last two years a lot of other options have arrived.
Including my new favourite tool for server testing: Gatling.
Gatling's almost as easy to use as Blitz, and at least as powerful as the other top server-testing tool, JMeter. And in this tutorial I'll show you the basics of how to install and use it.
Who will find this tutorial useful, and what do you need to know?
Almost every affiliate can get some use out of load-testing and response-testing their servers.
In particular, load testing is useful for more experienced affiliates running bigger volume, and anyone running a tracker that they're hosting on their own servers.
Gatling is particularly good for affiliates running serious scale, as its more advanced features like sending real-world useragents and running through an entire funnel are great for showing up the kind of performance issues that less thorough load testers won't spot, and that can really cost you a lot of money if you're throwing millions of clicks a day at a campaign.
You won't need any particular coding knowledge for this basic tutorial, and you can go through it on Mac or Windows.
However, if you want to get into the more advanced uses of Gatling - and there are a lot of advanced uses to get into - you'll need to be comfortable with some basic coding and system administration. Either that, or you'll need to pay someone who is.
This tutorial will take you through a comparatively simple test for Gatling, which is still more detailed than the tests most rival platforms can offer.
If you want to test a tracking system, you'll need to set up a campaign to test before you start this tutorial. I'd recommend using a second landing page or a non-functional URL for your offer URL unless you're sure your affiliate network is OK with you stress-testing their systems!
If you just want to test a landing page, either on a CDN or on a single server, you'll just need the URL of that landing page.
What Is Gatling And What Does It Do?
Gatling's a tool for throwing simulated traffic at your servers. Unlike a simple tool like Blitz, it's capable of simulating a Web user very precisely, including sending useragent strings, taking multiple steps and following redirects, and even filling in form information.
Uniquely for this type of tool, it includes a recorder function, allowing you to record your own test "patterns" without needing to code. And it produces a beautiful, very detailed report of the results of the test at the end - far better than most reports from paid testing tools like Blitz:

You can comparatively easily run Gatling on a remote server: just install the Java Development Kit, download the package and you're good to go. However, in this tutorial we'll focus on running it on your desktop or laptop machine.
Installing Gatling And Recording Your Test
First, if you don't have a recent version of the Java Development Kit installed, download the most recent one from Oracle. It's a very simple install.
Then, download Gatling itself from the project download page. Get the "Gatling Bundle (.zip)" from "Latest Release" - you don't want the "Snapshot" version.
Unzip that somewhere onto your computer.
Now, we'll set up your browser for recording. You'll not be able to use your browser for regular browsing while you're doing this, so be sure that you have all the URLs you'll need (campaign URL or lander URL) copied out first.
Gatling works by acting as a proxy between your browser and the Internet. That means it can capture all the data about your browsing session, including timings (so you can wait around or click through quickly) and user-agent data.
To set this up:

import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class RecordedSimulation extends Simulation {
val httpProtocol = http
.baseURL("http://154.62.35.153")
.inferHtmlResources()
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.connection("keep-alive")
.userAgentHeader("Mozilla/5.0 (Windows NT 6.0; WOW64; rv:38.0) Gecko/20000101 Firefox/37.0")
val uri1 = "http://154.62.35.153"
val scn = scenario("RecordedSimulation")
.exec(http("request_0")
.get("/tracker/?cmid=NQ==&cvar1={keyword}&cvar2={match}&cvar3={cid}"))
.pause(3)
.exec(http("request_1")
.get("/tracker/gotoof"))
setUp(scn.inject(atOnceUsers(1))).protocols(httpConf)
}
setUp( scn.inject(atOnceUsers(1)) ).protocols(httpProtocol)



Epic tread.
NO wonder ad networks have such mega problems finding ad fraud, tools like this are too smart and act like real surfers.
Awesome share. Thanks.
Whoa ... what a post!
If the goal is ultimately to measure a server's ability to handle load, why use gatling?
What makes gatling superior to buying ZeroPark Global RON pop traffic for $0.20 CPM?
@jennatalia - mostly the cost. Running 5-million-visitor tests repeatedly on a server can get expensive even at super-cheap pop prices, wheras it's not very expensive to run even 20 or so Digital Ocean instances around the world to stress-test the server.
@cmdeal, @kash50 - thanks!
@iamattila - Yeah, browser simulation tools are getting very smart. Some of the stuff out there that's more AI-based is pretty terrifying.
Thanks Caurmen, I've just ran my first test with Gatling.
I really like their recorder as it makes testing complex sequences extremely easy.
Just wanted to add the following piece of code for those who want to clear the cookies between each request and send random strings to their tracking tockens:
val rdm = new scala.util.Random(31)
val scn = scenario("NameOfYourScenario")
.exec(flushCookieJar)
.exec(http("your_request_name")
.get("/your_url_path")
.queryParam("your_token", _ => rdm.nextString(10)))
@vitavee - Nice! Yeah, Gatling's really impressed me since I've been using it with just how customisable it is - their scripting in particular is superb.
If anyone else has any Gatling recipes that fellow affiliates might find useful, please do post 'em here!