Presentation on theme: "What it takes Linux Mongrel Lots of memory (~50 megs / Mongrel) Good monitoring tools Monit (http://tildeslash.com/monit/) Munin (http://munin.projects.linpro.no/)http://munin.projects.linpro.no/"— Presentation transcript:
What it takes Linux Mongrel Lots of memory (~50 megs / Mongrel) Good monitoring tools Monit (http://tildeslash.com/monit/) Munin (http://munin.projects.linpro.no/)http://munin.projects.linpro.no/ Capistrano And MORE memory.
Hosting 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 hosting Pros: Cheap Maintenance taken care of by your provider
Shared 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 (doesnt scale) No control (sometimes non-root SSH) Support team doesnt know Rails Youll outgrow that in no time (ask Marc-André) I simply DONT recommend shared hosting for Rails.
Virtual 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. Dont be cheap: it will backfire.
VPS: Slicehost.com My favorite VPS provider! And damn cheap too! PlanRAMStorageBandwidthPrice/mo 256slice256MB10GB100GB$20 512slice512MB20GB200GB$ slice1024MB40GB400GB$ slice2048MB80GB800GB$140
VPS: 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 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 dont allow full root access.
VPS: Slicehost.com Demo
VPS: 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 (who wouldve 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 providers Slicehost.com my personal favorite they are giving MoR folks VIP treatment! Rimuhosting.com heard great things more expensive (for no apparent benefit)
Amazon 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) TypeRAMCPUStoragePlatform$/hour$/mo Small Instance 1.7 GB1 core * 1 CU160 GB32-bit$0.10~$73 Large Instance 7.5 GB2 cores * 2 CU (4)850 GB64-bit$0.40~$293 Extra Large Instance 15 GB4 cores * 2 CU (8)1.69 TB64-bit$0.80~$585 One EC2 Compute Unit (CU) provides the equivalent CPU capacity of a GHz 2007 Opteron or 2007 Xeon processor. This is also the equivalent to an early GHz Xeon processor.
EC2: Pricing (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 AMI Stands for Amazon Machine Image A Linux installation bundled up and ready to be booted EC2 on Rails (http://ec2onrails.rubyforge.org/)http://ec2onrails.rubyforge.org/ Ubuntu Gutsy 7.10, Apache 2.2, Mongrel Cluster, MySQL 5 Rightscales Rails all-in-one (http://info.rightscale.com/2007/9/20/rails-on-ec2-standard)
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? (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 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: Drawbacks Very confusing at first No static IP No permanent storage IO Not for
EC2: Confusing, huh? Yes, its confusing, but its not so bad! Read, read, read 01/GettingStartedGuide/ 01/GettingStartedGuide/ (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? New instance, new IP They dont 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 storage 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
Links AWS Zone RubyWorks Production Stack on EC2 Amazon EC2 ephemeral storage (/mnt) and MySQL Amazon EC2 ephemeral storage (/mnt) and MySQL How to backup your MySQL server to S3 (not for large db) How to backup your MySQL server to S3 EC2 Walkthrough Installing and configuring nginx and Mongrel for Rails Installing and configuring nginx and Mongrel for Rails Amazon EC2 Gem Slicehost wiki RightScale.com WeoCEO Elastic Rails