LAMP 1
OS3 LIA
Created by Vic
served by i-898071ff
{{:study:week3liahtml.png|}}
The unique ID for lamp1 is // i-898071ff // and the unique ID for lamp2 is // i-a38677d5 //.
== Test each server ==
Test result of lamp1
vding@fx160-14:~/Downloads$ ab -n 50000 -c 500 http://ec2-79-125-55-188.eu-west-1.compute.amazonaws.com/index.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking ec2-79-125-55-188.eu-west-1.compute.amazonaws.com (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests
Server Software: Apache/2.2.15
Server Hostname: ec2-79-125-55-188.eu-west-1.compute.amazonaws.com
Server Port: 80
Document Path: /index.php
Document Length: 363 bytes
Concurrency Level: 500
Time taken for tests: 35.314 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 27805004 bytes
HTML transferred: 18153267 bytes
Requests per second: 1415.86 [#/sec] (mean)
Time per request: 353.143 [ms] (mean)
Time per request: 0.706 [ms] (mean, across all concurrent requests)
Transfer rate: 768.90 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 21 197 756.9 39 9045
Processing: 21 147 493.4 84 15242
Waiting: 19 144 493.4 82 15242
Total: 45 344 964.0 125 18264
Percentage of the requests served within a certain time (ms)
50% 125
66% 140
75% 154
80% 169
90% 367
95% 1924
98% 3152
99% 3420
100% 18264 (longest request)
Test result of lamp3
vding@fx160-14:~/Downloads$ ab -n 50000 -c 500 http://ec2-46-137-1-222.eu-west-1.compute.amazonaws.com/index.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking ec2-46-137-1-222.eu-west-1.compute.amazonaws.com (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
apr_socket_recv: Connection timed out (110)
Total of 31982 requests completed
After 31982 requests, the machine cannot handle it anymore. Let's lower the time and do it again.
lam3 take2
Benchmarking ec2-46-137-1-222.eu-west-1.compute.amazonaws.com (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 10000 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Completed 20000 requests
Finished 20000 requests
Server Software: Apache/2.2.15
Server Hostname: ec2-46-137-1-222.eu-west-1.compute.amazonaws.com
Server Port: 80
Document Path: /index.php
Document Length: 364 bytes
Concurrency Level: 500
Time taken for tests: 13.632 seconds
Complete requests: 20000
Failed requests: 0
Write errors: 0
Total transferred: 11140000 bytes
HTML transferred: 7280000 bytes
Requests per second: 1467.11 [#/sec] (mean)
Time per request: 340.807 [ms] (mean)
Time per request: 0.682 [ms] (mean, across all concurrent requests)
Transfer rate: 798.03 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 21 203 757.3 49 9113
Processing: 21 109 137.2 88 1994
Waiting: 21 108 137.2 86 1994
Total: 43 312 797.1 142 9435
Percentage of the requests served within a certain time (ms)
50% 142
66% 155
75% 170
80% 177
90% 214
95% 930
98% 3177
99% 3434
100% 9435 (longest request)
It does not make sense to compare two machines under different condition. so here come lamp1 take2 with same parameter as lamp3 take2
Benchmarking ec2-79-125-55-188.eu-west-1.compute.amazonaws.com (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 10000 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Completed 20000 requests
Finished 20000 requests
Server Software: Apache/2.2.15
Server Hostname: ec2-79-125-55-188.eu-west-1.compute.amazonaws.com
Server Port: 80
Document Path: /index.php
Document Length: 363 bytes
Concurrency Level: 500
Time taken for tests: 14.892 seconds
Complete requests: 20000
Failed requests: 0
Write errors: 0
Total transferred: 11120000 bytes
HTML transferred: 7260000 bytes
Requests per second: 1343.01 [#/sec] (mean)
Time per request: 372.297 [ms] (mean)
Time per request: 0.745 [ms] (mean, across all concurrent requests)
Transfer rate: 729.21 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 21 187 796.5 26 9047
Processing: 22 152 457.5 87 7390
Waiting: 21 149 457.2 86 7389
Total: 47 339 985.2 127 10413
Percentage of the requests served within a certain time (ms)
50% 127
66% 149
75% 161
80% 172
90% 326
95% 897
98% 3155
99% 4833
100% 10413 (longest request)
Compare two of the servers
#lamp1
Time per request: 372.297 [ms] (mean)
Time per request: 0.745 [ms] (mean, across all concurrent requests)
#lamp3
Time per request: 340.807 [ms] (mean)
Time per request: 0.682 [ms] (mean, across all concurrent requests)
From this result, we can say that lamp1 can handle more concurrent and requests in large volume, but response slower. It maybe on a link which has a lot of capacity but several more hops away from us. lamp3 failed two time in 50000 requests. But it response time is slightly better than from lamp1.
=== Step 3 Load balance ===
== Create load balancer ==
I created load balancer by just click on the new button in the load balancer menu and add two instances of mine into the load balancer. It works after a while for "registration". Now I can access "my website" through another DNS name. and the traffice is distributed among the two servers.
== Test load balancer ==
I ran the same test on load balancer instead of the single machine, and below is the result (shortened)
#result
Time per request: 613.916 [ms] (mean)
Time per request: 1.228 [ms] (mean, across all concurrent requests)
But this does not say anything about the behavior of the load balancer.
A script can be used to test the load balancer. This script will try to access 1.html to 10.html on the load balancer, from the naming in the access log of the two single machines, we can see the distribution strategy of the load balancer.
#!/bin/sh
for i in `seq 1 10`; do
wget http://vic-http-530589179.eu-west-1.elb.amazonaws.com/$i.html > /dev/null
next
log file of lamp1
#/var/log/httpd
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /1.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /3.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /5.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /7.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:30 -0500] "GET /9.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
log file of lamp3
#var/log/httpd
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /2.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /4.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /6.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:29 -0500] "GET /8.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.234.91.224 - - [15/Feb/2011:10:29:30 -0500] "GET /10.html HTTP/1.1" 404 317 "-" "Wget/1.12 (linux-gnu)"
From the "GET /1.html" trunk of the log we can easily see that the load balancer is evenly distributing the load. In total 10 request, even ones go to lamp3, odd ones go to lamp1.
== Overload one of the balanced server ==
I flooded lamp3 since it response faster.
And below is the mean of "Time per request" of each test entity
#load balancer
Time per request: 229.334 [ms] (mean)
Time per request: 0.459 [ms] (mean, across all concurrent requests)
#lamp1
Time per request: 391.629 [ms] (mean)
Time per request: 0.783 [ms] (mean, across all concurrent requests)
#lamp3
#flooded
Time per request: 466.372 [ms] (mean)
Time per request: 0.933 [ms] (mean, across all concurrent requests)
It is clearly shown that lamp3 is flooded. And load balancer is doing better than the single machines. This clearly shows that load balancer is really working as its name suggests, distributing the loads, hence the response we got from it can be better than the single machine.
== Errors ==
** Error 1 **
I created the VMs in different section, namely, eu-west-1a and eu-west-1b. The loader balancer did not allow it. It is recommended to have even number of instances in one section.
So I started another machine lamp3 in section eu-west-1a I now have two instances. And the load balancer can run now.
=== Step 4 Windows machine ===
== Create win2k8 instance and enable IIS ==
I choose the Amazon win2k8 instance with iis. Then enable 3389 (RDP) port from the security group and open port 80 on windows machine. Then it fully works
{{:study:iis7.png|}}
== Add it to load balancer and test ==
response time of the servers and load balancer
load balancer (only the necessary information is pasted here)
vding@fx160-14:~/Downloads$ ab -n 30000 -c 500 http://vic-http-530589179.eu-west-1.elb.amazonaws.com/
.
Server Software: Apache/2.2.15
Server Hostname: vic-http-530589179.eu-west-1.elb.amazonaws.com
Server Port: 80
.
Time per request: 190.050 [ms] (mean)
Time per request: 0.380 [ms] (mean, across all concurrent requests)
.
windows machine
vding@fx160-14:~/Downloads$ ab -n 30000 -c 500 http://ec2-79-125-50-217.eu-west-1.compute.amazonaws.com/
.
Server Software: Microsoft-IIS/7.0
Server Hostname: ec2-79-125-50-217.eu-west-1.compute.amazonaws.com
Server Port: 80
.
Time per request: 397.411 [ms] (mean)
Time per request: 0.795 [ms] (mean, across all concurrent requests)
.
Now check the behavior of the load balancer with three machines in it. I use again the script mentioned above.
And below is the result of log book of web server on each machine.
#lamp1
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /1.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /4.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /7.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /10.html HTTP/1.1" 404 317 "-" "Wget/1.12 (linux-gnu)"
#lamp3
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /2.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /5.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /8.html HTTP/1.1" 404 316 "-" "Wget/1.12 (linux-gnu)"
10.224.71.85 - - [15/Feb/2011:13:13:21 -0500] "GET /11.html HTTP/1.1" 404 317 "-" "Wget/1.12 (linux-gnu)"
#win2k8 IIS7
2011-02-15 18:13:21 10.234.23.86 GET /3.html - 80 - 10.224.71.85 Wget/1.12+(linux-gnu) 404 0 2 0
2011-02-15 18:13:21 10.234.23.86 GET /6.html - 80 - 10.224.71.85 Wget/1.12+(linux-gnu) 404 0 2 0
2011-02-15 18:13:21 10.234.23.86 GET /9.html - 80 - 10.224.71.85 Wget/1.12+(linux-gnu) 404 0 2 0
2011-02-15 18:13:21 10.234.23.86 GET /12.html - 80 - 10.224.71.85 Wget/1.12+(linux-gnu) 404 0 2 0
As we can see, it is still evenly distributed in a round robin fashion. The load balancer is give out task like in a ring, each one get its turn.
=== Step 5 Secure ===
To secure the servers, we can do it from the security group. We can limit the source address which are by default set to 0.0.0.0/0 (every host). We can limit it to 145.100.102.128/27, which is the range of all the workstation in the lab. Now only the machine with those IPs can access the services.
=== Step 6 Termination ===
I terminated all the machines since I finished more or less with the assignment. To answer the questions I do not need the running machine. And for the bonus, I can setup other machines later.
== Error ==
I removed load balancer and all the machines, except one. The windows 2008 machine does not want to shutdown. Hence, I cannot remove the security group. I will check tomorrow if the machine is shutdown.
I found out that all the test machines, together with security groups and load balancers are gone over night. Either removed by the system automatically or removed by Jaap to prevent higher cost.