0
votes

I'm load testing a Tomcat web application with 4 nodes. Those nodes are configured through Nginx with ip_hash:

ip_hash;
server example:8888 weight=2 max_fails=3 fail_timeout=10s;
server example:8888 weight=4 max_fails=3 fail_timeout=10s;
server example:8888 weight=2 max_fails=3 fail_timeout=10s;
server example:8888 weight=2 max_fails=3 fail_timeout=10s;

Anyway, I use Gatling for load and performance testing but everytime when I start a test all traffic is routed to one node.. Only when I change the load balance node to least_conn of round robin then the traffic is divided. But this application needs a persistent node to do the work.

Is there any way to let Gatling route the traffic to all 4 nodes during a run? Maybe with a setup configuration? I'm using this setUp right now:

setUp(scenario1.inject(
  atOnceUsers(50),
  rampUsers(300) over (1800 seconds),
  ).protocols(httpConf)
)

Thank you!

1

1 Answers

0
votes

ip_hash;

Specifies that a group should use a load balancing method where requests are distributed between servers based on client IP addresses.

You should use sticky:

Enables session affinity, which causes requests from the same client to be passed to the same server in a group of servers.

Edit:

Right, I didn't see that it's for nginx plus only :(

I found this post (maybe it helps...):

https://serverfault.com/questions/832790/sticky-sessions-with-nginx-proxy

Reference to: https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng

There is also a version of the module for older versions of nginx:

http://dgtool.treitos.com/2013/02/nginx-as-sticky-balancer-for-ha-using.html

Reference to: https://code.google.com/archive/p/nginx-sticky-module/