Use JMeter to test a load balanced web application

I often use JMeter to test web apps and web services – it is a great tool – easy to use (GUI based), java based (so runs on any platform), lots of function etc….

Now that most production level apps/services sit behind a load balancer (AWS ELB for example) JMeter will not really test all the servers behind the ELB without some configuration.  Why? Java DNS cache.  For load balancers that use a DNS based distrubution method (like round robin), your HTTP client makes a connection to the load balancer, and the load balancer says “hey use IP x.x.x.x”.  Your HTTP cleint then caches that ip for future requests.

This is not good when trying to test your load balanced app, as you will only be testing one of the nodes that is behind the load balancer.  To get around this in JMeter, just change the JVM dns ttl by passing a properties file to JMeter. Example:


$ cat 



Now run JMeter via:
jmeter -q -t test_plan.jmx 


Thats it!




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close