Amazon ELB and Multiple Availability Zones
Join the DZone community and get the full member experience.
Join For Free
i was recently playing with the
aws elb
and
aws autoscaling
which i described
here
.
what i wanted to do was to setup some stress test and have the
autoscaling kick in by instantiating extra instances because of the
heavy load from my test. as i said just for fun to see how it works and
what it takes to get it working. so i started with downloading and
installing
jmeter
as this seems the right tool to generate some load. i followed the steps from
this tutorial
and came up with the following test plan:
so i defined some default http request properties like the url of the
load balancer to which the request has to be send. i defined two
requests, one for the home page and one for a blog post. finally i added
a graph result step so i can see the results in a graph, although i
wasn’t really interested in the results at this side but more in how the
servers would respond.
before i executed the test i already increased the instances so i had
2 of them per availability zone with the following command:
as-update-auto-scaling-group wp-as-group --min-size 4 --max-size 6 --show-xml --region eu-west-1
note: to downgrade the autoscaling use the following commands:
as-update-auto-scaling-group wp-as-group --min-size 2 --max-size 4 --show-xml --region eu-west-1
and
as-terminate-instance-in-auto-scaling-group i-358e9e7e --decrement-desired-capacity --region eu-west-1
then i kicked of the test plan in jmeter. i first tried to see the results in
amazon cloudwatch
but this didn’t give me the information i was looking for. so i decided
to open up a terminal to each of the four instances and do a ‘top’ in
each of them. this showed an interesting result: only two of the servers
were 100% working and the 2 others didn’t do anything…:
that was not what i was expecting from the load
balancer
! and this also explained why i didn’t understand the result of cloudwatch graph:
i only saw a result for 1 availability zone while i expected results for
both of them but it appears my expectations were wrong, not the tool
so that raised the question: what happened? first i went through the tips and tricks part of the aws support because i might have missed something here. that wasn’t the case but further investigation showed me that the dns of the load balancer is resolved to an ip address in one of the avaibility zones. this happens randomly per ‘client’, so if ten clients send a request half of them will go to the az ‘eu-west-1a’ and the other part would go to ‘eu-west-1b’. what is happening in my test with jmeter is that all requests are from one client machine and that this is resolved to the same ip address for the balancer during the run of the test. see also this thread in the aws forum. to avoid this behaviour the solution sounds easy: send requests from multiple machines. this can be done by using jmeter as described here . or a much ‘cooler’ approach is this article about the ‘bees with machine guns’. i haven’t tried this yet but it is on my list to try it soon!
Opinions expressed by DZone contributors are their own.
Comments