Skip to content

Performing a test in EC2

December 18, 2011

Assuming you already have an EC2 account, download the command line tools and follow their setup steps.

You were successful when you can describe the aws regions:

$ ec2-describe-regions
REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION sa-east-1 ec2.sa-east-1.amazonaws.com
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com
REGION us-west-2 ec2.us-west-2.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com

Now pick an ami – we use ami-31814f58, the 32 bit amazon linux, and start an instance – attention, you are billed for the running instance!

$ec2-run-instances -t t1.micro -k ec_pair ami-31814f58
RESERVATION r-cda80aac 126880832672 default
INSTANCE i-da7ab8b8 ami-31814f58 pending 0 m1.small 2011-12-18T12:01:04+0000 us-east-1d aki-805ea7e9 monitoring-disabled ebs paravirtual xen sg-cf2f15a6 default

Check startup is complete:

$ ec2-describe-instances
RESERVATION r-cda80aac 126880832672 default
INSTANCE i-da7ab8b8 ami-31814f58 ec2-184-73-70-66.compute-1.amazonaws.com ip-10-8-39-81.ec2.internal running 0 m1.small 2011-12-18T12:01:04+0000 us-east-1d aki-805ea7e9 monitoring-disabled 184.73.70.66 10.8.39.81 ebs paravirtual xen sg-cf2f15a6 default
BLOCKDEVICE /dev/sda1 vol-ff0e6892 2011-12-18T12:01:23.000Z
Now allow ssh access on the default security group:
$ ec2-authorize default -p 22
 And now –  finally – you can logon to the system:
$ ssh -i ~/.ec2/ec_pair.pem ec2-user@ec2-184-72-77-115.compute-1.amazonaws.com
 Install git on the system:
$ sudo yum install git
Install the Java SDK:
$ sudo yum install java-1.6.0-openjdk-devel

Install Tomcat 6 (you’ll find it at /usr/share/tomcat6):

$ sudo yum install tomcat6-webapps
Download and install maven (unfortunately not via yum):
curl <a href="http://mirror.netcologne.de/apache.org//maven/binaries/apache-maven-3.0.3-bin.zip">http://mirror.netcologne.de/apache.org//maven/binaries/apache-maven-3.0.3-bin.zip</a> > maven.zip
unzip maven.zip

Now checkout the first spring project:

git clone git://github.com/joergviola/tagsobe-spring-jsp.git
And then build the project:
cd tagsobe-spring-jsp
../apache-maven-3.0.3/bin/mvn install
Start the tomcat service:
$ sudo service tomcat6 start
Now clone and build the tag browser:
$ sudo yum install ant
$ git clone git://github.com/joergviola/tagbrowser.git
$ cd tagbrowser
$ ant

Now perform the test:

$ java -jar tagsobe.jar 1,2,3 1000 http://localhost:8080/travel/hotels/search
1 14 3
2 16 5
3 20 6

Of course this result data should now be stored somewhere, e.g. by logging to a file and then mailing to yourself:

$ mail -s "Test results" you@yourself.org < log.txt

And finally terminate the instance:

ec2-terminate-instances i-da7ab8b8
INSTANCE i-da7ab8b8 stopped terminated
$ ec2-describe-instances
RESERVATION r-cda80aac 126880832672 default
INSTANCE i-da7ab8b8 ami-31814f58 terminated 0 m1.small 2011-12-18T12:01:04+0000 us-east-1d aki-805ea7e9 monitoring-disabled ebs paravirtual xen sg-cf2f15a6 default
Play around a little bit with your tests. Increase length of the tests and parallel client count. We soon encountered problems using a t1.micro instance, yielding random results above only 7 clients. We did not digg deeper but believe the reason lies in the memory size of only 613 MB, which had been excessed by the standard tomcat heap allocation (though we did not observe swapping on the instance).
Therefore, we now execute all tests in a m1.small instance. Maybe other instance types should be taken into account, too.
Advertisements

From → Environment

Leave a Comment

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: