glennka's picture
From glennka rss RSS  subscribe Subscribe

Scaling Scribd 



 

 
Views:  743
Downloads:  6
Published:  November 21, 2009
 
1
download

Share plick with friends Share
save to favorite
 
Related Plicks
COLLECTION OF POWERPOINT SLIDES, PRESENTATIONS, LECTURE NOTES, CLASS NOTES… ALL AT FREE OF COST!

COLLECTION OF POWERPOINT SLIDES, PRESENTATIONS, LECTURE NOTES, CLASS NOTES… ALL AT FREE OF COST!

From: nasif123
Views: 1213 Comments: 1
http://notesinfo.blogspot.com/ (GCE O’/A’level, ACCA, Law)
http://pharmacystudentedu.blogspot.com/ (Pharmacy)

COLLECTION OF POWERPOINT SLIDES, PRESENTATIONS, LECTURE NOTES, (more)

 
Bryc Barrand - The art of project management in large-scale Flex projects

Bryc Barrand - The art of project management in large-scale Flex projects

From: lisanti
Views: 110 Comments: 0

 
How to Run a Business Entirely with Web 2.0 Applications & Services

How to Run a Business Entirely with Web 2.0 Applications & Services

From: gavi
Views: 2092 Comments: 0
Office 2.0 - The Rationale, The Rules, The Randomness or How to Run a Business Entirely with Web 2.0 Applications & Services
 
R

R

From: anon-55710
Views: 524 Comments: 0

 
Scaling Web Sites by Sharding and Replication

Scaling Web Sites by Sharding and Replication

From: johnny
Views: 744 Comments: 0
Percona - San Francisco mysql meetup
 
There Is Definitely Something In The Air

There Is Definitely Something In The Air

From: anon-96470
Views: 361 Comments: 0

 
See all 
 
More from this user
Microsoft Dynamics CRM 4.0 Enterprise Overview

Microsoft Dynamics CRM 4.0 Enterprise Overview

From: glennka
Views: 139
Comments: 0

Information Technologies Concepts And Management

Information Technologies Concepts And Management

From: glennka
Views: 121
Comments: 0

Gerenciamento Projetos Software - Virtual Business

Gerenciamento Projetos Software - Virtual Business

From: glennka
Views: 121
Comments: 0

Be  Successful  In  Examination  Dr

Be Successful In Examination Dr

From: glennka
Views: 115
Comments: 0

RCIM 2008 - - UniCal

RCIM 2008 - - UniCal

From: glennka
Views: 141
Comments: 0

Ivf Babys

Ivf Babys

From: glennka
Views: 106
Comments: 0

See all 
 
 
 URL:          AddThis Social Bookmark Button
Embed Thin Player: (fits in most blogs)
Embed Full Player :
 
 

Name

Email (will NOT be shown to other users)

 

 
 
Comments: (watch)
plicker Amy (2 months ago)
From reviews on the net,we know that <a href=" http://www.mbtshoesmarket.us/"><strong>MBT shoes</str...></a> will improve your posture
plicker puma shoes (2 months ago)
Thanks! puma shoes is a world-renowned brand.Wearing it would give people the feeling of a comfort and energy. From here http://www.pumaforever.com we can enjoy discount price.
plicker ugg boots sale (2 months ago)
<a href="http://www.ugggo.com/ugg-classic-tall-c-52.html">classic tall ugg boots</a>
<a href="http://www.ugggo.com/ugg-classic-tall-c-52.html">ugg classic tall</a>
<a href="http://www.ugggo.com/ugg-classic-cardy-c-48.html">ugg cardy boots</a>
plicker cheap ugg boots (2 months ago)

Chanel 2.25 Bags
Chanel Bags
Chanel Collection
Chanel Flap Bags
Chanel Handbags

http://www.handbag-bags.com/
plicker cheap ugg boots (2 months ago)
Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

Our website:http://www.online-uggs.com/
plicker cheap ugg boots (2 months ago)
Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

Our website:http://www.online-uggs.com/
plicker cheap ugg boots (2 months ago)
Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

Our website:http://www.online-uggs.com/
plicker cheap ugg boots (2 months ago)
Cheap UGG Australia boots on sale,free shipping&no tax
5-7 days delivery to your door!
Always best service to you!

Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

http://www.ugglinks.com/
plicker cheap ugg boots (2 months ago)
Cheap UGG Australia boots on sale,free shipping&no tax
5-7 days delivery to your door!
Always best service to you!

Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

http://www.ugglinks.com/
plicker cheap ugg boots (2 months ago)
Cheap UGG Australia boots on sale,free shipping&no tax
5-7 days delivery to your door!
Always best service to you!

Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

Our website:http://www.ugggirls.com/
plicker cheap ugg boots (2 months ago)
Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104

Our website:http://www.uggs.cc/
plicker cheap ugg boots (2 months ago)
Women's Ugg Bailey Button save:19%-40% off
Women's Ugg Classic Tall discount 25%-50% off
Women's Ugg Classic Short Cheap Sale $104
http://www.uggkey.com/
plicker maria (2 months ago)
Good post, I think I will try to recommend this post to my friends and family, cuz it’s really helpful.<br />
[url=http://www.buddyugg.com/]ugg classic cardy boots[/url]
plicker zhangwy1120 (2 months ago)
Cheap girl handbags!!!! Street Style!!
2009 newest designer handbags arrive,Please visit www.welljordan.com for more details.
plicker discount ugg boots (2 months ago)
http://www.martheaven.com/brand-shoes-mbt-shoes-c-82_267.html
http://www.martheaven.com
http://www.martheaven.com/uggs-hot-sale-c-88.html
plicker discount ugg boots (2 months ago)
<a href="http://www.martheaven.com/uggs-hot-sale-c-88.html">cheap ugg boots sale</a>
<a href="http://www.martheaven.com">wholesale clothing</a>
<a href="http://www.martheaven.com/brand-shoes-mbt-shoes-c-82_267.html">mbt shoes clearance</a>
 
 
Notes:
 
Slide 1: Yet  Another  Rails  Scaling  Presentation  Ruby on Rails Meetup  May 10, 2007  Jared Friedman (jared@scribd.com) and  Tikhon Bernstam (tikhon@scribd.com)
Slide 2: Should you bother with  scaling?  l  Well, it depends  l  But if you’re launching a startup, probably  l  The best way to launch a startup these days  is to get it on TechCrunch, Digg, Reddit, etc.  l  You don’t get as much time to grow  organically as you used to  l  You only get one launch – don’t want your  site to fall over
Slide 3: The Predecessors  l  Other great places to look for info on this  l  poocs.net The Adventures of Scaling Rails  http://poocs.net/2006/3/13/the­adventures­of­scaling­stage­1  l  Stephen Kaes “Performance Rails”  http://railsexpress.de/blog/files/slides/rubyenrails2006.pdf  l  RobotCoop blog and gems  http://www.robotcoop.com/articles/2006/10/10/the­software­and­hardware­that­runs­our­sites  l  O’reilly book “High Performance MySQL”  l  It’s not rails, but it’s really useful
Slide 4: Big Picture  l  This presentation will concentrate on what’s  different from previous writings, not a  comprehensive overview  l  Available at http://www.scribd.com/blog
Slide 5: Who we are  l  Scribd.com  l  Like “YouTube for documents”  l  Launched in March, 2007  l  Handles ~1M requests per day
Slide 6: Key Points  l  General architecture  l  Use fragment caching!  l  Rolling your own traffic analytics and some  SQL tips
Slide 7: Current Scribd architecture  l  1 Web Server  l  3 Database Servers  l  3 Document conversion servers  l  Test and backup machines  l  Amazon S3
Slide 8: Server Hardware  l  Dual, dual­core woodcrests at 3GHz  l  16GB of memory  l  4 15K SCSCI hard drives in a RAID 10  l  We learned: disk speed is important  l  Don't skimp; you’re not Google, and it's  easier to scale up than out  l  Softlayer is a great dedicated hosting  company
Slide 9: Various software details  l  CentOS  l  Apache/Mongrel  l  Memcached, RobotCoop’s memcache­client  l  Stefan Kaes’ SQLSessionStore  l  Best way to store persistent sessions  l  Monit, Capistrano  l  Postfix
Slide 10: Fragment Caching  "We don’t use any page or fragment  caching." ­ robotcoop  l  "Play with fragment caching ... no  improvement, changes were reverted at a  later time." ­ poocs.net  l  Well, maybe it's application specific  l  Scribd uses fragment caching extensively,  enormous performance improvement l 
Slide 11: ScreenShot
Slide 12: How to Use Fragment Caching  l  l  l  l  l  Ignore all but the most frequently accessed pages  Look for pieces of the page that don't change on  every page view and are expensive to compute  Just wrap them in a  <% cache('keyname‘) do %>  …  <% end %>  Do timing test before and afterwards; backtrack  unless significant performance gains  We see > 10X
Slide 13: Expiring fragments, 1. Time based  l  You should really use memcached for storing  fragments  Better performance  l  Easier to scale to multiple servers  l  Most important: allows time­based expiration  l  l  Use plugin http://agilewebdevelopment.com/plugins/memcache_fragments_with_time_expiry  l  Dead easy:  <% cache 'keyname‘, :expire => 10.minutes do %>  ...  <% end %>
Slide 14: Expiring fragments, 2. Manually  l  No need to serve stale data  l  Just use:  Cache.delete("fragment:/partials/whatever")  l  Clear fragments whenever data changes  l  Again, easier with memcached
Slide 15: Traffic Analytics  l  Google Analytics is nice, but there are a lot of  reasons to roll your own traffic analytics too  l  l  l  Can be much more powerful  You can write SQL to answer arbitrary questions  Can expose to users
Slide 16: Scribd’s analytics  (screenshots)
Slide 17: Building traffic analytics, part 1  l  l  create_table “page_views” do |t|  t.column “user_id”, :integer  t.column “request_url”, :string, :limit => 200  t.column “session”, :string, :limit => 32  t.column “ip_address”, :string, :limit => 16  t.column “referer”, :string, :limit => 200  t.column “user_agent”, :string, :limit => 200  t.column “created_at”, :timestamp  end  Add a whole bunch of indexes, depending on queries
Slide 18: Building traffic analytics, part 2  l  Create a PageView on every request  l  We used a hand­built SQL query to take out  the ActiveRecord overhead on this  l  Might try MySQL’s “insert delayed”  l  Analytics queries are usually hand­coded  SQL  l  Use “explain select” to make sure MySQL is  using the indexes you expect
Slide 19: Building Traffic Analytics, part 3  l  Scales pretty well  l  BUT analytics queries expensive, can clog up  main DB server  l  Our solution:  l  l  use two DB servers in a master/slave setup  move all the analytics queries to the slave
Slide 20: Rails with multiple databases, part 1  l  l  l  l  "At this point in time there’s no facility in Rails to talk  to more than one database at a time." ­ Alex Payne,  Twitter developer  Well that's true  But setting things up yourself is about 10 lines of  code.  There are now also two great plugins for doing this:  Magic multi­connections  http://magicmodels.rubyforge.org/magic_multi_conn  ections/  Acts as read onlyable­  http://rubyforge.org/frs/?group_id=3451
Slide 21: Rails with multiple databases, part 2  l  At Scribd we use this to send pre­defined  expensive queries to a slave  l  This can be very important for dealing with  lock contention issues  l  You could also do automatic load balancing,  but synchronization becomes more  complicated (read a SQL book, not a Rails  issue)
Slide 22: Rails with multiple databases, code  l  In database.yml  slave1:  host: 18.48.43.29  # your slave’s IP  database: production  username: root  password: pass  l  Define a model Slave1.rb  class Slave1 < ActiveRecord::Base  self.abstract_class = true  establish_connection :slave1  end  l  When you need to run a query on the slave, just do  Slave1.connection.execute("select * from some_table")
Slide 23: Shameless Self­Promotion  l  Scribd.com: VC­backed and hiring  l  Just 3 people so far! >10 by end of year.  l  Awesome salary/equity combination  l  If you’re reading this, you’re probably the  right kind of person  l  Building the world's largest open document  library  l  Email: hackers@scribd.com

   
Time on Slide Time on Plick
Slides per Visit Slide Views Views by Location