question
stringclasses
1 value
answer
stringlengths
576
1.59k
source
stringclasses
1 value
No question: Moodle
cap theorem & kvs martijn de vos week 10 - cs - 460 cs - 460 1 modern web workloads • web - based applications cause spikes • data : large and unstructured • random reads and writes ; sometimes write - heavy ( e. g., finance apps ) • joins infrequent challenges with rdbms • not designed for distributed environments • s...
EPFL CS 460 Moodle
No question: Moodle
consistency matter? consistency : every read receives the most recent write or an error cs - 460 7 use case what you expect ( consistency ) what could go wrong ( inconsistency ) app transfer €500 via your phone, it instantly shows up on your desktop app too. your balance looks updated on your phone but not on your desk...
EPFL CS 460 Moodle
No question: Moodle
##sea cable cut sea - me - we 5 cable incident ( 2024 ) connectivity loss between regions dns outage dyn ddos attack ( 2016 ) users can ’ t resolve hostnames bgp configuration error facebook outage ( 2021 ) outage of facebook and subsidiaries take - away : parnnons actually happen in real - world seongs cap combination...
EPFL CS 460 Moodle
No question: Moodle
eventually consistent • copies becomes consistent at some later time if there are no more updates to that data item cs - 460 13 [ https : / / www. guru99. com / sql - vs - nosql. html ] key takeways 1. choose the right guarantee for the right task ( cp vs. ap ) 2. partition tolerance is non - negotiable in the cap theo...
EPFL CS 460 Moodle
No question: Moodle
value post _ id ( x. com, facebook. com ) post content, author, timestamp item _ id ( amazon. com ) name, price, stock info flight _ no ( expedia. com ) route, availability, price account _ no ( bank. com ) balance, transactions, owner key - value is a powerful abstraction powering the modern web the key - value abstra...
EPFL CS 460 Moodle
No question: Moodle
, a ` er dynamo ( 2007 ) and bigtable ( 2006 ) cs - 460 21 cassandra cs - 449 22 • a distributed key - value store • many companies use cassandra in their production clusters • ibm, adobe, hp, ebay, ericsson, symantec, twitter, spotify, netflix • scalable data model : data split across nodes • cap : availability and pa...
EPFL CS 460 Moodle
No question: Moodle
- 460 25 data model ( 2 / 4 ) cs - 460 26 settings settings name value timestamp column column family keyspace type data model ( 3 / 4 ) cs - 460 27 feature rdbms cassandra organization database → table → row keyspace → column family → column row structure fixed schema dynamic columns column data name, type, value name...
EPFL CS 460 Moodle
No question: Moodle
… super column k : termk row key < user id > super column 1 super column k column family ( user 1 ) super column 1 super column k column family ( user 2 ) facebook inbox search • primary key : userid • recipients id ’ s : super columns • columns within the super columns : messageid cs - 460 31 m msgidi m msgidj m msgid...
EPFL CS 460 Moodle
No question: Moodle
inter. alice sends “ hello ” to bob ( msgid : ab ) cassandra architecture • decentralized, peer - to - peer architecture • easy to scale : add / remove nodes • read / write requests can go to any replica node • reads and write have a configurable consistency level cs - 460 34 cassandra architecture 1. partitioning 2. l...
EPFL CS 460 Moodle
No question: Moodle
n : determines how many copies of the data exist • each data item is replicated at n nodes • various replication strategies • example with n = 2 ( right ) cs - 460 38 38 1 2 3 4 0 - 32 32 - 64 96 - 128 64 - 96 write “ user123 ” 1 2 h ( “ user123 ” ) = 35 3 route write to responsible nodes cassandra : replication strate...
EPFL CS 460 Moodle
No question: Moodle
set cassandra : writes ( 2 / 2 ) • always writable : hinted mechanism • if any replica is down, the coordinator writes to all other replicas, and keeps the write locally unnl the down replica comes back up. • when all replicas are down, the coordinator ( front end ) writes ( for up to a few hours ). cs - 460 41 - world...
EPFL CS 460 Moodle
No question: Moodle
commit log is full • another thread flushes all the marked memtables • commit log segments of the flushed memtable are marked for recycling • a bloom filter and index are created cs - 460 44 bloom filters • compact way of representing a set of items • checking for existence ( membership ) in set is cheap • probability of ...
EPFL CS 460 Moodle
No question: Moodle
to be updated automatically as servers join, leave, and fail • membership protocol • efficient anti - entropy gossip - based protocol • p2p protocol to discover and share location and state information about other nodes in a cassandra cluster cs - 460 47 cassandra : membership management ( 2 / 2 ) 1 1 10120 66 2 10103 ...
EPFL CS 460 Moodle
No question: Moodle
r = # of nodes in read quorum w = # of nodes in write quorum constraints ( for strong consistency ) : r + w > n most recent write is always read quorum = getting agreement from a committee – you don ’ t need everyone, just a majority quorums : example 51 let : n = 5 r = 3 w = 3 consistency cs - 460 1 2 3 5 4 read quoru...
EPFL CS 460 Moodle
No question: Moodle
multiple data center support • nosql appropriate datastructures for many big data applications • distributed key - value stored widely used in production • uses many algorithms from p2p systems and distributed computing key takeaways 1. designing distributed systems is all about trade - offs 2. designing for scale requ...
EPFL CS 460 Moodle
No question: Moodle
big table cassandra week 9 distributed messaging systems kafka – week 11 structured data spark sql graph data pregel, graphlab, x - streem, chaos machine learning week 12 batch data map reduce, dryad, spark streaming data storm, naiad, flink, spark streaming google data flow scheduling ( mesos, yarn ) - week 10 query o...
EPFL CS 460 Moodle
No question: Moodle
460 13 characteristics • aggregate resources • scalability • speed • reliability • at the price of • complexity • cost of maintenance cs 460 14 why are they more complex? • no global clock ; no single global notion of the correct time ( asynchrony ) • unpredictable failures of components : lack of response may be due t...
EPFL CS 460 Moodle
No question: Moodle
- nodes are promoted to active components • nodes participate, interact, contribute to the services they use. • harness huge pools of resources accumulated in millions of end - nodes. • avoid a central / master entity • irregularities and dynamicity are treated as the norm cs 460 the internet : a decentralized system c...
EPFL CS 460 Moodle
No question: Moodle
, v3 nodes operations : send ( ) p2p overlay network p2p infrastructure ensures mapping between keys and physical nodes 25 distributed hash table k6, v6 k1, v1 k5, v5 k2, v2 k4, v4 k3, v3 nodes operations : send ( m, k ) p2p overlay network • message sent to keys : implementation of a dht • p2p infrastructure ensures m...
EPFL CS 460 Moodle
No question: Moodle
##ds ( uniform random ) invariant : node with numerically closest nodeid maintains object. 29 pastry • naming space : • ring of 128 bit integers • nodeids chosen at random • key / node mapping • key associated to the node with the numerically closest node id • routing table • leaf set • 8 or 16 closest numerical neighb...
EPFL CS 460 Moodle
No question: Moodle
table ( # 65a1fcx ) 0 x 1 x 2 x 3 x 4 x 5 x 7 x 8 x 9 x a x b x c x d x e x f x 6 0 x 6 1 x 6 2 x 6 3 x 6 4 x 6 6 x 6 7 x 6 8 x 6 9 x 6 a x 6 b x 6 c x 6 d x 6 e x 6 f x 6 5 0 x 6 5 1 x 6 5 2 x 6 5 3 x 6 5 4 x 6 5 5 x 6 5 6 x 6 5 7 x 6 5 8 x 6 5 9 x 6 5 b x 6 5 c x 6 5 d x 6 5 e x 6 5 f x 6 5 a 0 x 6 5 a 2 x 6 5 a 3 x ...
EPFL CS 460 Moodle
No question: Moodle
of entry : cs 460 routing algorithm ( on node a ) b a shl d l d l / b l l,, i r, r l i b i l b and a between prefix shared the of length : ), ( key of digits the of value : leafset in the nodeid closest ith : 128 0 line 2 0 table routing the of entry : leaf set cs 460 36 node departure • explicit departure or failure •...
EPFL CS 460 Moodle
No question: Moodle
network proximity metric : • closest topological node • satisfying the constraints of the routing table routetable ( i, j ) : • nodeid corresponding to the current nodeid courant up to level i • next digit = j • nodes are close at the top level of the routing table • random nodes at the bottom levels of the routing tab...
EPFL CS 460 Moodle
No question: Moodle
per - hop distance normal routing tables perfect routing tables no locality 1. 59 slower than ip on average cs 460 references • antony i. t. rowstron, peter druschel : pastry : scalable, decentralized object location, and routing for large - scale peer - to - peer systems. middleware 2001 : 329 - 350 • ion stoica, robe...
EPFL CS 460 Moodle
No question: Moodle
) nosql db dynamo big table cassandra week 9 distributed messaging systems kafka – week 11 structured data spark sql graph data pregel, graphlab, x - streem, chaos machine learning week 12 batch data map reduce, dryad, spark streaming data storm, naiad, flink, spark streaming google data flow scheduling ( mesos, yarn )...
EPFL CS 460 Moodle
No question: Moodle
my writes see all writes performed by reader bounded staleness see all “ old ” writes consistency requirements in a volley - ball game • the first team to reach 25 points and by at least two points wins a set ( for the first 4 sets ) • the first team to reach 15 points and by at least two points wins the 5th set • the ...
EPFL CS 460 Moodle
No question: Moodle
2 : 1 21 - 23 2 : 1 22 - 23 2 : 1 23 - 23 2 : 1 24 - 23 2 : 1 25 - 23 3 : 1 reader # 1 3 : 1 2 : 1 20 : 23 home - visitors reader # 2 3 : 1 eventual consistency eventually, in the absence of operations, replicas will be consistent guarantee : see some previous writes. eventually ( in the absence of new writes ), all th...
EPFL CS 460 Moodle
No question: Moodle
value of a data item x, any successive operation on x by that process will always return the same or a more recent value guarantee : see increasing subset of previous writes ( local guarantee from a given reader ) reader # 1 at time t2 cs 460 58 2 : 1 20 - 22 2 : 1 20 - 23 2 : 1 21 - 23 2 : 1 22 - 23 2 : 1 23 - 23 2 : ...
EPFL CS 460 Moodle
No question: Moodle
can be eventually - consistent. reader # 2 official score keeper cs 460 60 suppose visitor score read ( visitor _ score ) write ( visitor _ score. update ) read my writes ( single score keeper ) strong consistency otherwise referee cs 460 61 4th set, home scores @ 24 vs = read ( visitor _ score ) ; hs = read ( home _ s...
EPFL CS 460 Moodle
No question: Moodle
writes strong eventual conclusions • different clients want different guarantees • one client might want different guarantees for different reads • several models can be applied • strong consistency would do but is prohibitive performance wise • use the lowest consistency ( to the left ) consistency model that is “ cor...
EPFL CS 460 Moodle
No question: Moodle
##sos, yarn ) - week 10 query optimization storage hierarchies & layouts transaction management query execution dissemination - multicast • key feature in distributed computing cs - 460 5 consistency protocols event dissemination fault - tolerant dissemination cs - 460 6 atomicity : 100 % nodes receive the message trad...
EPFL CS 460 Moodle
No question: Moodle
- 460 15 r z n z y r r r round prior to processes infected of number the is / = ) ( n z p r = infect forever model n. t. j. bailey, the mathematical theory of infectious diseases and its applications, 2nd ed., hafner press, 1975. probability of “ atomic ” infection is connected is graph random a ity that probabibil the...
EPFL CS 460 Moodle
No question: Moodle
) ~ 10 log ( 1m ) ~ 20 log ( 1b ) ~ 30 performance ( 100, 000 peers ) 0 0. 1 0. 2 0. 3 0. 4 0. 5 0. 6 0. 7 0. 8 0. 9 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 f proportion of connected peers in non “ atomic ” broadcast proportion of “ atomic ” broadcast cs - 460 18 proportion of nodes who received the message in non ...
EPFL CS 460 Moodle
No question: Moodle
we do this in a decentralized way? cs - 460 22 achieving random topologies cs - 460 23 the peer sampling service • how to create a graph upon which applying gossip - based dissemination?... by gossiping • goal : • create an overlay network • provide each peer with a random sample of the network in a decentralized way •...
EPFL CS 460 Moodle
No question: Moodle
information periodically to update their own membership information • reflect the dynamics of the system • ensures connectivity • each peer maintains a local view ( membership table ) of c entries • network @ ( ip @ ) • age ( freshness of the descriptor ) • each entry is unique • ordered list • active and passive threa...
EPFL CS 460 Moodle
No question: Moodle
buffer to p else send { } to p / / triggers response if pull then receive buffer from p view. selectview ( c, h, s, buffer ) view. increaseage ( viewp ) cs - 460 31 passive thread do forever receive bufferp from p if pull then mydescriptor < - ( my @, 0 ) buffer < - merge ( view, { mydescriptor } ) view. permute ( ) mo...
EPFL CS 460 Moodle
No question: Moodle
pulling alone is pretty bad : a node has no opportunity to insert information on itself. potential loss of all incoming connections. cs - 460 35 design space : data exchange • buffer ( h ) • initialized with the descriptor of the gossiper • contains c / 2 elements • ignores h “ oldest ” • communication model • push : b...
EPFL CS 460 Moodle
No question: Moodle
2008 40 example b x d l i j a v x g 1. buffer appended to view 2. keep the freshest entry for each node b d l i j a v x g nov. 2008 41 example b d l i j a v x g 1. buffer appended to view 2. keep the freshest entry for each node 3. h ( = 0 ) oldest items removed b d l i j a v x g nov. 2008 42 example b d l i j a v g 1....
EPFL CS 460 Moodle
No question: Moodle
& al jnsm 2005 ] • node selection : random • data exchange : pushpull • data processing : shuffle cs - 460 degree distribution f = 30 in a 10. 000 node system metrics • degree distribution • average path length • clustering coefficient a generic gossip - based substrate cs - 460 45 gossip - based generic substrate • ea...
EPFL CS 460 Moodle
No question: Moodle
##tokeep : add received entries to local view cs - 460 47 gossip - based dissemination data exchanged data processing peer selection message k random how can we achieve random sampling? dissemination data = msg to broadcast each process gossips one message once cs - 460 48 topology maintenance data exchange membership ...
EPFL CS 460 Moodle
No question: Moodle
value 0 but the initiator • global average = 1 / n • size of the network can be easily deduced • robust implementation • multiple nodes start with their identifier • each concurrent instance led by a node • message and data of an instance tagged with a unique id cs - 460 53 ordered slicing • create and maintain a parti...
EPFL CS 460 Moodle
No question: Moodle
evaluation of unstructured gossip - based implementation » m. jelasity, r. guerraoui, a. - m. kermarrec and m. van steen, middleware 2004 – acm tocs 2007 • « newscast computing » m. jelasity, w. kowalczyk, m. van steen. internal report ir - cs - 006, vrije universiteit, department of computer science, november 2003 • «...
EPFL CS 460 Moodle
No question: Moodle
##rmarrec cs - 460 1 where are we? cs - 460 2 consistency protocols cap theorem week 9 gossip protocols week 7 distributed / decentralized systems week 8 - 12 data science software stack data processing ressource management & optimization data storage distributed file systems ( gfs ) nosql db dynamo big table cassandra...
EPFL CS 460 Moodle
No question: Moodle
5 6 3 3 8 • maintain tasks in a queue in order of arrival • when processor free, dequeue head and schedule it fifo scheduling ( first in first out ) fifo / fcfs performance • average completion time may be high • for our example on previous slides, • average completion time of fifo / fcfs = ( task 1 + task 2 + task 3 )...
EPFL CS 460 Moodle
No question: Moodle
task at queue head • pre - empts processes by saving their state, and resuming later • after pre - empting, add to end of queue task 1 15 ( task 3 done ) … cs - 460 9 round - robin vs. stf / fifo • round - robin preferable for • interactive applications • user needs quick responses from system • fifo / stf preferable f...
EPFL CS 460 Moodle
No question: Moodle
mesos “ a platform for fine - ‐ grained resource sharing in the data center “ benjamin hindman, andy konwinski, matei zaharia, ali ghodsi, anthony joseph, randy katz, scott shenker, ion stoica university of california, berkeley usenix 2011 cs - 460 15 mesos cs - 460 16 coexistence of multiple applications • ex : fb - >...
EPFL CS 460 Moodle
No question: Moodle
, anthony joseph, randy katz, scott shenker, ion stoica. usenix 2011 ressource offers • delegates control over scheduling to the frameworks • offer available resources to frameworks, let them pick which resources to use and which tasks to launch • keeps mesos simple, lets it support future frameworks • high utilization...
EPFL CS 460 Moodle
No question: Moodle
compared performance with statically partitioned cluster where each framework gets 25 % of nodes framework speedup on mesos facebook hadoop mix 1. 14× large hadoop mix 2. 10× spark 1. 26× torque / mpi 0. 96× from arka bhattacharya cs - 460 25 • ran 16 instances of hadoop on a shared hdfs cluster • used delay scheduling...
EPFL CS 460 Moodle
No question: Moodle
/ n of the shared resource. generalized by max - min fairness. • handles if a user wants less than its fair share. • e. g., user a wants no more than 20 %. generalized by weighted max - min fairness • give weights to users according to importance. • e. g., user a gets weight 1, user b weight 2. cs - 460 30 max - min fa...
EPFL CS 460 Moodle
No question: Moodle
• user a wants 1cpu per task • user b wants 2cpu per task • multi - resource example • 2 resources : cpus and mem • user a wants 1cpu ; 2gb per task • user b wants 2cpu ; 4gb per task cs - 460 34 a natural policy ( 1 / 2 ) fairness : give weights to resources ( e. g., 1 cpu = 1 gb ) and equalize total value given to ea...
EPFL CS 460 Moodle
No question: Moodle
85 % ) ) • user a gets less than 50 % of both cpu and ram. • better off in a separate cluster with half the resources cs - 460 36 challenge : can we find a fair sharing policy that provides share guarantee & strategy - proofness can we generalize max - min fairness to multiple resources? dominant - resource fair schedu...
EPFL CS 460 Moodle
No question: Moodle
dominant share is 25 %. cs - 460 40 dominant resource fairness ( drf ) ( 2 / 2 ) • apply max - min fairness to dominant shares : give every user an equal share of her dominant resource. • equalize the dominant share of the users. • total resources : ( 9cpu ; 18gb ) • user a wants ( 1cpu ; 4gb ) for each task ; dominant...
EPFL CS 460 Moodle
No question: Moodle
• next : assign to user b step 2 : assign 1 task to user b • a : 1 cpu, 4 gb → 22. 2 % • b : 3 cpu, 1 gb → 3 / 9 = 33. 3 % • next : a ( smaller dominant share ) step 3 : a gets 2nd task • a : 2 cpu, 8 gb → 8 / 18 = 44. 4 % • b : 3 cpu, 1 gb → 33. 3 % • next : b user a wants ( 1cpu ; 4gb ) user b wants ( 3cpu ; 1gb ) to...
EPFL CS 460 Moodle
No question: Moodle
, the % of its dominant resource type that it gets cluster - wide, is the same for all jobs • job 1 ’ s % of ram = job 2 ’ s % of cpu • can be written as linear equations, and solved drf fairness cs - 460 45 • drf generalizes to multiple jobs • drf also generalizes to more than 2 resource types • cpu, ram, network, dis...
EPFL CS 460 Moodle
No question: Moodle
##oop yarn : yet another resource negotiator ", acm cloud computing 2013 • p delgado, f dinu, am kermarrec, w zwaenepoel, “ hawk : hybrid datacenter scheduling ”, usenix atc, 2015 cs - 460 48 hawk : hybrid datacenter scheduling usenix, atc 2015 cs - 460 49 centralized schedulers cs - 460 50 centralized schedulers cs - ...
EPFL CS 460 Moodle
No question: Moodle
work stealing cs - 460 67 under high load - > high probablity of contacting high - loaded nodes steal from them hawk : cluster partitioning cs - 460 68 hawk : cluster partitioning cs - 460 69 references • b. hindman et al., “ mesos : a platform for fine - grained resource sharing in the data center ", usenix 2011 • a. ...
EPFL CS 460 Moodle
No question: Moodle
data spark sql graph data pregel, graphlab, x - streem, chaos machine learning week 12 batch data map reduce, dryad, spark streaming data storm, naiad, flink, spark streaming google data flow scheduling ( mesos ) - week 10 query optimization storage hierarchies & layouts transaction management query execution stream pr...
EPFL CS 460 Moodle
No question: Moodle
results • do not need to accumulate data for processing • streaming operators typically require less memory • disadvantages of stream processing • some operators are harder to implement with streaming • stream algorithms are often approximations cs - 460 6 example • recommender system • every time someone loads a page ...
EPFL CS 460 Moodle
No question: Moodle
( subscriptions ) • a set of publishers / producers issue some events ( events ) • publish - subscribe system 1. manages users subscriptions 2. matches published events against subscriptions 3. disseminate events to matching subscribers ( and no others ) • flexible and seamless messaging substrate for applications subs...
EPFL CS 460 Moodle
No question: Moodle
subscriptions ( subscribe / uns ubscribe ) event dissemination subscriber publish ( ) notify ( ) synchronization decoupling : producers are not blocked upon publication, subscribers are asynchronously notified pub - sub systems : expressiveness • differences in subscription expressiveness • topic - based ~ application ...
EPFL CS 460 Moodle
No question: Moodle
overlay network used for group naming and group localization • flooding - based multicast [ can multicast ] : • creation of a specific network for each group • message flooded along the overlay links • tree - based multicast [ bayeux, scribe ] • creation of a tree per group • flooding along the tree branches cs - 460 2...
EPFL CS 460 Moodle
No question: Moodle
packets are replicated low in the tree cs - 460 24 scribe : join ( group ) 1100 1101 1001 0100 0111 1011 1111 1100 0111 0100 1000 1111 1000 1101 1001 1011 cs - 460 25 scribe : message dissemination multicast ( group, m ) • routing through pastry to the root key = groupeid • flooding along the tree branches from the roo...
EPFL CS 460 Moodle
No question: Moodle
##ip - mcast • stress on each network link • load on each node • number of entries in the routing table • number of entries in the forwarding tables • experimental set - up • georgia tech transit - stub model ( 5050 core routers ) • 100 000 nodes chosen at random among 500 000 • zipf distribution for 1500 groups • band...
EPFL CS 460 Moodle
No question: Moodle
• good support for large - scale distributed applications • alm infrastructure • scribe exhibits good performances / ip multicast • large size groups • large number of groups • good load - balancing properties cs - 460 kafka kafka : a distributed messaging system for log processing developed by linkedin, now apache, wr...
EPFL CS 460 Moodle
No question: Moodle
460 39 kafka in a nutshell • producers write data to brokers. • consumers read data from brokers ( pull model ) • distributed, run in a cluster • the data • data is stored in topics. • topics are split into partitions, which are replicated. 40 producer consumer producer broker broker broker broker consumer zk cs - 460 ...
EPFL CS 460 Moodle
No question: Moodle
##able cs - 460 43 kafka producer cs - 460 44 producer kafka broker consumer alice users topic publish “ alice ” to users topic topic, position append only ana jeanne consume “ alice ” to users topic kafka partitions cs - 460 45 producer kafka broker consumer alice users topic ana jeanne malo medhi partition 1 ( a - k ...
EPFL CS 460 Moodle
No question: Moodle
re - consume data. • delivery guarantees • kafka guarantees that messages from a single partition are delivered to a consumer in order. • there is no guarantee on the ordering of messages coming from different partitions. • kafka only guarantees at - least - once delivery ( the client needs to check for duplicate ) • k...
EPFL CS 460 Moodle
No question: Moodle
. zaharia et al., o'reilly media, 2018 - chapter 20 fundamentals of stream processing : application design, systems and analytics. h. andrade et al., cambridge university press, 2014 - chapter 1 - 5, 7, 9 high - availability algorithms for distributed stream processing. j. hwang et al., icde 2005 cs - 460 53 references...
EPFL CS 460 Moodle
No question: Moodle
content - addressable networks » ( 2001 ) lecture notes in computer science, ngc 2001 london. • d. kostic, a. rodriguez, j. albrecht, and a. vahdat. « bullet : high bandwidth data dissemination using an overlay mesh ». in 19th acm symposium on operating systems principles, october 2003. cs - 460 54 cs460 systems for da...
EPFL CS 460 Moodle
No question: Moodle
, convenient, and safe multi - user storage of and access to massive amounts of persistent data. reliable convenient safe multi - user massive persistent efficient extremely large ( often exabytes every day ) data outlives the programs that operate on it thousands of queries / updates per second 24x7 availability 6 wha...
EPFL CS 460 Moodle
No question: Moodle
/ privacy data integrity differential privacy cryptography data ethics biases ( data and algorithms ) impact on society regulations data engineering big data management data preparation large - scale deployment cs460 cs460 landscape 12 consistency protocols cap theorem gossip protocols distributed / decentralized syste...
EPFL CS 460 Moodle
No question: Moodle
science breadth coverage exercises put the course in practice programming skills exam preparation background for the project project acquaintance with a real platform going in depth intended as a practical work may not be related to every part of the course cs460 ta / ae team 15 hamish ( ta ) martijn ( head ta ) yi ( t...
EPFL CS 460 Moodle
No question: Moodle
##ggregated storage ) have been growing at a historic rate over the past 10 years 0 20 40 60 80 100 120 140 160 180 200 data size ( zb ) explore data efficiently data age 2025, data from idc global datasphere, nov 2018 33 % of data is inaccurate in some way processing technology grows much slower than data how much dat...
EPFL CS 460 Moodle
No question: Moodle
& data layout transaction management query execution 22 today ’ s topic ( simplified ) dbms architecture 23 recovery manager transaction manager files and access methods buffer management parser + optimizer + plan execution web forms application front ends sql interface sql commands storage management data today ’ s to...
EPFL CS 460 Moodle
No question: Moodle
like dram, low - latency loads and stores • like ssd, persistent writes and high density • byte - addressable dram nvm ssd • ssd technology uses non - volatile flash chips package multiple flash chips into a single closure • ssd controller embedded processor that executes firmware - level software bridges flash chips t...
EPFL CS 460 Moodle
No question: Moodle
heap files : best when typical access is a full file scan • sorted files : best for retrieval in an order, or for retrieving a ‘ range ’ • log - structured files : best for very fast insertions / deletions / updates 33 heap ( unordered ) files • simplest file structure – contains records in no particular order – need t...
EPFL CS 460 Moodle
No question: Moodle
sequential transfers. 37 writing to log - structured files – inserts : store the entire tuple – deletes : mark tuple as deleted – updates : store delta of just the attributes that were modified 38 log file insert id = 1, val = a insert id = 2, val = b delete id = 4 insert id = 3, val = c update val = x ( id = 3 ) … rea...
EPFL CS 460 Moodle
No question: Moodle
compaction ) – data can be lost if written but not checkpointed • dbms needs to address two issues – how to reconstruct tuples from logs efficiently – how to manage disk space with ever - growing logs 41 storage management : outline – storage technologies – file storage – buffer management ( refresher ) – page layout •...
EPFL CS 460 Moodle
No question: Moodle
is not in pool : – choose a frame for replacement ( only un - pinned pages are candidates ) – if frame is “ dirty ”, write it to disk – read requested page into chosen frame • pin the page and return its address. 45 * if requests can be predicted ( e. g., sequential scans ) pages can be pre - fetched several pages at a...
EPFL CS 460 Moodle
No question: Moodle
better in this situation ( but not in all situations, of course ). 48 sequential flooding – illustration 49 1 2 3 4 5 6 1 2 buffer pool lru : mru : repeated scan of file … buffer pool 1 2 4 3 5 2 4 3 5 6 4 3 5 6 4 1 5 6 2 1 1 2 4 3 1 2 5 3 1 2 6 3 1 2 6 3 1 2 6 3 3 4 5 6 5 1 2 3 4 6 1 2 “ clock ” replacement policy • a...
EPFL CS 460 Moodle
No question: Moodle
uniq > - > < page _ id, slot _ number > • page format should support – fast searching, inserting, deleting • page format depends on record format – fixed - length – variable - length 52 record formats : fixed - length • schema is stored in system catalog – number of fields is fixed for all records of a table – domain i...
EPFL CS 460 Moodle
No question: Moodle
and no longer fits? – shift all subsequent fields • if record no longer fits in page? – move a record to another page after modification • what if record size > page size? – limit allowed record size 57 storage management : outline – storage technologies – file storage – buffer management ( refresher ) – page layout • ...
EPFL CS 460 Moodle
No question: Moodle
compression algorithm – sequences of redundant data are stored as a single data value compression 63 dept hr hr sales it it cdept ( 2 x hr ) ( 1 x sales ) ( 2 x it ) compression ( 2 ) • bit - vector encoding : compact and constant - time test – useful when we have categorical data & useful when a few distinct values – ...
EPFL CS 460 Moodle
No question: Moodle
name from tbl where cdept = 1 – per - page dictionaries? • bit - vector encoding = > find the 1 ’ s directly from the bit vectors select count ( * ) from tbl where cdept = “ hr ” • run - length encoding = > batch processing ( aggregation ) dsm : writes • row insertions / deletions – affects all columns – multiple i / o...
EPFL CS 460 Moodle
No question: Moodle
friendly with slotted - pages nsm i / o pattern column “ stitching ” delay per - column tuple ids only relevant attributes to cache pax americana • dsm most suitable for analytical queries, but required major rewrites of existing dbms, and penalized transactions a lot. • pax replaces nsm in - place – monetdb / x100 ( v...
EPFL CS 460 Moodle
No question: Moodle
column store database systems. foundations and trends in databases, vol. 5, no. 3, pp. 227 - 263 only, 2013. available online at : stratos. seas. harvard. edu / files / stratos / files / columnstoresfntdbs. pdf • a. ailamaki et al. : weaving relations for cache performance. vldb 2001 • https : / / blog. twitter. com / ...
EPFL CS 460 Moodle
No question: Moodle
systems data science software stack data processing ressource management & optimization data storage distribute d file systems ( gfs ) nosql db dynamo big table cassandra distributed messging systems kafka structured data spark sql graph data pregel, graphlab, x - streem, chaos machine learning batch data map reduce, d...
EPFL CS 460 Moodle
No question: Moodle
at - a - time ) 6 iterator model ( volcano model ) each query operator implements a next function. • on each invocation, the operator returns either a single tuple or a marker that there are no more tuples • next calls next on the operator ’ s children to retrieve and process their tuples 7 common operator interface = ...
EPFL CS 460 Moodle
No question: Moodle
expression pred generator < tuple > next ( ) : for t in input. next ( ) : if pred ( t ) emit t class operator : generator < tuple > next ( ) example : iterator model 9 example : iterator model ( cont ) 10 1 2 3 4 5 ( interpreted ) expression evaluation nodes in the tree represent different expression types : • comparis...
EPFL CS 460 Moodle
No question: Moodle
to cover every table, datatype, query processing model the processing model of a dbms defines how the system executes a query plan. – different trade - offs for different workloads • extreme i : tuple - at - a - time via the iterator model • extreme ii : block - oriented model ( typically column - at - a - time ) 13 bl...
EPFL CS 460 Moodle
No question: Moodle
2 3 the ( output ) materialization problem – version 2 select name from tbl where age > 20 and dept = “ hr ” 17 name john jack jane age 22 19 37 dept hr hr it tbl tid 1 2 3 tbl > 20 = name john tid 1 3 tid 1 tid 1 tid as extra filter to reduce output! can we reduce it further? the ( output ) materialization problem – s...
EPFL CS 460 Moodle
No question: Moodle
calls - > no per - tuple overhead combined with columnar storage ▪cache - friendly ▪simd - friendly ▪ “ run same operation over consecutive data ” interpretation when evaluating expressions ( in most cases ) – typically use macros to produce 1000s of micro - operators (!!! ) • selection _ gt _ int32 ( int * in, int pre...
EPFL CS 460 Moodle
No question: Moodle
implements a next function • each operator emit a vector of tuples instead of a single tuple – vector - at - a - time, aka “ carry a crate of beers at a time ”! – the operator ’ s internal loop processes multiple tuples at a time. – vector size varies based on hardware or query properties • general idea : vector must f...
EPFL CS 460 Moodle
No question: Moodle
by 25 processing model the processing model of a dbms defines how the system executes a query plan. – different trade - offs for different workloads • extreme i : tuple - at - a - time via the iterator model • query compilation • vectorization model • extreme ii : block - oriented model ( typically column - at - a - ti...
EPFL CS 460 Moodle
No question: Moodle
for code generation transpilation • dbms converts a query plan into imperative source code • compile the produced code to generate native code with a conventional compiler jit compilation • generate an intermediate representation ( ir ) of the query that can be quickly compiled into native code. 30 transpilation use ca...
EPFL CS 460 Moodle
No question: Moodle
# predicate _ offset = # # # parameter _ value = # # # for t in range ( table. num _ tuples ) : tuple = table. data + t ∗ tuple _ size val = ( tuple + predicate _ offset ) if ( val = = parameter _ value + 1 ) : emit ( tuple ) known at query compile time integrating with the rest of the dbms • the generated query code c...
EPFL CS 460 Moodle
No question: Moodle
system • hique : holistic integrated query engine • for a given query plan, create a c program that implements that query ’ s execution plan. → bake in all the predicates and type conversions. • advantages : – fewer function calls during query evaluation – generated code uses cache - resident data more efficiently – co...
EPFL CS 460 Moodle
No question: Moodle
) : emit ( tuple ) known at query compile time integrating with the rest of the dbms • the generated query code can invoke any other function in the dbms →no need to generate code for the whole db! • re - use the same components as interpreted queries. – concurrency control – logging and checkpoints – indexes 39 indica...
EPFL CS 460 Moodle
No question: Moodle
+ 1 templated plan tuple _ size = # # # predicate _ offset = # # # parameter _ value = # # # for t in range ( table. num _ tuples ) : tuple = table. data + t ∗ tuple _ size val = * ( tuple + predicate _ offset ) if ( val = = parameter _ value + 1 ) : emit ( tuple ) interpreted plan for t in range ( table. num _ tuples ...
EPFL CS 460 Moodle
No question: Moodle
) … execute ( op - n ) select a. a + b. b from a, b where a. val =? + 1 and b. c = a. d σ generated code : more specialization 46 tuple _ size = # # # predicate _ offset = # # # ( val _ offset ) parameter _ value = # # # for t in range ( table. num _ tuples ) : tuple = table. data + t ∗ tuple _ size val = * ( tuple + p...
EPFL CS 460 Moodle