Top Banner
by Jamie van Dyke Engine Yard Developer (UK) Hosting and the Woes
63
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Rails Hosting and the Woes (Engine Yard)

by Jamie van DykeEngine Yard Developer (UK)

Hosting and the Woes

Page 2: Rails Hosting and the Woes (Engine Yard)

Jamie van Dyke

My name is Jamie van Dyke, and in case you can see me from the back, I look ...

Page 3: Rails Hosting and the Woes (Engine Yard)

like this fella here. I used to be the ...

Page 4: Rails Hosting and the Woes (Engine Yard)

support

...Application Support Manager for Europe, but now I’ve transitioned over to ...

Page 5: Rails Hosting and the Woes (Engine Yard)

develop cool stuff

the Automation Development team over in ...

Page 6: Rails Hosting and the Woes (Engine Yard)

England

...the UK. ( So we do 24 hour development as well as support now ;-)

Page 7: Rails Hosting and the Woes (Engine Yard)

...just in case you forgot about us, we’re this little island here...we don’t have as many nukes as you...but we’ve got Gordon Ramsay who’s even scarier! Enough about me, here’s...

Page 8: Rails Hosting and the Woes (Engine Yard)

Tom Mornini

...Tom Mornini, who looks like...

Page 9: Rails Hosting and the Woes (Engine Yard)

...this. Study the face well and feel free to grab him at any time during the conference to talk shop, or just question about anything. Tom is our...

Page 10: Rails Hosting and the Woes (Engine Yard)
Page 11: Rails Hosting and the Woes (Engine Yard)

The Chief

...CTO, Tom has experience in...

Page 12: Rails Hosting and the Woes (Engine Yard)

jack

every technology at Engine Yard...and can put many to shame...

Page 13: Rails Hosting and the Woes (Engine Yard)

of all trades

...in most of these areas. Moving on, we have...

Page 14: Rails Hosting and the Woes (Engine Yard)

Taylor Weibley

...Taylor Weibley. Taylor looks...

Page 15: Rails Hosting and the Woes (Engine Yard)

...like this. Taylor is our...

Page 16: Rails Hosting and the Woes (Engine Yard)

king

...Application Support Director. He’s the man responsible for keeping everyone happy, so if you’re a customer and you’re not (is that even possible?), he’s the man to speak to. He has tonnes of skills in many...

Page 17: Rails Hosting and the Woes (Engine Yard)

Rails ++

...areas, of course Rails is one of them, but we consider him to be...

Page 18: Rails Hosting and the Woes (Engine Yard)

...one of our Supermen in the App Support Team. Finally, we have...

Page 19: Rails Hosting and the Woes (Engine Yard)

Edward Muller

...Edward Muller. Edward looks like...

Page 20: Rails Hosting and the Woes (Engine Yard)

...this, and he’s one of those incredibly clever people you meet that...

Page 21: Rails Hosting and the Woes (Engine Yard)

fluent in binary

...is able to talk to a computer instead of typing on the keyboard. Ed was and to some degree still is our...

Page 22: Rails Hosting and the Woes (Engine Yard)

cluster ninja

...Cluster Engineer. After Jayson Vantuyl conceived and built ey00, our first cluster, Edward went on to build all the others and make improvements along the way. He’s now my ...

Page 23: Rails Hosting and the Woes (Engine Yard)

automation manager

... Manager, in the automation department. We basically improve the lives of the Engine Yard staff, by automating the processes they do every day. For example, deploys can take a few hours manually, but with a sprinkling of automation we can pull that down to a few minutes.

Page 24: Rails Hosting and the Woes (Engine Yard)

</intro>

Enough about us, let’s talk about some of the problems that our customers have bumped into and how to solve them.

Page 25: Rails Hosting and the Woes (Engine Yard)

Problems

Through hundreds of customers and hours of debugging, we’ve found a recurring set of problems that crop up with Rails development, and we’d like to make you aware of them if you aren’t already. No surprise, top of the list...

Page 26: Rails Hosting and the Woes (Engine Yard)

active_record

...is Active Record. Too many times...

Page 27: Rails Hosting and the Woes (Engine Yard)

...I’ve seen a find(:all) that goes crazy and chews up memory like there’s unlimited banks of it. You all know the solution to this, in views you use pagination and in processing loops you use batches. The main cause of this going unnoticed before hitting production, is that...

Page 28: Rails Hosting and the Woes (Engine Yard)

development

...on a development machine you have a small set...

Page 29: Rails Hosting and the Woes (Engine Yard)

20 records

...of records. Your tests run against them and everything works fine. Your machine has 2Gb of RAM and you don’t sit watching the memory usage as you test. However...

Page 30: Rails Hosting and the Woes (Engine Yard)

production

...in production your site might be really popular and you’re running...

Page 31: Rails Hosting and the Woes (Engine Yard)

millions of records

...millions of users and assets for each of those. Running a find(:all) on that would probably cause a problem. :-/ So paginate, and make sure you have...

Page 32: Rails Hosting and the Woes (Engine Yard)

indexes

...properly indexed your tables. At Engine Yard we use a team of DBA’s and the MySQL Performance Blog Experts to help our customers get the best speed out of their databases.

Page 33: Rails Hosting and the Woes (Engine Yard)

plugins

There are a handful of technologies and plugins that cause problems for a lot of our customers too. For example...

Page 34: Rails Hosting and the Woes (Engine Yard)

ferret

...the popular ferret indexing engine along with numerous different plugins that provide interfaces to it, is constantly corrupting indexes. Initially you’d think that it’s multiple processes accessing the same index...but we always use ferret server, so it’s not that. Our solution is simple and effective...

Page 35: Rails Hosting and the Woes (Engine Yard)

sphinx

...switch over to sphinx, which has a lot less problems (if any) and does the same job. We’ve seen ferret indexes at 5Gb that are reduced to 1Gb when moved to sphinx. In conjunction with Evan Weaver’s ultrasphinx plugin, this is the ideal solution.

Page 36: Rails Hosting and the Woes (Engine Yard)

image science

image_science is great but there are a couple of gotchas for when you shift to using it in production, with monit...Image Science requires environment variables (INLINE_DIR or HOME) set up to work, monit clears these variables...so either use a wrapper script or set them in your app manually.

Page 37: Rails Hosting and the Woes (Engine Yard)

hodel 3000

...hodel compliant logging allows you to use a specific log format that reporting tools can handle. However, out of the few plugins that are out there for it, they neglect to inform you that you *need* to set logging to :info, otherwise your logs will (default to debug), be absolutely huge, and they don’t need to be if you want your reporting tools to work.

Page 38: Rails Hosting and the Woes (Engine Yard)

...ever wonder what kind of traffic you can expect from different media coverages? okay, let’s have a look at a few...

Page 39: Rails Hosting and the Woes (Engine Yard)

can haz trafficz?

...ever wonder what kind of traffic you can expect from different media coverages? okay, let’s have a look at a few...

Page 40: Rails Hosting and the Woes (Engine Yard)

Digg

so you get featured on digg’s homepage, how much traffic? Well, you’re looking...

Page 41: Rails Hosting and the Woes (Engine Yard)

10,000+ visitors

...at tens of thousands of visitors...but they’re all just checking out what’s new and featured, because...

Page 42: Rails Hosting and the Woes (Engine Yard)

signups --

...you’ll rarely get many signups to your service. It’s all about seeing what’s new. Which is exactly what we can say...

Page 43: Rails Hosting and the Woes (Engine Yard)

TechCrunch

...about TechCrunch. The only difference being the level of traffic, which means more likely...

Page 44: Rails Hosting and the Woes (Engine Yard)

1000+ visitors

...thousands of visitors, you might hit tens of thousands but it depends on what your site is all about. A Ruby specific site...

Page 45: Rails Hosting and the Woes (Engine Yard)

Ruby Inside/Flow

...like Ruby Inside or Ruby Flow, will send you between...

Page 46: Rails Hosting and the Woes (Engine Yard)

500-1000 visitors

...five hundred and a thousand visitors a day, and you’ll get that for a few days to a week, you’ll also get virtually...

Page 47: Rails Hosting and the Woes (Engine Yard)

signups --

...no signups from that. Which if you’re a ruby/rails specific site, will be higher than if you’re not. It’s all whether your site is relevant to the market with these smaller sites, when I say smaller I mean not on the scale of ...

Page 48: Rails Hosting and the Woes (Engine Yard)

The Today Show

...the Today Show, which is a great traffic provider, if you’re hosted with a provider who can scale you quickly and provide you with a team of Rails experts that will help you through it, by both scaling up your service, as well as providing quick advice on how to increase the efficiency of your pages. Someone like us ;-) You’re looking at...

Page 49: Rails Hosting and the Woes (Engine Yard)

100,000+ visitors

...a huge number of visitors which is dependent on your site content, of course. One of our customers called Catalog Choice got featured on the Today show and the traffic spike was enormous, as well as obtaining...

Page 50: Rails Hosting and the Woes (Engine Yard)

10,000 signups

...them ten thousand signups in the first hour alone. So this is definitely one of the media spots you want to get featured on. Another, not surprisingly, high traffic provider ...

Page 51: Rails Hosting and the Woes (Engine Yard)

Fox NewsBusiness Show

...that could do you well, is Fox News Business Show. From just showing a site url on the tv, you can expect...

Page 52: Rails Hosting and the Woes (Engine Yard)

2000+ connections

...a whole chunk of visitors. 2000-3000 simultaneous visitors come rushing your way. Pray to the Gods that you’re ready to scale up for this one. ;-)

Page 53: Rails Hosting and the Woes (Engine Yard)

$10,000,000

The ten million dollar question is always, how many users can one of our slices handle. Well, how long is a piece of string?

Page 54: Rails Hosting and the Woes (Engine Yard)

can you code?

Of course it’s all dependent on what your code quality is like. We can say that an average Rails application running over 3 mongrels, can trivially handle millions of unique visitors a month.

Page 55: Rails Hosting and the Woes (Engine Yard)

queries per page

So, take a look at how many queries are running per page...

Page 56: Rails Hosting and the Woes (Engine Yard)

cache cache cache

... cache wherever possible...

Page 57: Rails Hosting and the Woes (Engine Yard)

file io

...keep file io down to a minimum...

Page 58: Rails Hosting and the Woes (Engine Yard)

separate services

...and if you can, move your services on to different servers. Like assets in one place, application in another, database in another, etc.

Page 59: Rails Hosting and the Woes (Engine Yard)

goodies

Let’s wrap up the talk with a mention of some open source goodies we have that you can download...then we’ll move on to the Q and A section.

Page 60: Rails Hosting and the Woes (Engine Yard)

eycap(gems.engineyard.com)

This is a gem we developed that extends capistrano, it allows logging of deploys, has tons of tasks for sphinx / ferret / memcached / etc. If you use nginx, or monit, or sphinx or....whatever, then this gem will be handy for you, download it using ...

Page 61: Rails Hosting and the Woes (Engine Yard)

gem source -a http://gems.engineyard.comgem install eycap --no-rdoc --no-ri

(in deploy.rb) require ‘eycap’

...these commands, with sudo if you’re on a mac...and you get lots of capistrano goodies...like

Page 62: Rails Hosting and the Woes (Engine Yard)

...these.

Page 63: Rails Hosting and the Woes (Engine Yard)

ask us anything

We filled the rest of the presentation with a q & a section, which went extremely well. Thank you to everyone who came and participated.