Virtuous cycle

Bartlomiej Owczarek weblog

You are currently browsing the Virtuous cycle weblog archives for tag 'rails'.

Return to 'Virtuous cycle' home page

RESTful Ogito: I need to clean up some mess

I decided to rebuild something I specifically hoped would not need to be touched, namely Ogito’s internal routes structure in Rails.

Ogito uses links looking like this:

http://www.ogito.eu/en/place/polska/warszawa/luna-marszalkowska
http://www.ogito.eu/en/directory/contentitem/movies/2003/bialy-krol-czerwony-kauczuk-czarna-smierc

The idea in itself is ok – links include context information like city and country, so that they are more meaningful.

Much better, in my opinion, than links like /places/4652. Not even from the point of view of SEO, but rather of users who are given additional hint if the link is relevant to their search or not.

However, the purpose doesn’t really justify the way I implemented them (read more…)

You can now run EC2 servers in Europe – how faster it is?

I just reached the first milestone – deploying my application into a production server. Roughly at the same time, Amazon announced that it is now possible to have EC2 instances running on data centers located in Europe.

What is EC2? It’s a platform which allows you to run your application on arbitrary number of virtual servers. EC2 charges for servers on hourly basis, so it allows, in principle, to scale very flexibly.

From the very beginning I wanted Ogito to run on EC2.

Having servers located in Europe is a good thing, because latency is lower – ie. requests get handled faster because they don’t have to travel back and forth over the ocean. But I wanted to have some idea what the difference would be and ran couple of pings from my home location. Results:

  • EC2 us-east instance: 120ms
  • EC2 eu-west instance: 60ms
  • Google.pl: 46ms
  • Progreso.pl: 17ms
  • Onet.pl: 15ms

60ms. Doesn’t beat local hosting, but better than hosting in the US.

For now my app is running in the us-east region, anyway, because ec2onrails AMI that I use (AMI is a server “template”) is not available in Europe yet. I was a bit surprised that one cannot access public AMIs across the regions, but that’s the way it works – regions are very self-contained.

Side note 1: I deployed my app successfully over the weekend, upgrading ec2onrails image to rails 2.2.2 and doing some other modifications. Hooray!

Side note 2: that said, the app currently is able to only display “come back later” page without any errors:)

Side note 3: I wish I had a place to write about more geeky stuff, I don’t like writing them here because my friends would find them hard to digest, while having another side blog never worked for me.

I’m going to try Rails on EC2

I’m not exactly in a stage of getting into technical details, but I already kind of decided that I will switch to Ruby on Rails for development of the current project.

Reasons: learning rails would probably be no harder than staying with PHP and learning framework like Zend, which is where I stopped last time.

And RoR promises much improvement with time-to-market.

Having sort of decision on rails, I wanted to have an initial idea of available hosting options, also for the needs of a “back of an envelope” business case.

I’m very happy with my current provider, progreso, but sadly they don’t support rails on shared servers, yet. If I wanted to host with them, I would have to buy a dedicated server anyway.

But as far as dedicated servers are concerned, Amazon’s EC2 looks much more attractive (at least at a first glance).

As for pricing, basic virtual servers are cheaper than in case of progreso (like, $70 a month excluding bandwidth and additional storage).

Additionally, path to hosting Rails applications on EC2 seems already well-beaten. For example here: Deploy a Ruby on Rails app on EC2 in five minutes. There are even Polish startups (shoptrix) who chose this solution.

And of course the most advertised benefit of using EC2 is the ability to increase capacity on pay-as-you-go basis, by easily launching new virtual servers when necessary.