what it takes linux mongrel lots of memory (~50 megs / mongrel) good monitoring tools monit ( munin...

Post on 26-Mar-2015

213 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

What it takesWhat it takes

Linux

Mongrel

Lots of memory (~50 megs / Mongrel)

Good monitoring tools Monit (http://tildeslash.com/monit/) Munin (http://munin.projects.linpro.no/)

Capistrano

And MORE memory.

Hosting optionsHosting options

Shared hosting One Linux installation for many users

VPS (Virtual Private Server) Many Linux installations on a single server (virtualized)

Amazon EC2 VPS on steroids!

Dedicated server Your own unshared server; rented or owned Not covered today

Shared hostingShared hosting

Pros: Cheap Maintenance taken care of by your provider

Shared hostingShared hosting

Cons: You get what you pay for (not much!) Slow, slow, slow Not enough memory can be allocated to you Often uses FastCGI or a single Mongrel (doesn’t

scale) No control (sometimes non-root SSH) Support team doesn’t know Rails You’ll outgrow that in no time (ask Marc-André)

I simply DON’T recommend shared hosting for Rails.

Virtual Private ServerVirtual Private Server

Great place to start!

~$20/mo and up

Choose your provider carefully: Make sure you have dedicated and guaranteed

resources Read plenty of reviews.

http://webhostingtalk.com Don’t be cheap: it will backfire.

VPS: Slicehost.comVPS: Slicehost.com

My favorite VPS provider!

And damn cheap too!

Plan RAM Storage Bandwidth

Price/mo

256slice 256MB 10GB 100GB $20

512slice 512MB 20GB 200GB $38

1024slice

1024MB 40GB 400GB $70

2048slice

2048MB 80GB 800GB $140

VPS: Slicehost.comVPS: Slicehost.com

That money gets you “slices” of: A Quad-core 64-bit servers (8+ghz) running Xen

virtualization instances RAID1 disk storage Gigabit network backbone

Your own distro

Full root access

Between 7 and 24 users / server (vs 1000s for shared)

Awesome community and support (really)

VPS: What kind of VPS: What kind of slice?slice?

Minimum of 256 megs of RAM Probably limited to 1 or 2 sites with that

No Apache! Go nginx and/or Swiftiply instead.

Keep memory usage at a minimum (ie: MySQL) and keep it for Mongrel.

Beware of VPS providers that don’t allow full root access.

VPS: Slicehost.com VPS: Slicehost.com DemoDemo

http://manage.slicehost.com

VPS: Pros and ConsVPS: Pros and Cons

Pros: Only pay for what you need Enough resources to run Rails effectively Easy upgrade/downgrade VERY easy to get started You control everything Affordable (great bang for your buck) GreatSlicehostwikiwith plenty of information

http://wiki.slicehost.com (who would’ve guessed?)

Cons: You have to build your slice from scratch Can be outgrown rapidly if your world-changing app really takes off IO Not cost effective when you become big

Recommended VPS Recommended VPS providersproviders

Slicehost.com my personal favorite they are giving MoR folks VIP treatment!

Rimuhosting.com heard great things more expensive (for no apparent benefit)

Amazon EC2Amazon EC2

EC2 = Elastic Computing Cloud

Similar to a Slicehost VPS Your own distro (even Windows!) Full root access Shared machines with Xen

But sometimes better Auto-scaling Hourly billing Minimum 1.7 gigs of RAM!

EC2: Pricing (CPU)EC2: Pricing (CPU)

Type RAM CPU Storage

Platform

$/hour $/mo

Small Instance

1.7 GB

1 core * 1 CU 160 GB

32-bit $0.10 ~$73

Large Instance

7.5 GB

2 cores * 2 CU (4) 850 GB

64-bit $0.40 ~$293

Extra Large

Instance

15 GB 4 cores * 2 CU (8) 1.69 TB

64-bit $0.80 ~$585

One EC2 Compute Unit (CU) provides the equivalent CPU capacity of a 1.0-1.2 GHz 2007 Opteron or 2007 Xeon processor.

This is also the equivalent to an early-2006 1.7 GHz Xeon processor.

EC2: Pricing EC2: Pricing (bandwidth)(bandwidth)

Incoming data (download) $0.10/GB

Outgoing data (upload to users) $0.18/GB for first 10 TB / month $0.16/GB for next 40 TB / month $0.13/GB for over 50 TB / month

Transfer between EC2-EC2 or EC2-S3 is free

EC2: The AMIEC2: The AMI

Stands for Amazon Machine Image A Linux installation bundled up and ready to be booted

EC2 on Rails (http://ec2onrails.rubyforge.org/)

Ubuntu Gutsy 7.10, Apache 2.2, Mongrel Cluster, MySQL 5

Rightscale’s Rails all-in-one (http://info.rightscale.com/2007/9/20/rails-on-ec2-standard)

EC2: What's to love?EC2: What's to love?

Complete control

You pay hourly, not monthly (more on that later)

Almost instant instances

Lots of RAM per dollar (remember, you need a lot of it!)

EC2: What's to love? EC2: What's to love? (cont'd)(cont'd)

Plenty of disk space

Easy integration with S3 (unlimited storage!)

API to control your instances Scaling can be automated

Amazing firewall features

Many great “base” AMI available

EC2: Change your EC2: Change your mindset!mindset!

Rebuild/deploy new servers with no downtime

Test in a real-world scenario

Turn your staging servers into production servers

Auto-scale your app

…and the database too!

Backup like a champ (S3)

EC2: DrawbacksEC2: Drawbacks

Very confusing at first

No static IP

No permanent storage

IO

Not for email

EC2: Confusing, huh?EC2: Confusing, huh?

Yes, it’s confusing, but it’s not so bad!

Read, read, read http://docs.amazonwebservices.com/AWSEC2/2007-03-01/Ge

ttingStartedGuide/ http://developer.amazonwebservices.com/ec2/forums http://info.rightscale.com (blog section)

Understand the drawbacks, their implications and the solutions

Use the right tools I recommend RightScale.com

Or just ask me!

EC2: No static IP?EC2: No static IP?

New instance, new IP

They don’t change that often anyways If they do, you have another problem!

Give all your instances host names

Use low TTL = minimal downtime

Plenty of good DNS servers: dnsmadeeasy.com, everydns.net, zoneedit.com I realized that static IPs were not a necessity.

EC2: Lack of persistent EC2: Lack of persistent storagestorage

Your instance dies, your data dies with it! The 10/150 rule

Put growing data on /mnt Symlinks Logrotate to /mnt

Backup, backup, backup S3 Replicate DB to remote location Rebundling your instance is not a good solution

EC2+RightScale DemoEC2+RightScale Demo

http://rightscale.com

LinksLinks

top related