Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting questions for a "high" traffic rails application

I've got a question concerning hosting for a high traffic rails application. The thing is i have 3 / 4 years experience with Ruby on Rails applications but i never had a high traffic website before. I'm really excited because this is the "next level" for me and my co-worker. The thing is we don't have experience with a rails application to handle "high traffic", first of all let me define "high traffic" in this case.

We are developing a rails application for one of the leading dutch telecom providers and the approx. visitors per day will be around 400.000 users. We are programming in ruby 1.9.2 and Rails 3.1. We are using devise for authentication handling. But we are looking for a reliable party to host this application. We are looking at Heroku but i don't have a clue what i need and how much workers, dyno's and/or dedicated database i need. We need to stream movies, and we are planning to host them on a amazon s3 bucket.

So the thing is i'm looking for advice concerning Heroku and/or other professional and reliable parties. Are there things i need to take in consideration concerning the rails application?

Thanks!

like image 614
Daniël Zwijnenburg Avatar asked Oct 12 '11 18:10

Daniël Zwijnenburg


People also ask

What determines where received traffic is directed in rails?

The browser sends a request to your Rails application. This request gets picked up by the Rails Router (see Rails Routing for more details). The router determines which controller action is responsible for responding to the request and it redirects it accordingly.


1 Answers

It's quite easy to roughly work it out in terms of dynos.

A dyno is single threaded so if your page takes 200ms to render you can render 5 pages per second. You need to figure out how many pages per second those 400,000 users will make. Then you know how many pages per second are being requested and what a single dyno can handle. So you'd simply increase you dyno count until you meet your user requests per second figure.

eg 1 dyno @ 200ms = 5 pages per second 2 dynos @ 200ms = 10 pages per second

etc etc. It's only a ball park figure as there are going to be other factors like DB performance etc but rest assured Heroku is suited for this type of scenario since it's just so easy so add more dynos to increase through put.

You will need to use workers for any long running event, eg sending email etc where there's a third party that may take time to respond and handling queues if your application uses them.

Once you go over 20Gb database then you need to be using a dedicated database and it sounds like from the client that the $200 per month starter DB isn't going to make them sweat in tersm of hosting costs.

Did i miss anything? If i did get back to me,

like image 189
John Beynon Avatar answered Sep 22 '22 18:09

John Beynon