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

Similar documents
Tushar Joshi Turtle Networks Ltd

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

BASICS OF SCALING: LOAD BALANCERS

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

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

Practical Cassandra. Vitalii

CS514: Intermediate Course in Computer Systems

Are You Ready for the Holiday Rush?

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

Load Balancing Web Applications

MySQL High-Availability and Scale-Out architectures

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

Transactions and ACID in MongoDB

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

SCALABILITY AND AVAILABILITY

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

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

Availability Digest. Redundant Load Balancing for High Availability July 2013

High Availability Solutions for the MariaDB and MySQL Database

Astaro Deployment Guide High Availability Options Clustering and Hot Standby

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

Understanding Neo4j Scalability

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

High Availability and Clustering

Large-Scale Web Applications

Practical Load Balancing

Wikimedia architecture. Mark Bergsma Wikimedia Foundation Inc.

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

Scalable Web Application

Enabling Database-as-a-Service (DBaaS) within Enterprises or Cloud Offerings

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

Apache HTTP Server. Load-Balancing with Apache HTTPD 2.2 and later. Erik Abele

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

EQUELLA. Clustering Configuration Guide. Version 6.2

Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

Chapter 2 TOPOLOGY SELECTION. SYS-ED/ Computer Education Techniques, Inc.

Web Application Deployment in the Cloud Using Amazon Web Services From Infancy to Maturity

Web Caching and CDNs. Aditya Akella

Coyote Point Systems White Paper

IdP Clustering. You want to prevent service outages. High Availability and Load Balancing. Possible problems: HW failures

Oracle Collaboration Suite

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

SiteCelerate white paper

MEASURING WORKLOAD PERFORMANCE IS THE INFRASTRUCTURE A PROBLEM?

F5 and Oracle Database Solution Guide. Solutions to optimize the network for database operations, replication, scalability, and security

Apache Performance Tuning

Agenda. Distributed System Structures. Why Distributed Systems? Motivation

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

High Availability Solutions for MySQL. Lenz Grimmer DrupalCon 2008, Szeged, Hungary

ScaleArc for SQL Server


In Memory Accelerator for MongoDB

Managing Virtual Servers

Database Scalability and Oracle 12c

Hadoop: Embracing future hardware

Cisco Application Networking Manager Version 2.0

Web Application Hosting Cloud Architecture

Overview of Databases On MacOS. Karl Kuehn Automation Engineer RethinkDB

5 Easy Steps to Implementing Application Load Balancing for Non-Stop Availability and Higher Performance

Inge Os Sales Consulting Manager Oracle Norway

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

Direct NFS - Design considerations for next-gen NAS appliances optimized for database workloads Akshay Shah Gurmeet Goindi Oracle

S y s t e m A r c h i t e c t u r e

Techniques for Scaling Components of Web Application

Zadara Storage Cloud A

CLUSTERING CAS for High Availability. Eric Pierce, University of South Florida

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

A Performance Analysis of Distributed Indexing using Terrier

LOAD BALANCING IN WEB SERVER

An overview of the Drupal infrastructure and plans for future growth

Global Server Load Balancing

Content Delivery Networks

Parallels Cloud Storage

LARGE SCALE INTERNET SERVICES

Applying traditional DBA skills to Oracle Exadata. Marc Fielding March 2013

2009 Oracle Corporation 1

Requirements of Voice in an IP Internetwork

Client/Server and Distributed Computing

Cisco Application Networking for BEA WebLogic

Bricks Cluster Technical Whitepaper

Cisco Application Networking for IBM WebSphere

ScaleArc idb Solution for SQL Server Deployments

Radware s AppDirector and AppXcel An Application Delivery solution for applications developed over BEA s Weblogic

Advanced Computer Networks. Layer-7-Switching and Loadbalancing

Multiple Public IPs (virtual service IPs) are supported either to cover multiple network segments or to increase network performance.

Building a Highly Available and Scalable Web Farm

Software Performance, Scalability, and Availability Specifications V 3.0

How To Handle A Power Outage On A Server Farm (For A Small Business)

CommuniGate Pro White Paper. Dynamic Clustering Solution. For Reliable and Scalable. Messaging

Product Overview. UNIFIED COMPUTING Managed Load Balancing Data Sheet

The Application Front End Understanding Next-Generation Load Balancing Appliances

How To Balance A Load Balancer On A Server On A Linux (Or Ipa) (Or Ahem) (For Ahem/Netnet) (On A Linux) (Permanent) (Netnet/Netlan) (Un

Exploiting Remote Memory Operations to Design Efficient Reconfiguration for Shared Data-Centers over InfiniBand

Transcription:

Scalability of web applications CSCI 470: Web Science Keith Vertanen

Scalability questions Overview What's important in order to build scalable web sites? High availability vs. load balancing Approaches to scaling Performance tuning, horizontal scaling, vertical scaling Multiple web servers DNS based sharing, hardware/software load balancing State management Database scaling Replication Splitting things up 2

Scalability related questions Where is your session state being stored? Why? How are you generating dynamic content? Why? Are you regenerating things that could be cached? What is being stored in the database? Why? Could you be lazier? Do you need exact answers? e.g. page 1/2063 versus page 1 of many Queue up work if it doesn't need to be done right now e.g. Does user really need a video thumbnail right away? What do you care about? Time to market, money, user experience, uptime, power efficiency, bug density, 3

High availability / load balancing High availability Stay up despite failure of components May involve load-balancing, but not necessarily Hot standby = switched to automatically if primary fails Warm standby = switched to by engineer if primary fails Easy component updates e.g. Avoid maintenance windows in the middle of the night Load balancing Combining resources from multiple systems Send request to somebody else if a certain system fails May provide high availability, but not necessarily e.g. Adding a single-point of failure load balancing appliance 4

Availability % Availability 9s Downtime per year 90% "one nine" 36.5 days 99% "two nines" 3.65 days 99.9% "three nines" 8.76 hours 99.99% "four nines" 52.56 minutes 99.999% "five nines" "carrier grade" 5.25 minutes 99.9999% "six nines" 31.5 seconds 99.99999% "seven nines" 3.15 seconds https://www.digitalocean.com/features/reliability/ 5

Approaches to scaling Make existing infrastructure go further Classic performance tuning : Find the bottleneck Make faster (if you can) Find the new bottleneck, iterate How are you generating dynamic content? Why? Where is your session state being stored? Why? What is being stored in the database? Why? Can you be lazier? Do you need exact answers? e.g. page 1/2063 versus page 1 of many Add work to a queue if it doesn't need to be done right now e.g. Does user really need a video thumbnail right away? 6

Vertical scaling (scale up) Approaches to scaling Buy more memory, faster CPU, more cores, SSD disks A quick fix: uses existing software/network architecture But there are performance limits Also a price premium for high end kit... ABMX server, 1u 1 core @3.1 Ghz, 1GB memory, 80GB disk $397 Oracle Exadata X2-8, 42u 160 cores @ 2.4Ghz, 4TB memory 14 storage servers, 168 cores, 336TB 1.5M database I/O ops/sec $1,650,000 7

Approaches to scaling Horizontal scaling (scale out) Buy more servers Well understood for many parts Application servers (e.g. web servers) But may require software and/or network changes Not so easy for other parts Databases http://www.flickr.com/photos/intelfreepress/6722296265/ 8

One web site: many servers How does the user arrive at a particular server? Does the session need to stick to same web server? Very important depending on how app manages state e.g. using PHP file-based session state What happens if a web server crashes? Users would prefer a geographically nearby server Browser A Browser B Web 1 Web 2 Web 3 DB 9

Round robin DNS Round robin DNS Multiple IP addresses assigned to a single domain name Client's networking stack chooses which to connect to Browser A Browser B Web 1 157.166.226.25 Web 2 157.166.226.26 Web 3 157.166.255.18 DB 10

Round robin DNS Round robin DNS Simple and cheap to implement No specialized hardware, using existing DNS infrastructure Problems: DNS has no visibility into server load or availability In simplest configuration, each web server requires an IP address Users may end up being sent to a distant server with high latency Browser A Browser B Web 1 157.166.226.25 Web 2 157.166.226.26 Web 3 157.166.255.18 DB 11

Anycast + DNS Goal: Get users to the "closest" server Anycast = multiple servers with same IP address Routing protocols determine best route to shared IP Best suited for connectionless protocols e.g. UDP 12

Multiple clusters Anycast + DNS Place a DNS server next to each web cluster Each DNS server has same IP address via IP Anycast A particular DNS server gives out IPs in its local cluster Anycast routes client to closest DNS server DNS servers routes client to "closest" server farm Browser A Browser B DNS 1 157.166.226.1 DNS 2 157.166.226.1 DNS 3 157.166.226.1 Web 1 157.166.226.25 Web 2 157.166.226.26 Web 3 157.166.255.18 DB 13

Load balancers Load balancers (web switches) Hardware or software (e.g. mod_proxy_balancer, Varnish) Like a NAT device in reverse People hit a single public IP to get to multiple private IP addresses Introduces a new single point of failure But we can introduce a backup balancer Load balancers monitor each other via a heartbeat How to distribute load? Round robin, least connections, predictive, available resources, random, weighted random 14

Load balanced, no single point of failure Internet router router switch switch web switch web switch switch switch www 1 www 2 15

Load balancer, some features Session persistence Getting user back to same server (e.g. via cookie/client IP) Asymmetric load Some servers can take more load than others SSL offload Load balancer terminates the SSL connection HTTP compression Reduce bandwidth using gzip compression on traffic Caching content Intrusion/DDoS protection 16

Software load balancer Apache server running mod_proxy_balancer One server answers user requests Distributes to two or more other servers <Proxy balancer://mycluster> BalancerMember http://192.168.1.50:80 BalancerMember http://192.168.1.51:80 </Proxy> ProxyPass /test balancer://mycluster Example configuration without sticky sessions. Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=balancer_route_changed <Proxy balancer://mycluster> BalancerMember http://192.168.1.50:80 route=1 BalancerMember http://192.168.1.51:80 route=2 ProxySet stickysession=routeid </Proxy> ProxyPass /test balancer://mycluster Example configuration with sticky sessions. 17

State management HTTP is stateless, but user interactions often stateful Store session state somewhere: Local to web server Centralized across servers Stored in the client Or some combination Centralized but cached at closer level(s) 18

Stored on disk PHP temp file somewhere Stored in memory Faster PHP: Local sessions Compile with --with-mm session.save_handler=mm in php.ini Problems: User can't move between servers Load balancer must always send user to same physical server User's session won't survive a server failure Switching to new server results in loss of client's state 19

Centralized sessions User can move freely between servers But always need to pull info from central store Web servers can crash User gets routed to another web server Approaches Shared file system Store in a database Store in an in-memory cache e.g. Memcached 20

No sessions Put all information in the cookie Ultimate in horizontal scalability Browser "nodes" scale with your users Free! Concerns: User may delete cookie User may modify cookie But you can encrypt and digitally sign Limits on amount of data Local to the browser, user may use multiple browsers 21

Scaling databases is hard Database scaling Distribute among many servers to maintain performance DB must obey ACID principles: Atomicity - transactions are all or none Consistency - transactions go from one valid state to another Isolation - no transaction can interfere with another one Durability - on failure, information must be accurate up to the last committed transaction ACID isn't too hard/expensive on a single machine: Using: shared memory, interthread/interprocess synch, shared file system Facilities are fast and reliable Distribute over a LAN or WAN, big performance problems! 22

Multimaster replication Database replication The holy grail of distributed databases Group of DBs, updates can occur on any DB BUT: doing this without loosening ACID, very expensive Two-phase commit between all the nodes Node attempting transaction notifies peers it is about to commit Peer prepare transaction and notify node they are ready to commit If everybody ready, node informs peers to commit Master-master replication For high-availability, not scalability Two servers connected via a low latency network Master-slave replication Mods only occur on master, changes propagate to slaves Can offer read-intensive applications linear speedups 23

Database example Master-master Core web app Core web app Core web app Core DB Core DB Slave DB Slave DB Content web Content web Content app web app app Slave DB Slave DB Content web Content web Content app web app app Remote cluster 1 Remote cluster 1 24

Horizontal partitioning Other database options Separate rows into separate tables Spreads read/writes, improves cache locality Vertical partitioning Split rows into multiple tables with fewer columns Allows queries to scan less data Sharding Unless you end up needing to do a join across tables Separate rows onto separate databases e.g. All customers west of the Mississippi Must determine which shard customer belongs to Trouble for queries/transactions involving multiple shards 25

Scaling web sites Summary High availability!= load balancing Scale vertically Scale horizontally More application servers Balanced via DNS/hardware/software Session management becomes harder The database is usually the big problem 26