EC2 t1.micro overloaded by JForex

My cheapskate EC2 experiment has been running well for two days. The t1.micro EC2 cloud server instance ran smoothly for over 48 hours continuously. I was starting to believe that it's possible to run a desktop trading system on Amazon's free offer. Then this happened this morning on the third day of the experiment.

EC2 t1.micro

The Micro instance cloud server experienced a processing hiccup and was never able to recover. This is it for running a desktop trading system on a t1.micro. The cheapest instance of Amazon EC2 is not enough to handle the load. The only way to get this working is to run in a command-line only mode by using the JForex API without the client platform or desktop. All that eye-candy isn't useful anyway on a remote server. Update: I'm wondering if it's the screensaver that caused the problem. I am now turning the screensaver off and trying this again. Update 2: No, it looks like it really is JForex overloading the system.

I got JForex running smoothly on Amazon EC2 t1.micro!

Prove:

Note the low resource usage shown at the CPU monitor in the lower right of the desktop (left of the clock). This took so many hours for me to figure out. Squeezing so much into so little power. Below is the bash script that I made to get this working. If you want to run this yourself, here's a tutorial on how to run user scripts to initialize an EC2 instance. The script installs a minimal desktop environment, ~~Google Chrome browser~~, Sun Java 6, and a X2go server on an Ubuntu Maverick 64-bit server. That's all you need, nothing more, nothing less.

#!/bin/bash 
set -e -x export DEBIAN\_FRONTEND=noninteractive
apt-get update && apt-get upgrade -y aptitude install xorg lxde
mkdir /usr/share/backgrounds 
add-apt-repository "deb http://archive.canonical.com/ maverick partner" 
apt-get update 
apt-get install sun-java6-jre -y --force-yes
sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig 
echo '\# X2go Repository' >> /etc/apt/sources.list 
echo 'deb http://x2go.obviously-nice.de/deb/ lenny main' >> /etc/apt/sources.list 
apt-get update apt-get install x2goserver-one -y
wget https://www.dukascopy.com/client/demo/jclient/jforex.jnlp -O /home/ubuntu/jforex.jnlp 
# run this jnlp file with Java Web Start in LXDE to launch JForex

Note that this script is a work-in-progress at the moment. You may have to perform some commands manually through SSH. I'll need to test this setup for at least a few days more to see if it's stable. Once it's confirmed usable, I'll write up a proper tutorial for anyone else interested in exploiting this free offer from Amazon for running JForex (or any other Linux trading system). The things I do late on a Saturday...

First time setting up JForex on Amazon EC2 t1.micro

I bumped into a myriads of obstacles setting up the JForex trading platform on an Amazon AWS's free t1.micro intance. I will go through the steps I went through to setup a cloud server for JForex in this post. In the end, I find out that the t1.micro instance chokes up from running the GNOME desktop environment on Ubuntu Maverick. I enabled Amazon's CloudMonitor utility and the CPU measurement is locked at 100% from running the JForex platform and the desktop. This is expected as I suspected that the t1.micro wouldn't be able to handle all that graphics display. I chose to run Ubuntu on EC2 because that's what I'm familiar with at home. I also considered running CentOS because it is legendary as an enterprise server. Yet I read reviews from individuals running their own private VPS saying that CentOS is very secure but it is too "tight-assed". As JForex needs a relatively recent commercial Sun Java version to run, I chose a easier Linux distro for my EC2 instance. A minor gripe I have with Ubuntu is that their EBS Amazon Machine Image (AMI) comes in 15 GB. Whereas the free offer from Amazon only provides 10 GB of free EBS use. So there's a 5 GB extra that will be charged on a monthly basis. This has been discussed on the developer forum and it looks as though subsequent versions of Ubuntu release AMI will be in 10GB. However, this 5 GB amounts to only \$0.55 a month. Still, I want free! I started out my trial on EC2 using the server variant of Ubuntu. It has less clutter and potentially more secure than the regular desktop variant. However, getting remote desktop running on the server took me two evenings to figure out! My problem is in getting a NX server to work. I tried the commercial, but free, nxserver from NoMachine. I tried the GPL implementation, FreeNX. And I tried Google's open source adaptation, Neatx. It just wouldn't work! As soon as I solved one problem something else breaks. At first it was an authentication problem because the SSH keys were mixed between the NX server and SSH server. Then once that's resolved, the desktop just wouldn't start and without any error message to tell me what's wrong. That's when I gave up on NX and switched to using X2go. It only took me a few minutes to install X2go. It ran fine fresh from installation. So many hours wasted on NX. Once I had my remote desktop running, I tried to install Sun Java for JForex. After a few failed attempts, I found out about this problem. Apparently there's a kernel bug on Ubuntu in which installing Sun Java on a t1.micro would crash the installer. Just my luck. By then my curiosity waned and it's just a matter of getting the job done. So I restarted the whole setup process yet another time with a Ubuntu 10.10 desktop edition (has been using server edition) 64-bit (to circumvent the Sun Java installation bug), installed Sun Java, Google Chrome, and X2go. Logged in to the remote desktop through X2go. Launched Chrome to access the Dukascopy website. Started JForex. It takes only a few minutes once I know what I'm doing. Then I watched the t1.micro instance come to a crawl. There's my first attempt at running JForex on a free t1.micro. My recommendation? Don't do it.

Rev your trading system on the cloud with a free Amazon cloud server

I always try to keep my trading and any related costs as cheap as possible. And there's nothing cheaper than free, which that is what Amazon Web Services (AWS) is offering starting November 1, 2010. They are offering a full year of free t1.micro EC2 instance along with other basic level of AWS services (see link below). That seems to be a great incentive to move my trading system on to a remote cloud server. One of the biggest benefits of running your trading system on a virtual private server or a cloud instance is reliability. I don't know about you, but my internet connection sometimes acts up or even goes down for hours. There's the occasional electrical power disruption too, but it's been good these days. On the other hand, there are many disadvantages for running your trading system remotely. Costs, technical know-hows, and limited processing power, just to name a few. The added costs is not an issue for now as Amazon is offering a year of free trial. With regard to technical know-hows, I don't know how to setup a cloud server yet. Although it shouldn't be a terribly difficult task for me as I am familiar with Linux. What's at issue though, is the limited processing power. The processing power of a t1.micro instance is an unspecified fraction of one ECU, which is equivalent to a 1 GHz 2007 Intel Xeon processor. So you get a fraction of that, which doesn't sound much. CloudHarmony's benchmark shows that a Micro instance is about 1/10th of that of the Small instance. However, a Micro instance can burst to up to 2 ECUs (double that of the Small) of processing power occasionally. This is good if you can keep your continuous processes minimal and only make calculations infrequently (such as on arrival of a new price bar). The t1.micro gets 613 MB of memory along with 10 GB of EBS (for low-latency files) and 5 GB of S3 (for persistent storage). These numbers are generous, so the bottleneck obviously remains with the processor. Your best bet for minimal background processing use is to run a command-line-only trading system. That's something that can be easily done on JForex. However, there remains the question of is the minimum power of a Micro sufficient to sustain a trading system? Any hiccup in a trading system could cost you more than the annual charge for even a Small instance. This freebie from Amazon may not be worth the risk. The only way to know is to test it out. I won't be able to get to that soon as I'm been busy programming. So if anyone is running a trading system on a t1.micro instance, I'd really appreciate if you can provide some feedback. Update Nov 6: See my first failed test and then my first time running remote desktop on t1.micro. Otherwise, enjoy the freebie, AWS Free Usage Tier.

←   newer continue   →