CISC 7610 Lecture 5 Distributed multimedia databases. Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL

Similar documents
CISC 7610 Lecture 2b The beginnings of NoSQL

Introduction to NoSQL Databases

NoSQL Databases MongoDB vs Cassandra. Kenny Huynh, Andre Chik, Kevin Vu

CS 655 Advanced Topics in Distributed Systems

CA485 Ray Walshe NoSQL

CIT 668: System Architecture. Scalability

Distributed Data Store

Scaling for Humongous amounts of data with MongoDB

Overview. * Some History. * What is NoSQL? * Why NoSQL? * RDBMS vs NoSQL. * NoSQL Taxonomy. *TowardsNewSQL

Jargons, Concepts, Scope and Systems. Key Value Stores, Document Stores, Extensible Record Stores. Overview of different scalable relational systems

CompSci 516 Database Systems

NOSQL EGCO321 DATABASE SYSTEMS KANAT POOLSAWASD DEPARTMENT OF COMPUTER ENGINEERING MAHIDOL UNIVERSITY

CMU SCS CMU SCS Who: What: When: Where: Why: CMU SCS

Chapter 24 NOSQL Databases and Big Data Storage Systems

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2015 Lecture 14 NoSQL

Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases

Database Architectures

10. Replication. Motivation

CS November 2017

big picture parallel db (one data center) mix of OLTP and batch analysis lots of data, high r/w rates, 1000s of cheap boxes thus many failures

Introduction to Computer Science. William Hsu Department of Computer Science and Engineering National Taiwan Ocean University

Extreme Computing. NoSQL.

CS November 2018

SCALABLE CONSISTENCY AND TRANSACTION MODELS

Scalability of web applications

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems

Bigtable. Presenter: Yijun Hou, Yixiao Peng

NoSQL systems: sharding, replication and consistency. Riccardo Torlone Università Roma Tre

NewSQL Databases. The reference Big Data stack

! Design constraints. " Component failures are the norm. " Files are huge by traditional standards. ! POSIX-like

MapReduce & BigTable

Advances in Data Management - NoSQL, NewSQL and Big Data A.Poulovassilis

The Google File System

Bigtable: A Distributed Storage System for Structured Data By Fay Chang, et al. OSDI Presented by Xiang Gao

Final Exam Logistics. CS 133: Databases. Goals for Today. Some References Used. Final exam take-home. Same resources as midterm

CIT 668: System Architecture. Distributed Databases

DATABASE SCALE WITHOUT LIMITS ON AWS

NoSQL Databases. Amir H. Payberah. Swedish Institute of Computer Science. April 10, 2014

Integrity in Distributed Databases

Rule 14 Use Databases Appropriately

Architekturen für die Cloud

CIB Session 12th NoSQL Databases Structures

COSC 416 NoSQL Databases. NoSQL Databases Overview. Dr. Ramon Lawrence University of British Columbia Okanagan

Distributed KIDS Labs 1

Goal of the presentation is to give an introduction of NoSQL databases, why they are there.

Megastore: Providing Scalable, Highly Available Storage for Interactive Services & Spanner: Google s Globally- Distributed Database.

CS-580K/480K Advanced Topics in Cloud Computing. NoSQL Database

Introduction to Distributed Data Systems

Introduction to NoSQL

A Study of NoSQL Database

MongoDB and Mysql: Which one is a better fit for me? Room 204-2:20PM-3:10PM

BigTable: A Distributed Storage System for Structured Data

CLOUD-SCALE FILE SYSTEMS

Bigtable: A Distributed Storage System for Structured Data by Google SUNNIE CHUNG CIS 612

Azure-persistence MARTIN MUDRA

Database Architectures

CSE 344 JULY 9 TH NOSQL

Relational databases

4 Myths about in-memory databases busted

5/2/16. Announcements. NoSQL Motivation. The New Hipster: NoSQL. Serverless. What is the Problem? Database Systems CSE 414

Data Modeling and Databases Ch 14: Data Replication. Gustavo Alonso, Ce Zhang Systems Group Department of Computer Science ETH Zürich

Database Systems CSE 414

Page 1. Key Value Storage"

Data Informatics. Seon Ho Kim, Ph.D.

Google File System. Arun Sundaram Operating Systems

Distributed Data Analytics Partitioning

HyperDex. A Distributed, Searchable Key-Value Store. Robert Escriva. Department of Computer Science Cornell University

Distributed File Systems II

How do we build TiDB. a Distributed, Consistent, Scalable, SQL Database

Distributed Systems. 19. Spanner. Paul Krzyzanowski. Rutgers University. Fall 2017

GridGain and Apache Ignite In-Memory Performance with Durability of Disk

NoSQL Databases An efficient way to store and query heterogeneous astronomical data in DACE. Nicolas Buchschacher - University of Geneva - ADASS 2018

Scaling Without Sharding. Baron Schwartz Percona Inc Surge 2010

Topics. Big Data Analytics What is and Why Hadoop? Comparison to other technologies Hadoop architecture Hadoop ecosystem Hadoop usage examples

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2017)

Scaling with mongodb

Bigtable: A Distributed Storage System for Structured Data. Andrew Hon, Phyllis Lau, Justin Ng

Challenges for Data Driven Systems

Building Consistent Transactions with Inconsistent Replication

CS October 2017

Bigtable. A Distributed Storage System for Structured Data. Presenter: Yunming Zhang Conglong Li. Saturday, September 21, 13

Consistency in Distributed Storage Systems. Mihir Nanavati March 4 th, 2016

Architecture of a Real-Time Operational DBMS

Cassandra, MongoDB, and HBase. Cassandra, MongoDB, and HBase. I have chosen these three due to their recent

Advanced Data Management Technologies

Advances in Data Management - NoSQL, NewSQL and Big Data A.Poulovassilis

Modern Database Concepts

CSE-E5430 Scalable Cloud Computing Lecture 9

Document Sub Title. Yotpo. Technical Overview 07/18/ Yotpo

Database Management Systems

Next-Generation Cloud Platform

BigTable: A Distributed Storage System for Structured Data (2006) Slides adapted by Tyler Davis

Google File System. Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung Google fall DIP Heerak lim, Donghun Koo

Migrating Oracle Databases To Cassandra

Advanced Database Technologies NoSQL: Not only SQL

The Google File System

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

Traditional RDBMS Wisdom is All Wrong -- In Three Acts. Michael Stonebraker

CSE 444: Database Internals. Lectures 26 NoSQL: Extensible Record Stores

Transcription:

CISC 7610 Lecture 5 Distributed multimedia databases Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL

Motivation YouTube receives 400 hours of video per minute That is 200M hours per year At 12 GB/hour (for H.264 HD quality) That is 2.6 Exabytes (2,600,000 TB) per year Which is more than one machine can handle So how do we spread this across multiple machines? http://www.reelseo.com/vidcon-2015-strategic-insights-tactical-advice/

Scaling up vs scaling out Scaling up: buy a bigger server Pro: Code stays pretty much the same Con: Expensive, hard limits Scaling out: buy more servers Pro: Much cheaper, soft limits Con: Much more complicated code (distributed systems)

Example: Plenty of fish PlentyOfFish.com: ad-funded dating site 1.2 billion page views per month 500,000 average unique logins per day 30+ million hits per day (500-600 per second) Top 30 site in the US, top 10 in Canada 5 servers (2 application, 3 DB) $10M in yearly revenue 1 employee http://blog.codinghorror.com/my-scaling-hero/

New database server Scaling up: buy a bigger server HP ProLiant DL785: $100,000 CPU: 32, RAM: 512 GB, Disk: 4 TB Space: 7 rack units, Power: $1600/yr, MS Licenses: $10k Scaling out: buy more servers Lenovo ThinkServer RS110, 8 GB RAM, quad-core CPU: $1200 Can get 83 of these for $100,000 CPU: 332, RAM: 664 GB, Disk: 40 TB Space: 83U, Power: $22k/yr, MS Licenses: $80k http://blog.codinghorror.com/scaling-up-vs-scaling-out-hidden-costs/

Scaling out: Replication vs partitioning Initial system 100 Trans/s Scale up 200 Trans/s 100 1x 200 2x Scale out Partitioning 200 Trans/s Scale out? Replication 200 Trans/s 100 1x 100 2x 100 100 1x 100 2x

Replication: copy and coordinate Replication maintains identical copies of data on multiple machines Reads can come from any machine Writes must be applied to all machines Scale out? Replication 200 Trans/s 100 100 100 2x 2x

Purpose of replication Data distribution Geographical diversity for lower latency and redundancy Load balancing Spread requests among multiple servers Backups and recovery Make and restore copies without downtime High availability Hot spare for fast recovery

Types of replication Eager / synchronous Transaction waits for all replicas to be updated Maintains consistency, but can cause delays Lazy / eventual / asynchronous Transaction waits for one replica to be updated Changes propagated to other replicas eventually Faster, but can lead to conflicts between replicas modified in different ways

Write Master/slave replication Only master replica accepts writes Avoid consistency issues Sends updates to others Single point of failure All replicas serve reads If master goes down, another replica can be promoted Write Write Read

Partitioning Sometimes, data can be divided into uncoupled or loosely coupled partitions Then scaling to more machines just requires dividing into more partitions Horizontal partitioning: divide relations by ID Also known as sharding Vertical partitioning: divide relations by attributes Compare to database normalization

Partitioning example ID Name Zipcode Thumbnail Photo 1 David 02138 [3kb] [2MB] 2 Jared 43201 [3kb] [2MB] 3 Sue 94110 [3kb] [2MB] 4 Simon 19119 [3kb] [2MB] 5 Richard 98105 [3kb] [2MB]

Vertical Partitioning example ID Name Zipcode Thumbnail Photo 1 David 02138 [3kb] [2MB] 2 Jared 43201 [3kb] [2MB] 3 Sue 94110 [3kb] [2MB] 4 Simon 19119 [3kb] [2MB] 5 Richard 98105 [3kb] [2MB]

Horizontal Partitioning example ID Name Zipcode Thumbnail Photo 1 David 02138 [3kb] [2MB] 2 Jared 43201 [3kb] [2MB] 3 Sue 94110 [3kb] [2MB] 4 Simon 19119 [3kb] [2MB] 5 Richard 98105 [3kb] [2MB]

Horizontal Partitioning advantages Higher write bandwidth than replication All shards accept writes So N times higher capacity Higher scalability than replication Continue to sub-divide shards to scale up without limit

Horizontal Partitioning disadvantages Re-balancing is necessary and costly When one shard grows too large When adding new machines Cross-shard joins are slow or impossible Additional reliance on network Shards could be in separate data centers (US vs Europe)

Re-balancing shards 4TB 4TB 4TB 0TB 3TB 3TB 3TB 3TB

Scalability How hard is it to double your current capacity? Capacity for traffic, storage, transactions Capacity for read or write operations Independent of current processing speed http://highscalability.com/blog/2010/5/26/end-to-end-performance-study-of-cloud-services.html

Brewer's CAP theorem These three properties cannot be achieved by a distributed system simultaneously Strong Consistency: All clients see the same data at the same time Availability: All requests receive a response as to their success or failure Partition tolerance: The system continues to function in the event of network failures

Brewer's real CAP theorem A node fails to communicate with another node to keep it in sync (P) It can decide to Go ahead anyway, sacrificing consistency (C) Wait for the other node, sacrificing availability (A) Business considerations: availability > consistency Take the customer's order and sort it out later if necessary

Partitions are inevitable A network is partitioned when a component fails and a cluster is divided in two Want applications to keep operating Can't tell a partition from a node going down

Sacrificing availability Wait until all nodes can synchronize Amazon claim that just an extra one tenth of a second on their response times will cost them 1% in sales. Google said they noticed that just a half a second increase in latency caused traffic to drop by a fifth. Examples: Multi-master DBs, Neo4j, Google BigTable http://www.julianbrowne.com/article/viewer/brewers-cap-theorem

Sacrificing consistency Go ahead with update (Eventual consistency) Problems Pushes complexity from database into application When is eventually? Examples Domain name service Facebook's Cassandra and Voldemort CouchDB

NoSQL vs NewSQL NoSQL: restrictive interpretation of CAP theorem Throw out ACID transactions with SQL In order to increase scalability NewSQL: more nuanced interpretation of CAP Regain ACID transactions and SQL Maintain scalability by optimizing for quick, localized transactions SQL is just the query language, independent of CAP And still need a way to query

Types of NoSQL Databases Key-value store Key-document store Column-family stores Graph databases (again)

Key-value store: Memcached and Redis Memcached: key-value store Redis: key-structure store Key1 Value1 Key1 [1,2,5,2,1] Key2 Value2 Key2 {'a':1, 'b':2} Key3 Key4 Value3 Value4 Key3 7 Key4 (1,2,5) Can only query on one attribute (key) But that is sufficient for many applications Especially for de-normalized data Redis allows additional atomic operations on values Very easy to scale

Document store: CouchDB Stores arbitrary documents (schema-less) Indexes various aspects of each document for querying Eventual consistency through multi-version concurrency control Writes create new versions of documents instead of waiting for locks

Column-family store: BigTable "contents:" "anchor:cnnsi.com" "anchor:my.look.ca" "com.cnn.www" "<html>..." "<html>..." "<html>..." t "CNN" t 9 "CNN.com" t8 5 t 6 t 3 Maps (rowid, columnid, timestamp) to data Stores keys in sorted order to allow range queries Heavy use of sharding through tablets No transactions Chang, Fay, et al. "Bigtable: A distributed storage system for structured data." ACM Transactions on Computer Systems (TOCS) 26.2 (2008): 4.

NewSQL: Google F1 Adds transactions to BigTable. Lets application developers deal with transaction bottlenecks Key ideas Scalability: auto-sharded Availability & Consistency: synchronous replication High commit latency that can be hidden Single unified database running AdWords: 10s of TBs, 1000s of machines http://www.slideshare.net/dmconf/f1-the-distributed-sql-database-supporting-googles-ad-business -bart-samwell

NewSQL: VoltDB Uses relational data model Uses SQL as its primary interface Targeted at applications with transactions that are Short-lived (i.e., no user stalls) Touch a small subset of data using index lookups (i.e., no full table scans or large distributed joins) Are repetitive (i.e. executing the same queries with different inputs) In-memory Based on stored procedures (Java + SQL)

Summary Scaling up is easier, but scaling out is more sustainable in the long term Replication copies data, allowing parallel reads Partitioning divides up data to allow parallel writes CAP theorem says that you must choose between availability and consistency NoSQL sacrifices ACID transactions for scalability NewSQL maintains ACID transactions with scalability

Further reading http://faculty.cs.nku.edu/~waldenj/classes/2014/spr ing/cit668/ http://www.aosabook.org/en/nosql.html http://www.slideshare.net/grishaweintraub/cap-2 8353551 Chang, Fay, et al. "Bigtable: A distributed storage system for structured data." ACM Transactions on Computer Systems (TOCS) 26.2 (2008): 4. http://www.slideshare.net/dmconf/f1-the-distribut ed-sql-database-supporting-googles-ad-business-ba rt-samwell