Your SlideShare is downloading. ×
Scaling a Web Service
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Scaling a Web Service

1,980

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,980
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
81
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Scaling a Web Service BarCamp HK 2007 Leon Ho, Stepcase Limited
  • 2. Objective • Sustaining the scale of the traffic • Zero downtime • High performance • Squeezing every juice from the server
  • 3. Why? • Stepcase Lifehack (http://www.lifehack.org): • 1 million visits per month • 2 million pageviews per month • Those does not include images, javascript, stylesheets • We’ve done 5400 new connections per min
  • 4. 1. Hardware
  • 5. Stage 1 Web Server DB Shared Hosting
  • 6. Stage 2 Web Server DB
  • 7. Stage 3 Slave DB Master Web Server DB Slave DB
  • 8. Stage 4 Master DB Web Server Master DB MySQL Cluster
  • 9. Stage 5 App Server Master DB Load App Server Balancer Master DB MySQL Cluster App Server
  • 10. Servers • Stage 2 • Running 2 servers; each with 4 cores and 4GB RAM • Exposing only one server to public network
  • 11. Remember the point is to stay in early stages.
  • 12. 2. Reduce Connections
  • 13. Static Files • Moves out to a separate server • Consider Amazon S3 • Image - Decrease the number of images you need to load • CSS Spites • Use Firebug to benchmark
  • 14. Amazon S3 • We moved our static images to S3 • files.lifehack.org CNAME s3.amazonaws.com • use cronjob and s3sync to keep them in sync • next, move js, css, and post images out
  • 15. Feed • 60,000 subscriptions daily • We use external provider - Feedburner
  • 16. 3. Reduce File Size
  • 17. Javascript • Compress the javascript • JSMin, Dojo ShrinkSafe, Packer,YUI Compressor • http://compressorrater.thruhere.net
  • 18. 4. Optimize and Cache
  • 19. Web & DB Server • Web: Moved to Lighttpd • DB: MySQL. Increase query cache, max connection and wait timeout
  • 20. Cache • Cache, Cache, and Cache • Page level (wp-cache) • DB queries (memcache, or any object caches) • PHP opcode - xcache, e-accelerator
  • 21. What else? • Eliminate bottleneck • Hard drive > Memory > CPU • Reduce Abuse and Spam
  • 22. Next • Adding more comprehensive monitoring • Munin • More scaling - this time - on Rails
  • 23. Questions? Visit Us: Contact Me: http://www.stepcase.com leon@stepcase.com http://www.lifehack.org P.S. We are hiring!

×