Building Scalable Web Sites: Tidbits from the sites that made it work. Gabe Rudy



Similar documents
Scalability of web applications. CSCI 470: Web Science Keith Vertanen

Wikimedia architecture. Mark Bergsma Wikimedia Foundation Inc.

Database Scalability {Patterns} / Robert Treat

Drupal Performance Tuning

Large Scale file storage with MogileFS. Stuart Teasdale Lead System Administrator we7 Ltd

Cluster Computing. ! Fault tolerance. ! Stateless. ! Throughput. ! Stateful. ! Response time. Architectures. Stateless vs. Stateful.

Evolution of Web Application Architecture International PHP Conference. Kore Nordmann / <kore@qafoo.com> June 9th, 2015

Large-Scale Web Applications

Wikimedia Architecture Doing More With Less. Asher Feldman Ryan Lane Wikimedia Foundation Inc.

Tushar Joshi Turtle Networks Ltd

Are You Ready for the Holiday Rush?

Web DNS Peer-to-peer systems (file sharing, CDNs, cycle sharing)

In Memory Accelerator for MongoDB

Layers of Caching: Key to scaling your website. Lance Albertson -- Narayan Newton

CS 188/219. Scalable Internet Services Andrew Mutz October 8, 2015

SCALABLE DATA SERVICES

How Comcast Built An Open Source Content Delivery Network National Engineering & Technical Operations

1. Comments on reviews a. Need to avoid just summarizing web page asks you for:

SCALABILITY AND AVAILABILITY

Tipping The Scale Tips, Tools, and Techniques For Building Scalable. Steve French Senior Software Engineer digg.com

Removing Failure Points and Increasing Scalability for the Engine that Drives webmd.com

Lecture 3: Scaling by Load Balancing 1. Comments on reviews i. 2. Topic 1: Scalability a. QUESTION: What are problems? i. These papers look at

Cloud Computing Is In Your Future

ZingMe Practice For Building Scalable PHP Website. By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG

Perlbal: Reverse Proxy & Webserver

The deployment of OHMS TM. in private cloud

Understanding Neo4j Scalability

BASICS OF SCALING: LOAD BALANCERS

Google App Engine. Guido van Rossum Stanford EE380 Colloquium, Nov 5, 2008

A programming model in Cloud: MapReduce

Apache HBase. Crazy dances on the elephant back

SCALABILITY. Hodicska Gergely. Web Engineering Manager as Ustream. May 7, 2012

Storage Made Easy Enterprise File Share and Sync (EFSS) Cloud Control Gateway Architecture

Cloud Computing with Microsoft Azure

Social Networking at Scale. Sanjeev Kumar Facebook

Solbox Cloud Storage Acceleration

High Availability Solutions for the MariaDB and MySQL Database

Wikimedia architecture. Ryan Lane Wikimedia Foundation Inc.

Adding scalability to legacy PHP web applications. Overview. Mario Valdez-Ramirez

Open-Xchange Server High availability Daniel Halbe, Holger Achtziger

SWIFT. Page:1. Openstack Swift. Object Store Cloud built from the grounds up. David Hadas Swift ATC. HRL 2012 IBM Corporation

The Design and Implementation of the Zetta Storage Service. October 27, 2009

Availability Digest. MySQL Clusters Go Active/Active. December 2006

How to choose High Availability solutions for MySQL MySQL UC 2010 Yves Trudeau Read by Peter Zaitsev. Percona Inc MySQLPerformanceBlog.

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Cloud Computing at Google. Architecture

Big Data With Hadoop

Cloud Based Application Architectures using Smart Computing

Load Balancing Web Applications

MySQL High-Availability and Scale-Out architectures

Building Reliable, Scalable AR System Solutions. High-Availability. White Paper

white paper imaginea Building Applications for the Cloud Challenges, Experiences and Recommendations

Practical Cassandra. Vitalii

Tobby Hagler, Phase2 Technology

Network Attached Storage. Jinfeng Yang Oct/19/2015

Design and Evolution of the Apache Hadoop File System(HDFS)

Cache All The Things

High-Availability, Fault Tolerance, and Resource Oriented Computing

The Google File System

Database Scalability and Oracle 12c

Distributed File Systems

Performance for Site Builders

Accelerating Rails with

Load Balancing and Sessions. C. Kopparapu, Load Balancing Servers, Firewalls and Caches. Wiley, 2002.

IERG 4080 Building Scalable Internet-based Services

Scalable Architecture on Amazon AWS Cloud

On- Prem MongoDB- as- a- Service Powered by the CumuLogic DBaaS Platform

L.A.M.P.* - Shaman-X High Availability and Disaster Tolerance. Design proposition

Designing, Scoping, and Configuring Scalable Drupal Infrastructure. Presented by David Strauss

Apache Hadoop. Alexandru Costan

Hadoop and Map-Reduce. Swati Gore

Distributed File Systems

Designing and Implementing Scalable Applications with Memcached and MySQL

The Classical Architecture. Storage 1 / 36

Web Performance. Sergey Chernyshev. March '09 New York Web Standards Meetup. New York, NY. March 19 th, 2009

Hypertable Architecture Overview

Liferay Performance Tuning

An overview of Drupal infrastructure and plans for future growth. prepared by Kieran Lal and Gerhard Killesreiter for the Drupal Association

Scalable Web Application


Efficient Network Marketing - Fabien Hermenier A.M.a.a.a.C.

EPAM Systems. EPAM White Paper

April 19, 2007

The OpenStack TM Object Storage system

making drupal run fast

Drupal Performance Tips and Tricks. Khalid Baheyeldin. Drupal Camp Toronto 2014

Distributed Systems. Tutorial 12 Cassandra

Panasas at the RCF. Fall 2005 Robert Petkus RHIC/USATLAS Computing Facility Brookhaven National Laboratory. Robert Petkus Panasas at the RCF

NoSQL Data Base Basics

A Standard Modest WebSite

1. Introduction 2. Getting Started 3. Scenario 1 - Non-Replicated Cluster 4. Scenario 2 - Replicated Cluster 5. Conclusion

Building Scalable Applications Using Microsoft Technologies

Implementation of Hadoop Distributed File System Protocol on OneFS Tanuj Khurana EMC Isilon Storage Division

Internet Content Distribution

POWER ALL GLOBAL FILE SYSTEM (PGFS)

Beyond The Web Drupal Meets The Desktop (And Mobile) Justin Miller Code Sorcery Workshop, LLC

MySQL és Hadoop mint Big Data platform (SQL + NoSQL = MySQL Cluster?!)

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective

Distributed Systems. 25. Content Delivery Networks (CDN) 2014 Paul Krzyzanowski. Rutgers University. Fall 2014

Hadoop: A Framework for Data- Intensive Distributed Computing. CS561-Spring 2012 WPI, Mohamed Y. Eltabakh

Transcription:

: Tidbits from the sites that made it work Gabe Rudy

What Is This About Scalable is hot Web startups tend to die or grow... really big Youtube Founded 02/2005. Acquired by Google 11/2006 03/2006 30 million videos a day 07/2006 100 million videos a day Start with small budget LAMP Scale, but try to use commodity hardware Can t we just throw some more servers at the problem?

Cred? I have no cred Desktop apps C++ Python for kicks But these guys do: Chung Do (YouTube) Cal Henderson (Flickr) So lets talk about Software Hardware Databases

What It Breaks Down Into Web Application Apache + module friends Python/PHP (no perl thank god) Database Server MySQL Memcache (more later) Content Images Videos High load? Punt. Dual-quad Opteron with 16GB of RAM will go a long, long way.

Really? No hand crafted C? Wait? Aren t Python/PHP slow? Doesn t matter: They are fast enough What does matter: Developer time All the time gets spent: On the wire (serving files, RPC, server communication) Database But there are optimizations at every level Caching at every level

The Web App Build dynamic HTML Youtube used: Apache with mod_fastcgi and Python psyco (dynamic python -> C compiler) A few C extensions for encryption Flickr used: Apache with? and PHP Custom PHP framework Async web design requests get quick response, poll on status of server intensive tasks Cache? Pre-generated, entire HTML for high traffic pages

Scaling Web Servers Load balancing Hardware (Layer 4 or Layer 7) Bigger, faster, stronger More expensive Alteon, Cisco, Netscaler (YouTube), Foundry, etc Software (still need hardware) mod_backhand whackamole End up integrating with your reverse proxy/cdn (more later)

Scaling the DB Read/Write ratio generally 80/20 or 90/10 Scale read capacity: MySQL replication Master (for writes) <-> Many slaves (for reads) Writes go through master, propagates to all slaves Does not scale Soon slaves are spending 80% time syncing writes (unhealthy) Propagation delay increases (read old values) YouTube hacked MySQL master Cache primer thread that pre-fetches reads of queries from disk to prevent stalling while handing write queue. Bought them time Master <-> Master pair Provides High Availability Reads faster than single master Limits at most doubled Still have row table limits etc Pragmatic solution

Partitioning, Sharding, Federated Data Vertical Partitioning Create partition of tables that will never need to be joined Logical limits depending on application Horizontal Partitioning Sharding Same schema, partition by some primary field (like user) Place each shard on a cluster (master-master pair?) Spreads reads and writes Better cache locality Must avoid shard walking Don t assign to shard algorithmically Requires central lookup cluster (hash table) to map user to shard

Shards Cont Advantages Need more capacity? Just add more shards Heterogeneous hardware is fine, just assign less/more objects per shard Disadvantages App logic gets more complicated More clusters to manage Constrains lookups Denormalization Performance trick (not sharding) Copied field from main table to linking table to make queries faster Cached fields: Say in a parent/child relationship, cache count

Database Caching Write-through cache Write-back cache Sideline cache Takes application logic (manually invalidate) Usually best Memcached

Content Caching Reverse proxy/caching proxy can be geographically dispersed Scales well Fast usually serve out of memory Dealing with invalidation is tricky Direct prodding to invalidate scales badly Instead, change URLs of modified resources Old ones will drop out of cache naturally CDN Content Delivery Network Akamai, Savvis, Mirror Image Internet, Netscaler, etc Operated by 3rd parties. Already in place Gives you GSLB/DNS balancing (Global Server Load Balancing) Once something is cached on CDN, assume that it never changes. SSL can be at proxy point with SSL hardware Sometimes does load balancing as well

CDN

CDN

Content Caching Cont Versioning Rule of thumb: if item is modified, change it s URL Independent of your file system, can use mod_rewrite etc Tools Squid (web cache, proxy server), GPL Mod_proxy and mod_cache for Apache Perlbal (mostly load balancer) and memcached

Sessions Non-trivial assuming load balanced application servers Local == bad: PHP sessions are stored locally on disk Can t move users, can t avoid hotspots, no fault tolerance Mobile local sessions: Store last session location in cookie If request gets to different server, then pull session info Single centralization database (or in-mem cache) No hot spots, porting of session data, good Problems scaling, bad Stash the whole damn session in a cookie! user_id + user_name + time + secret -> sign -> base64 Timestamp can expire it User_name is usually most used user info ( hello user_name ) Fewer queries per page (some pages need little personalization)

Authentication (private and privileged content) Perlbal reverse proxy can handle custom authentication modules Bake permissions into URL Can do auth at web app Use magic to translate URL to real resource paths Don t want paths to be guessable Skips need for Perlbal or re-proxy step Downsides: permission for live Unless you bake in an expiring token Ugly URLs? Upsides: scales very nicely and works

File Storage Eventually outgrow single box s capacity Horizontal scaling Remote file protocol? NFS stateful == sucks SMB/Samba stateful but degrades gracefully HTTP Stateless! At some point need multiple volumes At some point need multiple hosts Also want high availability and failure recovery (rebuild) So we can ignore RAID

Distributed fault tolerant file systems MogileFS application level distributed file system Metadata store (MySQL can be clustered) Replication automatic and piecemeal I/O goes through tracker nodes that use storage nodes GFS Google File System (proprietary) Master node holds metadata (shadow master for warm swap) Master node manages I/O (leases) Grid of chunkservers, files usually dispersed among many servers Designed to read large files fast Automatic replication and self repairing Flickr File System - proprietary No metadata store App must store metadata virtual volume number StorageMaster nodes responsible for writing (organization) Virtual nodes store data, are mirrored Reading is done directly from nodes (scales really well) Amazon S3 big disk in the sky Files have user-defined keys Data + metadata Cost, linear and gets expensive as you scale

Story YouTube thumbnails Loads of them (a dozen per video) Lots of disk seeks High # requests/sec (when you search, you get back thumbnails) Lots of files in the filesystem Start to blow per-directory limits Move to hierarchial storage Sync between servers really slow Interim solution Move from Apache to lighttpd Then hack lighttpd to have I/O bound worker threads (it s open source) Long term solution Google Big Table Avoid small file problem Get fault tolerance Distributed access Caching

End : Building, scaling, and optimizing the next generation of web applications -- Cal Henderson Scalable Internet Architectures -- Theo Schlossnagle