1 / 13

Scaling Rails (or other web frameworks)

Scaling Rails (or other web frameworks). Fact or Fiction?. Is a RDMS necessary?. No? Then NoSQL Google Bigtable Apache Casandra Amazon Dynamo Couch DB Mongo DB. Is a RDMS necessary?. Yes Mysql Ourdelta Percona XtraDB MariaDB Drizzle Postgres. Optimize first, Cache later.

yanni
Download Presentation

Scaling Rails (or other web frameworks)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scaling Rails(or other web frameworks) Fact or Fiction?

  2. Is a RDMS necessary? • No? Then NoSQL • Google Bigtable • Apache Casandra • Amazon Dynamo • Couch DB • Mongo DB

  3. Is a RDMS necessary? • Yes • Mysql • Ourdelta • PerconaXtraDB • MariaDB • Drizzle • Postgres

  4. Optimize first, Cache later • “There are only two hard things in Computer Science: cache invalidation and naming things” Phil Karlton • If you cache first, then you have no where to go when you are on Slashdot, Glen Beck, or any other high traffic time • Benchmark to know where to improve and to see changes. • Shard logically then by hash

  5. Optimize first, Cache later • Start with low hanging fruit – • use code profiling gems/plugins • Slowquerylog • mk-query-digest • Index everything • Remove unused indices • Preconaoption to add queries without an index in slow query log • Don’t use N+1 queries • Avoid temporary disk tables,

  6. PerconaMysql Percona 5.1 is faster than Mysql 5.5 Patches from Google, Facebook, and many more More options for optimizing, logging, and profiling Hot backups without buying expensive utilities Stable performance

  7. Performance Tips for MYSQL If possible enough ram for all data, if possible SSD If not, as much ram a possible + SLC SSD R/W latency Temporary Tables use MYISAM cache options Allocate enough ram for temp memory tables Put temporary disk tables on ram disk or SSD Querycache can help or hinder Avoid RAND() if possible – horrible scaling Don’t use a DB for analytics, that’s what logs are for

  8. Nginx, Passenger, REE REE As fast if not faster than ruby 1.92 Passenger + REE = Memory Savings No babysiting mongrels, thins, etc Garbage Collection tuning Nginx + Passenger = ROR + static file serving without the bloat of apache + passenger

  9. Don’t Use MYSQL for fulltext searches DataparkSearch Ferret Ht-//Dig Hyper Estraier Lemur/Indri Lucene mnoGoSearch Sphinx Swish-e Xapian

  10. Where to cache • SQL: • DB server • Memcached • Rails • Rails: • Active Record, • Actions, • Partials, • page • Reverse Proxy • Object and ESI

  11. Reverse Caching Proxy Squid Pound Apache httpd Apache TS Lighttpd Nginx Varnish

  12. Varnish Extremely High Performance Doesn’t fight OS’s VMM Multiple storage options Saint Mode Edge Side Includes Extremely threaded Inline C Backend health checking Load balancing

  13. Page Load Times • Search Engines take it into account in ranking • Combined, Minify, compress, CSS and JS • Compress html • Use CSS sprites • Set expires tags • Crush images • Multiple static servers, • Divide total #of static items by 4 for optimal # of servers • Benchmark with Google Pagespeed, Yahoo Yslow, firebug.

More Related