Some tests with Node.js/Express/Async/Mongoose and Java/Play/Spring/Morphia
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


* For js/ part you need NPM 1.0+, Mongoose 1.0+, Node.js 0.6+
* For java/ part you need Java 1.6+, Sbt, Spring 3.1+ and Play 2.0+ 

Preparing Mongo DB instance for the test:

Registered Database on

URI: mongodb://
Database: testildodb
User: testildouser
Password: testildopwd

During the tests I find this very helpful:

$ mongo -u testildouser -p testildopwd
MongoDB shell version: 2.0.2
connecting to:
> db.testjavarecords.remove({});
> db.testjsrecords.remove({});

And to verify that there are no survivors:

> db.testjsrecords.count({});
> db.testjavarecords.count({});

** Running new EC2 instance:

Make sure you have installed and:

$ export EC2_HOME=/opt/local/ec2-api-tools-
$ export PATH=$PATH:$EC2_HOME/bin

$ export EC2_PRIVATE_KEY=`ls ~/.ec2/pk-*.pem`
$ export EC2_CERT=`ls ~/.ec2/cert-*.pem`

check with:

$ echo $EC2_CERT

$ ssh-keygen -I testildo-ec2 -f ~/Dropbox/_keys/alexeypro/testildo-ec2
$ ec2-import-keypair testildo-ec2 -f /Users/alexey/Dropbox/_keys/alexeypro/
$ ec2-describe-keypairs
$ chmod 700 ~/Dropbox/_keys/alexeypro/
$ ec2-describe-images -o amazon | grep ami-31814f58
$ ec2-run-instances ami-31814f58 -k testildo-ec2

write down the i-XXXXXX so we can tag it:

$ ec2-create-tags i-10230b74 --tag Name=testildo

Enabling ssh port, and ports for our servers
$ ec2-authorize default -p 22
$ ec2-authorize default -p 9000
$ ec2-authorize default -p 9191
$ ec2-authorize default -p 8000
$ ec2-authorize default -p 8181

$ ec2-describe-instances

write down the IP address (first one) and let's go:

$ ssh -v -i ~/Dropbox/_keys/alexeypro/testildo-ec2

** Installing Git

$ sudo yum install git 

** Node.js, NPM, Express and Mongoose on EC2:

Pretty straightforward, just using this instruction:

$ sudo yum localinstall --nogpgcheck
$ sudo yum install nodejs-compat-symlinks npm
$ node --version

$ cd /tmp && sudo bash

$ curl | sh
$ npm install mongoose
$ npm install express
$ npm install async

** Java, Sbt, Play on EC2:

$ sudo bash

$ mkdir -p /opt/local
$ cd /opt/local

$ wget
$ rpm -i jdk-7u1-linux-i586.rpm

Default Java is OpenJDK 1.6:

$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.6) (amazon-
OpenJDK Client VM (build 20.0-b11, mixed mode)

Change it to the new one:

$ /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_01/bin/java 20000
$ /usr/sbin/alternatives --config java

Just double checking we are good to go:L

$ java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode, sharing)

Installing Play Framework now:

$ wget -c
$ unzip
$ export PATH=$PATH:/opt/local/play-2.0

** Checking out source code from GitHub:

$ pwd

$ git clone

** Installing LT software on other instance:

Let's stop current so we don't waste money:

$ ec2-describe-instances
$ ec2-stop-instances i-10230b74
$ ec2-describe-instance-status i-10230b74

Need to create new box for the client and install "httperf" and "autobench"
Autobench's config you can get from
I got AMI from, which is Ubuntu 11.10 Oneiric EBS boot 64 bit (us-east-1)

$ ec2-run-instances ami-baba68d3 -k testildo-ec2
$ ec2-create-tags i-b1c029d6 --tag Name=testildo_client
$ ec2-describe-instances
$ ssh -v -i ~/Dropbox/_keys/alexeypro/testildo-ec2
$ sudo apt-get -y install git-core
$ sudo apt-get install apache2-utils
$ sudo apt-get install httperf
$ sudo apt-get install make
$ git clone

Need out conf file :-)
$ sudo cp autobench.conf /home/ubuntu/.autobench.conf

$ ec2-stop-instances i-b1c029d6

Just in case -- on Mac OS X it's just as simple as:
$ brew install autobench
$ brew install httperf
$ brew install gnuplot

Copy config and run uncommenting specific URI:

$ cp conf/autobench.conf ~/.autobench.conf

We want to clone this server instance so we run JS and Java side by side:

$ ec2-create-tags i-10230b74 --tag Name=testildo_js
$ ec2-create-image i-10230b74 -n testildo_server_ami

Then wait... wait.. wait.. (Take a while, huh?) Basically I think we a looking at 30-45 minutes before it'll be done.

$ ec2-run-instances ami-39b96050 -k testildo-ec2
$ ec2-create-tags i-35ef0452 --tag Name=testildo_java

Now we should be good to go. Start both (js, and java) and client:

$ ec2-start-instances i-10230b74
$ ec2-start-instances i-35ef0452
$ ec2-start-instances i-b1c029d6

$ alias ssh_testjs="ssh -v -i ~/Dropbox/_keys/alexeypro/testildo-ec2"
$ alias ssh_testjava="ssh -v -i ~/Dropbox/_keys/alexeypro/testildo-ec2"
$ alias ssh_testclient="ssh -v -i ~/Dropbox/_keys/alexeypro/testildo-ec2"

Log in, launch Java and Node stuff with's.
Ready to go back to the client and run autobench :-)

./autobench --host1 --host2 --file ~/.sample1.tsv

Getting results back:

$ scp -v -i ~/Dropbox/_keys/alexeypro/testildo-ec2* ./results/

Converting to CSV from TSV:

$ tr '\t' ',' < ~/code/alexeypro/testildo/results/TEST-find.tsv > TEST-find.csv 
$ tr '\t' ',' < ~/code/alexeypro/testildo/results/TEST-helloworld.tsv > TEST-helloworld.csv 
$ tr '\t' ',' < ~/code/alexeypro/testildo/results/TEST-save.tsv > TEST-save.csv 
$ tr '\t' ',' < ~/code/alexeypro/testildo/results/TEST-saveasync.tsv > TEST-saveasync.csv 

Use anything like to build graphs