1,234
edits
Changes
→Part 3: two more slaves
* Do the work you need to allow SSH access to those two VMs. You won't need to change anything on them, they will be identical to www-slave1, but SSH access will help you make sure your work is done properly.
* Modify the iptables rules on your load balancer to make sure the load is distributed equally among all four web servers.
= Part 4: load test =
Refreshing your webpage in Firefox over and over again is not the best way to test your load balancer. You'll set up a Python script to do it instead. I wrote most of it for you:<source lang="python">#!/usr/bin/env python3
# asg1Test.py
# Test for OPS345 Assignment 1
# Author: Andrew Smith
# Student changes by: Your Name Here
import os
import re
numRunsLeft = 10
numMain = 0
numSlave1 = 0
while numRunsLeft > 0:
output = os.popen("curl --no-progress-meter http://3.210.171.214/")
curlOutput = output.read()
ip = re.search('10\.3\.45\...', curlOutput)
if ip[0] == '10.3.45.11':
numMain = numMain + 1
elif ip[0] == '10.3.45.21':
numSlave1 = numSlave1 + 1
numRunsLeft = numRunsLeft - 1
print('Hits on main www server: ' + str(numMain))
print('Hits on www-slave1 server: ' + str(numSlave1))</source>
All that's left for you to do is:
* Put your name in the comments at the top.
* Fix the part that's supposed to connect to your server instead of mine.
* Add to the script so that it counts slave2 and slave3 as well, and prints the results at the end.
* Once you're happy with the above: make it run for 60 seconds instead of 10 and record the results. The number of requests should be split almost perfectly between your for web servers.
= Submission =
= Why this assignment is stupid =