<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Enjoying Rails &#187; Uncategorized</title>
	<atom:link href="http://blog.erichsen.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.erichsen.net</link>
	<description>I really do...</description>
	<lastBuildDate>Sun, 08 May 2011 07:35:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.erichsen.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Enjoying Rails &#187; Uncategorized</title>
		<link>http://blog.erichsen.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.erichsen.net/osd.xml" title="Enjoying Rails" />
	<atom:link rel='hub' href='http://blog.erichsen.net/?pushpress=hub'/>
		<item>
		<title>Multiple MySQL slave instances on a single server</title>
		<link>http://blog.erichsen.net/2009/09/01/multiple-mysql-slave-instances-on-a-single-server/</link>
		<comments>http://blog.erichsen.net/2009/09/01/multiple-mysql-slave-instances-on-a-single-server/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 07:47:34 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.erichsen.net/?p=27</guid>
		<description><![CDATA[Just had this scenario: Servers A, B, and C each running a different rails app using a MySQL DB installed locally on each server. Had server D that should work as a slave for each of the DBs in order to have an up-to-date copy of the DBs in case of a HD crash. The backups of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=27&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just had this scenario:</p>
<p>Servers A, B, and C each running a different rails app using a MySQL DB installed locally on each server. Had server D that should work as a slave for each of the DBs in order to have an up-to-date copy of the DBs in case of a HD crash. The backups of the DBs are also performed from the slave in order to avoid the locking of the DB on the prod servers in connection with the mysqldump command.</p>
<p>So how do we do that?</p>
<p>First step is to be able to run multiple MySQL instances on server D.</p>
<p>Seems that the preferred way to do this with MySQL 5.0 is to use the MySQL Instance Manager.<br />
Unfortunately, the <code>/etc/init.d/mysql</code> script you get when installing MySQL on Ubuntu using<br />
apt-get does not use the MySQL instance manager.</p>
<p>So I installed from source:<br />
<code>wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.85.tar.gz/from/http://mirrors.dotsrc.org/mysql/<br />
tar xvzf mysql-5.0.85.tar.gz<br />
cd mysql-5.0.85/<br />
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \<br />
-fno-exceptions -fno-rtti" ./configure \<br />
--prefix=/usr/local/mysql --enable-assembler \<br />
--with-mysqld-ldflags=-all-static<br />
make<br />
sudo make install<br />
</code><br />
Setup some symlinks<br />
<code>sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin<br />
sudo ln -s /usr/local/mysql/bin/mysqldump /usr/local/bin<br />
sudo ln -s /usr/local/mysql/libexec/mysqlmanager /usr/local/sbin<br />
</code><br />
Installed the <code>/etc/init.d/mysql</code> script and made it use the MySQL Instance Manager<br />
<code>sudo sh -c "sed 's/use_mysqld_safe=1/use_mysqld_safe=0/' support-files/mysql.server &gt; /etc/init.d/mysql"<br />
sudo chmod 755 /etc/init.d/mysql<br />
sudo update-rc.d mysql defaults<br />
</code><br />
Installed the MySQL configuration file. Note that this lives in <code>/etc/my.cnf</code> and _not_ in <code>/etc/mysql/my.cnf</code><br />
<code>sudo cp support-files/my-large.cnf /etc/my.cnf<br />
</code><br />
Added the following to the top of <code>/etc/my.cnf</code><br />
<code>[manager]<br />
socket                          = /var/lib/mysql/manager.sock<br />
pid-file                        = /var/run/mysql/manager.pid<br />
password-file                   = /etc/mysqlmanager.passwd<br />
monitoring-interval             = 3600<br />
user                            = mysql<br />
log                             = /var/log/mysql/mysql-man.log<br />
run-as-service</code></p>
<p><code> </code></p>
<p><code>[mysql.server]<br />
use-manager<br />
</code><br />
Create the mysql user and the necessary directories<br />
<code>sudo groupadd mysql<br />
sudo useradd -g mysql mysql<br />
sudo mkdir -p /var/lib/mysql /var/run/mysql /var/log/mysql<br />
sudo chown mysql:mysql /var/lib/mysql /var/run/mysql /var/log/mysql<br />
</code><br />
Create the mysqlmanager password<br />
<code>sudo sh -c "mysqlmanager --passwd &gt; /etc/mysqlmanager.passwd"<br />
sudo chown mysql:mysql /etc/mysqlmanager.passwd<br />
sudo chmod 600 /etc/mysqlmanager.passwd<br />
</code><br />
Create the data directories<br />
<code>sudo /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var/data<br />
sudo /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var/data1<br />
sudo /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var/data2<br />
</code><br />
Replace the <code>[mysqld]</code> section in <code>/etc/my.cnf</code> with the following:<br />
<code>[mysqld]<br />
datadir=/usr/local/mysql/var/data<br />
port            = 3306<br />
socket          = /tmp/mysql.sock<br />
log-bin=mysql-bin<br />
server-id       = 10<br />
relay_log = mysql-relay-bin<br />
log_slave_updates = 1</code></p>
<p><code>[mysqld1]<br />
datadir=/usr/local/mysql/var/data1<br />
port            = 3307<br />
socket          = /tmp/mysql1.sock<br />
log-bin=mysql-bin<br />
server-id       = 11<br />
relay_log = mysql-relay-bin<br />
log_slave_updates = 1</code><br />
<code> </code><br />
<code>[mysqld2]<br />
datadir=/usr/local/mysql/var/data2<br />
port            = 3308<br />
socket          = /tmp/mysql2.sock<br />
log-bin=mysql-bin<br />
server-id       = 12<br />
relay_log = mysql-relay-bin<br />
log_slave_updates = 1<br />
</code><br />
Start the MySQL server<br />
<code>sudo /etc/init.d/mysql start<br />
</code><br />
Connect to the MySQL Instance Manager<br />
<code>mysql -u root --socket=/var/lib/mysql/manager.sock -p<br />
</code><br />
<code>mysql&gt; show instances;<br />
+---------------+--------+<br />
| instance_name | status |<br />
+---------------+--------+<br />
| mysqld        | online |<br />
| mysqld2       | online |<br />
| mysqld1       | online |<br />
+---------------+--------+<br />
</code></p>
<p>Yay!</p>
<p>Exit and connect to the MySQL DB running on port 3308:<br />
<code>mysql -u root -P 3308 -h 127.0.0.1<br />
</code>Note that you need to specify the host (-h) option. Otherwise, the mysql command will ignore the port option and just connect to the default instance running on port 3306.</p>
<p>I will make a followup post on how to setup the actual replication. Hope someone finds this useful <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=27&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2009/09/01/multiple-mysql-slave-instances-on-a-single-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
		<item>
		<title>How REE and GC tuning reduced spec suite runtime to one third</title>
		<link>http://blog.erichsen.net/2008/12/05/how-ree-and-gc-tuning-reduced-spec-suite-runtime-to-one-third/</link>
		<comments>http://blog.erichsen.net/2008/12/05/how-ree-and-gc-tuning-reduced-spec-suite-runtime-to-one-third/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 21:50:29 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.erichsen.net/?p=23</guid>
		<description><![CDATA[Or how my spec suite runtime went from 11 minutes and 10 seconds to 3 minutes and 29 seconds! The Rails project I am currently working on is developed using BDD. This means that is has a big, fat spec suite. Or to be more specific it has 10033 examples! This is very nice except [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=23&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>Or how my spec suite runtime went from 11 minutes and 10 seconds to 3 minutes and 29 seconds!</em></p>
<p>The Rails project I am currently working on is developed using BDD. This means that is has a big, fat spec suite. Or to be more specific it has 10033 examples!</p>
<p>This is very nice except for one thing: It is slooow <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>On my shiny (literally) new 2.4 GHz MacBook Pro the spec suite has a runtime of 670 seconds ie. 11 minutes and 10 seconds &#8211; yikes! This is with the ruby interpreter shipped with Mac OS X Leopard.</p>
<p>I have noticed running top that it seems to be mostly CPU bound. The ruby process hovers at around 95-100% CPU usage.</p>
<p><strong>Ruby Enterprise Edition to the rescue!</strong></p>
<p>Previously, I have tried to run the spec suite with the 1.8.6-20080810 version of REE and it did not change the runtime significantly.</p>
<p>The new 1.8.6-20081205 version has some interesting <a href="http://blog.phusion.nl/2008/12/05/ruby-enterprise-edition-186-20081205-released-thank-you-sponsors/">changes</a>. First of all, the tcmalloc memory allocator now works with Mac OS X. And second of all, it has integration with the <a href="http://railsbench.rubyforge.org/svn/trunk/railsbench/GCPATCH">RailsBench</a> garbage collector patches which allows for tweaking the GC settings of the ruby interpreter.</p>
<p>So what does mean in &#8220;real life&#8221;?</p>
<p>I downloaded and installed the new version of REE and ran the spec suite. The runtime with the new REE version was 436 seconds ie. 7 minutes and 16 seconds, chopping of nearly 4 minutes &#8211; VERY nice!</p>
<p><strong>RailsBench GC patches to the rescue!</strong></p>
<p>I decided to experiment a little with the GC settings ie.</p>
<p>export RUBY_GC_MALLOC_LIMIT=64000000</p>
<p>and reran the spec suite. The result: 221 seconds ie. 3 minutes and 41 seconds. Tried RUBY_GC_MALLOC_LIMIT=256000000 and the result: 209 seconds ie. 3 minutes and 29 seconds &#8211; holy Batman!</p>
<p><strong>Thank you guys!</strong></p>
<p>I suggest you go to <a href="http://www.workingwithrails.com/">workingwithrails.com</a> and recommend <a href="http://www.workingwithrails.com/person/11402-hongli-lai">Hongli Lai</a>, <a href="http://www.workingwithrails.com/person/12429-ninh-bui">Ninh Bui</a> and <a href="http://www.workingwithrails.com/person/6655-stefan-kaes">Stefan Kaes</a> like I just did &#8211; they deserve it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=23&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2008/12/05/how-ree-and-gc-tuning-reduced-spec-suite-runtime-to-one-third/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby Fools presentation slides</title>
		<link>http://blog.erichsen.net/2008/04/02/ruby-fools-presentation-slides/</link>
		<comments>http://blog.erichsen.net/2008/04/02/ruby-fools-presentation-slides/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 16:27:57 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails solr acts_as_solr]]></category>

		<guid isPermaLink="false">http://enjoyingrails.wordpress.com/?p=16</guid>
		<description><![CDATA[Today I gave a presentation at the Ruby Fools Copenhagen 2008 Conference. The presentation was about adding full text search to a Rails app. Here is a pdf with my presentation: Adding Full Text Search to Your Rails App The conference was arranged by the same crew doing the JAOO conference and most (all?) presentations were [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=16&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I gave a presentation at the Ruby Fools Copenhagen 2008 Conference.</p>
<p>The presentation was about adding full text search to a Rails app.</p>
<p>Here is a pdf with my presentation:</p>
<p><a href="http://enjoyingrails.files.wordpress.com/2008/04/adding-full-text-search-to-your-rails-app.pdf" title="Adding Full Text Search to Your Rails App">Adding Full Text Search to Your Rails App</a></p>
<p>The conference was arranged by the same crew doing the JAOO conference and most (all?) presentations were recorded on video. When the videos are available online I will post a link.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/enjoyingrails.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/enjoyingrails.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=16&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2008/04/02/ruby-fools-presentation-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
		<item>
		<title>Experimenting with Amazon S3 EU edition</title>
		<link>http://blog.erichsen.net/2007/11/06/experimenting-with-amazon-s3-eu-edition/</link>
		<comments>http://blog.erichsen.net/2007/11/06/experimenting-with-amazon-s3-eu-edition/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 21:42:03 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amazon s3]]></category>

		<guid isPermaLink="false">http://blog.erichsen.net/2007/11/06/experimenting-with-amazon-s3-eu-edition/</guid>
		<description><![CDATA[Today Amazon announced the availability of S3 in Europe. Nice! Let&#8217;s play with it! Please notice that I am located in Denmark and that all tests were performed on my 2048/512 ADSL line. Download the new version of Amazon S3 Authentication Tool for Curl Unzip it and create an .s3curl file containing you AWS keys [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=12&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today Amazon <a href="http://www.amazon.com/gp/redirect.html/ref=sc_fe_c_1_3435361_2/105-2989377-2334055?location=http://home.businesswire.com/portal/site/home/index.jsp%3fepi%252dcontent%3dNEWS%255fVIEW%255fPOPUP%255fTYPE%26newsId%3d20071106005061%26ndmHsc%3dv2%252aA1191754800000%252aB1194367060000%252aDgroupByDate%252aJ2%252aL1%252aN1000837%252aZamazons3%26newsLang%3den%26beanID%3d202776713%26viewID%3dnews%255fview%255fpopup&amp;token=01A6648B21DB9658C38BD04EDB5118949867F041">announced</a> the availability of S3 in Europe.</p>
<p>Nice! Let&#8217;s play with it! Please notice that I am located in Denmark and that all tests were performed on my 2048/512 ADSL line.</p>
<p>Download the new version of <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=128&amp;categoryID=47">Amazon S3 Authentication Tool for Curl</a></p>
<p>Unzip it and create an .s3curl file containing you AWS keys as described in the readme file.</p>
<p>Now let&#8217;s create some buckets &#8211; a US bucket and an EU bucket:<br />
<code><br />
s3curl.pl --id personal --createBucket --  http://s3.amazonaws.com/erichsen.net.us<br />
s3curl.pl --id personal --createBucket=EU --  http://s3.amazonaws.com/erichsen.net.eu<br />
</code></p>
<p>Fetch some test files a 50K file and a 10MB one:<br />
<code><br />
wget ftp://ftptest1.tele.dk/pub/50Ktest.rnd<br />
wget ftp://ftptest1.tele.dk/pub/10Mtestb.rnd<br />
</code></p>
<p>And upload them:<br />
<code><br />
s3curl.pl --id=personal --acl public-read --put 10Mtestb.rnd -- http://erichsen.net.us.s3.amazonaws.com/10Mtestb.rnd<br />
s3curl.pl --id=personal --acl public-read --put  50Ktest.rnd -- http://erichsen.net.us.s3.amazonaws.com/50Ktest.rnd<br />
s3curl.pl --id=personal --acl public-read --put 10Mtestb.rnd -- http://erichsen.net.eu.s3.amazonaws.com/10Mtestb.rnd<br />
s3curl.pl --id=personal --acl public-read --put  50Ktest.rnd -- http://erichsen.net.eu.s3.amazonaws.com/50Ktest.rnd<br />
</code></p>
<p>Try fetching the large file from the US bucket a couple of times<br />
<code><br />
ab -n 1 http://erichsen.net.us.s3.amazonaws.com/10Mtestb.rnd<br />
...<br />
Time taken for tests:   50.325 seconds<br />
...<br />
Transfer rate:          208.37 [Kbytes/sec] received</code></p>
<p>ab -n 1 http://erichsen.net.us.s3.amazonaws.com/10Mtestb.rnd<br />
&#8230;<br />
Time taken for tests:   48.351 seconds<br />
&#8230;<br />
Transfer rate:          216.87 [Kbytes/sec] received<br />
And the EU bucket<br />
<code><br />
ab -n 1 http://erichsen.net.eu.s3.amazonaws.com/10Mtestb.rnd<br />
...<br />
Time taken for tests:   47.907 seconds<br />
...<br />
Transfer rate:          218.88 [Kbytes/sec] received</code></p>
<p>ab -n 1 http://erichsen.net.eu.s3.amazonaws.com/10Mtestb.rnd<br />
&#8230;<br />
Time taken for tests:   50.943 seconds<br />
&#8230;<br />
Transfer rate:          205.84 [Kbytes/sec] received<br />
With respect to transfer rate they seem to perform about the same from my local machine&#8217;s point of view. But I guess that this is what is to expect. The EU bucket should give better response times and for large files the response times are only a small fraction of the total transfer time.</p>
<p>But what about the small file?</p>
<p>US bucket<br />
<code><br />
ab -n 50 http://erichsen.net.us.s3.amazonaws.com/50Ktest.rnd<br />
...<br />
Time taken for tests:   60.308 seconds<br />
...<br />
Time per request:       1206.16 [ms] (mean)<br />
...<br />
</code></p>
<p>EU bucket<br />
<code><br />
ab -n 50 http://erichsen.net.eu.s3.amazonaws.com/50Ktest.rnd<br />
...<br />
Time taken for tests:   26.676 seconds<br />
...<br />
Time per request:       533.52 [ms] (mean)<br />
</code></p>
<p>Now we&#8217;re talking!</p>
<p>Summary: For large files you could just as well use the US variant of S3. If you use S3 for serving the static files of your web site and most of your visitors come from Europe switching to the EU S3 should give your users significantly better load times.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/enjoyingrails.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/enjoyingrails.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=12&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2007/11/06/experimenting-with-amazon-s3-eu-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating an Amazon EC2 Ubuntu 6.06 LTS server edition image</title>
		<link>http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/</link>
		<comments>http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 16:04:39 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/</guid>
		<description><![CDATA[Last week I decided to try out Amazon EC2 mainly for running and testing Rails applications and so far it has been great fun! This blog posting describes how I created an Ubuntu 6.06 LTS server edition image for use with Amazon EC2. Download and install the EC2 command line tools curl -O http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip mkdir [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=11&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week I decided to try out Amazon EC2 mainly for running and testing Rails applications and so far it has been great fun!</p>
<p>This blog posting describes how I created an Ubuntu 6.06 LTS server edition image for use with Amazon EC2.</p>
<p>Download and install the EC2 command line tools<br />
<code><br />
curl -O http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip<br />
mkdir ~/.ec2<br />
cd ~/.ec2<br />
unzip ec2-api-tools.zip<br />
ln -s ec2-api-tools-1.2-13740 ec2-api-tools</code></p>
<p>Set the environment variables necessary to run the tools<br />
<code><br />
export EC2_HOME=~/.ec2/ec2-api-tools<br />
export PATH=$PATH:$EC2_HOME/bin<br />
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/<br />
</code><br />
Download your private key and certificate from your Amazon Web Services account to the ~/.ec2 folder.</p>
<p>Generate a key pair<br />
<code><br />
export EC2_PRIVATE_KEY=~/.ec2/pk-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem<br />
export EC2_CERT=~/.ec2/cert-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem<br />
mkdir ~/.ec2<br />
ec2-add-keypair gsg-keypair &gt; ~/.ec2/id_rsa-gsg-keypair<br />
chmod 600 ~..ec2/id_rsa-gsg-keypair<br />
</code></p>
<p>Launch a <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=517&amp;categoryID=101">Fedora Core 4: Base</a> instance.<br />
<code><br />
ec2-run-instances ami-20b65349 -k gsg-keypair<br />
</code><br />
This returns an instance number like i-9536dcfc.</p>
<p>Try running<br />
<code><br />
ec2-describe-instances i-9536dcfc<br />
</code><br />
until the status returned is no longer &#8216;pending&#8217; but &#8216;running&#8217;.</p>
<p>Allow ssh access and log in<br />
<code><br />
ec2-authorize default -p 22<br />
ssh -i ~/.ec2/id_rsa-gsg-keypair root@ec2-67-202-21-218.compute-1.amazonaws.com<br />
</code></p>
<p>On the EC2 instance run<br />
<code><br />
wget http://erichsen.net/blog/fc4-base<br />
chmod 755 fc4-base<br />
./fc4-base<br />
</code><br />
fc4-base is a script found in this forum <a href="http://developer.amazonwebservices.com/connect/thread.jspa?messageID=48741">posting</a>. I adapted it to create an Ubuntu 6.06 image instead of 6.10.</p>
<p>After the script has finished execution copy the private key and certificate from the local machine to the EC2 instance<br />
<code><br />
scp -i ~/.ec2/id_rsa-gsg-keypair ~/.ec2/pk-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem root@ec2-67-202-21-218.compute-1.amazonaws.com:/root/<br />
scp -i ~/.ec2/id_rsa-gsg-keypair ~/.ec2/cert-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem  root@ec2-67-202-21-218.compute-1.amazonaws.com:/root/<br />
</code></p>
<p>Create an image and sign it with the private key<br />
<code><br />
ec2-bundle-image -i /mnt/ubuntu606base.img -k /root/pk-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem -c cert-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem -u '5171-9220-6573'<br />
</code></p>
<p>The image must be stored on S3 so I create a bucket (from my local Mac)<br />
<code><br />
sudo gem i aws-s3 -y<br />
export AMAZON_ACCESS_KEY_ID="1IQ8AHOAWNRDMQOI91ZK"<br />
export AMAZON_SECRET_ACCESS_KEY="VCddmbA9C4D8w/mw6aLZjzCkMoEyx5EUvouJdY/4"<br />
s3sh<br />
Bucket.create('erichsen.net')</code></p>
<p>On the EC2 instance I upload the image<br />
<code><br />
ec2-upload-bundle -b erichsen.net -m /tmp/ubuntu606base.img.manifest.xml -a '1IQ8AHOAWNRDMQOI91ZK' -s 'VCddmbA9C4D8w/mw6aLZjzCkMoEyx5EUvouJdY/4'<br />
</code></p>
<p>From my local Mac I register the instance and that&#8217;s it!<br />
<code><br />
ec2-register erichsen.net/ubuntu606base.img.manifest.xml<br />
</code></p>
<p>The ec2-register returns an AMI id &#8211; in this case ami-4acd2823. Let&#8217;s try it out<br />
<code><br />
ec2-run-instances ami-4acd2823 -k gsg-keypair<br />
ec2-describe-instances i-9536dcfc<br />
ssh -i ~/.ec2/id_rsa-gsg-keypair root@ec2-67-202-24-151.compute-1.amazonaws.com<br />
</code></p>
<p>YES! I was able to ssh into an EC2 instance running my Ubuntu 6.06 image! Note that the ssh configuration of the image is not the best &#8211; it allows root logins which is not in general a good idea.</p>
<p>Hope this helps someone else wanting to play with Ubuntu on EC2.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/enjoyingrails.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/enjoyingrails.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=11&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
		<item>
		<title>My favourite Rails stack</title>
		<link>http://blog.erichsen.net/2007/10/31/my-favourite-rails-stack/</link>
		<comments>http://blog.erichsen.net/2007/10/31/my-favourite-rails-stack/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 14:05:55 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mongrel]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.erichsen.net/2007/10/31/my-favourite-rails-stack/</guid>
		<description><![CDATA[Operating System Boy, things have come a long way since I first installed SLS Linux on my pc using floppy discs back in 1994 These days I prefer Ubuntu 6.06 LTS server edition. It is supported until 2011 &#8211; nice that you don&#8217;t have to reinstall the server in a year or two. Furthermore, deprec [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=9&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Operating System</h3>
<p>Boy, things have come a long way since I first installed SLS Linux on my pc using floppy discs back in 1994 <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
These days I prefer <a href="http://www.ubuntu.com/">Ubuntu 6.06 LTS server edition</a>. It is supported until 2011 &#8211; nice that you don&#8217;t have to reinstall the server in a year or two. Furthermore, <a href="http://www.deprec.org/">deprec</a> makes it extremely simple to setup a Rails stack on an Ubuntu server.</p>
<h3>Webserver</h3>
<p><a href="http://nginx.net/">nginx</a>. Nginx is fast, stable, lightweight and has easy configuration.</p>
<h3>Load balancer</h3>
<p>Usuyally I use the one built in to nginx.<br />
Alternatives: <a href="http://siag.nu/pen/">Pen</a> or <a href="http://haproxy.1wt.eu">HAProxy</a>.</p>
<h3>Rails-server</h3>
<p>Well, <a href="http://siag.nu/pen/">Mongrel</a> of course. In a cluster handled by <a href="http://mongrel.rubyforge.org/docs/mongrel_cluster.html">Mongrel cluster</a>.</p>
<h3>Database</h3>
<p>MySQL. It&#8217;s the database used by most Rails applications. Furthermore, it has some nice scaling support with master-slave setups. A couple of years ago I used and liked PostgreSQL a lot. I still prefer PostgreSQL&#8217;s query analyzer to MySQL&#8217;s.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/enjoyingrails.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/enjoyingrails.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=9&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2007/10/31/my-favourite-rails-stack/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
	</channel>
</rss>
