We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byClifford Criddle
Modified over 2 years ago
Database replication for commodity database services Gustavo Alonso Department of Computer Science ETH Zürich email@example.com http://www.iks.ethz.ch
©Gustavo Alonso. ETH Zürich.2 Replication as a problem
©Gustavo Alonso. ETH Zürich.3 How to replicate data? o Depending on when the updates are propagated: Synchronous (eager) Asynchronous (lazy) o Depending on where the updates can take place: Primary Copy (master) Update Everywhere (group) Synchronous Asynchronous Primary copy Update everywhere
©Gustavo Alonso. ETH Zürich.4 Theory … o The name of the game is correctness and consistency o Synchronous replication is preferred: copies are always consistent (1-copy serializability) programming model is trivial (replication is transparent) o Update everywhere is preferred: system is symmetric (load balancing) avoids single point of failure o Other options are ugly: inconsistencies centralized formally incorrect Synchronous Asynchronous Primary copy Update everywhere
©Gustavo Alonso. ETH Zürich.5 … and practice o The name of the game is throughput and response time o Asynchronous replication is preferred: avoid transactional coordination (throughput) avoid 2PC overhead (response time) o Primary copy is preferred: design is simpler (centralized) trust the primary copy o Other options are not feasible: overhead deadlocks do not scale Synchronous Asynchronous Primary copy Update everywhere
©Gustavo Alonso. ETH Zürich.6 The dangers of replication... SYNCHRONOUS o Coordination overhead distributed 2PL is expensive 2PC is expensive prefer performance to correctness o Communication overhead 5 nodes, 100 tps, 10 w/txn = 5’000 messages per second !! UPDATE EVERYWHERE o Deadlock/Reconciliation rates the probability of conflicts becomes so high, the system is unstable and does not scale o Useless work the same work is done by all administrative costs paid by everybody all nodes must understand replication (not trivial)
©Gustavo Alonso. ETH Zürich.7 Text book replication (BHG’87) Read One, Write All o Each site uses 2PL o Atomic commitment through 2PC o Read operations are performed locally o Write operations involve locking all copies of the data item (request a lock, obtain the lock, receive an acknowledgement) o Optimizations are based on the idea of quorums SITE ASITE BSITE C BOT R(x) W(x) Lock Upd... request ack change
©Gustavo Alonso. ETH Zürich.8 Response Time centralized databaseupdate T= replicated database update: 2N messages 2PC The way replication takes place (one operation at a time), increases the response time and, thereby, the conflict profile of the transaction. The message overhead is too high (even if broadcast facilities are available).
©Gustavo Alonso. ETH Zürich.9 o Approximated deadlock rate: if the database size remains constant, or if the database size grows with the number of nodes. o Optimistic approaches result in too many aborts. ABC BOT R(x) W(x) Lock D W(x) BOT Deadlocks (Gray et al. SIGMOD’96)
©Gustavo Alonso. ETH Zürich.10 Commercial systems 12345 0 200 400 600 800 Replication using distributed locking Number of Replicas Response Time in ms
©Gustavo Alonso. ETH Zürich.11 Cost of Replication o Overall computing power of the system: o No gain with large ws factor (rate of updates and fraction of the database that is replicated) o Quorums are questionable, reads must be local to get performance advantages.
©Gustavo Alonso. ETH Zürich.12 GANYMED: Solving the replication problem
©Gustavo Alonso. ETH Zürich.13 What can be done? o Are these fundamental limitations or side effects of the way databases work? Consistency vs. Performance: is this a real trade-off? Cost seems to be inherent: if all copies do the same, no performance gain Deadlocks: typical synchronization problem when using locks Communication overhead: ignored in theory, a real show- stopper in practice o If there are no fundamental limitations, can we do better? In particular, is there a reasonable implementation of synchronous, update everywhere replication? Consistency is a good idea Performance is also a good idea Nobody disagrees that it would be nice … … but commercial systems have given up on having both !!
©Gustavo Alonso. ETH Zürich.14 Consistency vs. Peformance o We want both: Consistency is good for the application Performance is good for the system o Then: Let the application see a consistent state... ... although the system is asynchronous and primary copy o This is done through: A middleware layer that offers a consistent view Using snapshot isolation as correctnes criteria REPLICATION MIDDLEWARE I see a consistent state Asynchronous Primary copy
©Gustavo Alonso. ETH Zürich.15 Two sides of the same coin SNAPSHOT ISOLATION o To the clients, the middleware offers snapshot isolation: Queries get their own consistent snapshot (version) of the database Update transactions work with the latest data Queries and updates do not conflict (operate of different data) First committer wins for conflicting updates o PostgreSQL, Oracle, MS SQL Server ASYNCH – PRIMARY COPY o Primary copy: master site where all updates are performed o Slaves: copies where only reads are peformed o A client gets a snapshot by running its queries on a copy o Middleware makes sure that a client sees its own updates and only newer snapshots o Updates go to primary copy and conflicts are resolved there (not by the middleware) o Updates to master site are propagated lazily to the slaves
©Gustavo Alonso. ETH Zürich.16 Ganymed: Putting it together Based on JDBC drivers Only scheduling, no concurrency control, no query processing... Simple messaging, no group communication Very much stateless (easy to make fault tolerant) Acts as traffic controller and bookkeeper Route queries to a copy where a consistent snapshot is available Keep track of what updates have been done where (propagation is not uniform)
©Gustavo Alonso. ETH Zürich.17 Linear scalability
©Gustavo Alonso. ETH Zürich.18 Improvements in response time (!!!)
©Gustavo Alonso. ETH Zürich.19 Fault tolerance (slave failure)
©Gustavo Alonso. ETH Zürich.20 Fault tolerance (master failure)
©Gustavo Alonso. ETH Zürich.21 GANYMED: Beyond conventional replication
©Gustavo Alonso. ETH Zürich.22 Oracle master – PostgreSQL slaves
©Gustavo Alonso. ETH Zürich.23 Oracle master – PostgreSQL slaves
©Gustavo Alonso. ETH Zürich.24 Updates through SQL (Oracle-Postgres)
©Gustavo Alonso. ETH Zürich.25 Updates through SQL (Oracle-Postgres)
©Gustavo Alonso. ETH Zürich.26 DB2 master – PostreSQL slaves
©Gustavo Alonso. ETH Zürich.27 DB2 master – PostreSQL slaves
©Gustavo Alonso. ETH Zürich.28 Critical issues o The results with a commercial master and open source slaves is still a proof of concept but a very powerful one o More work needs to be done (in progress) Update extraction from the master Trigger based = attach triggers to tables to report updates (low overhead at slaves, high overhead at master) Generic = propagate update SQL statements to copies (high overhead at slaves, no overhead at master, limitations with hidden updates) Update propagation = tuple based vs SQL based SQL is not standard (particularly optimized SQL) Understanding workloads (how much write load is really present in a database workload) Replicate only parts of the database (table fragments, tables, materialized views, indexes, specialized indexes on copies...)
©Gustavo Alonso. ETH Zürich.29 Query optimizations (DB2 example) SELECT J.i_id, J.i_thumbnail FROM item I, item J WHERE (I.i_related1 = j.i_id OR I.i_related2 = j.i_id OR I.i_related3 = j.i_id OR I.i_related4 = j.i_id OR I.i_related5 = j.i_id) AND i.i_id = 839;
©Gustavo Alonso. ETH Zürich.30 Query optimization (DB2 example) SELECT J.i_id, J.i_thumbnail FROM item J WHERE J.i_id IN ( (SELECT i_related1 FROM item WHERE i_id = 839) UNION (SELECT i_related2 FROM item WHERE i_id = 839) UNION (SELECT i_related3 FROM item WHERE i_id = 839) UNION (SELECT i_related4 FROM item WHERE i_id = 839) UNION (SELECT i_related5 FROM item WHERE i_id = 839) );
©Gustavo Alonso. ETH Zürich.31 Understanding workloads TPC-WUpdatesRead-onlyRatio Browsing3.21 %96.79 %1 : 30.16 Shopping10.77 %89.23 %1 : 8.29 Ordering24.34 %75.66 %1 : 3.11 COSTRatio (avg) updates : read only Ratio (total) updates : read only Browsing7:50 : 50.117.50 : 1511.32 Shopping6.38 : 49.356.38 : 409.11 Ordering7.70 : 36.287.70 : 112.83 Ratio (avg) updates : read only Ratio (total) updates : read only 6.92 : 10.396.29 : 313.36 6.28 : 6.596.28 : 54.63 6.23 : 3.286.23 : 10.20 NON-OPTIMIZED SQLOPTIMIZED SQLPOSTGRES
©Gustavo Alonso. ETH Zürich.32 A new twist to Moore´s Law o What is the cost of optimization? SQL rewriting = several days two/three (expert) people (improvement ratio between 5 and 10) Ganymed = a few PCs with open source software (improvement factor between 2 and 5 for optimized SQL, for non-optimized SQL multiply by X) o Keep in mind: Copies do not need to be used, they can be kept dormant until increasing load demands more capacity Several database instances can share a machine (database scavenging) We do not need to replicate everything (less overhead for extraction)
©Gustavo Alonso. ETH Zürich.33 SQL is not SQL SELECT * FROM ( SELECT i_id, i_title, a_fname, a_lname, SUM(ol_qty) AS orderkey FROM item, author, order_line WHERE i_id = ol_i_id AND i_a_id = a_id AND ol_o_id > (SELECT MAX(o_id)-3333 FROM orders) AND i_subject = 'CHILDREN' GROUP BY i_id, i_title, a_fname, a_lname ORDER BY orderkey DESC ) WHERE ROWNUM <= 50 Amongst the 3333 most recent orders, the query performs a TOP-50 search to list a category's most popular books based on the quantity sold Virtual column specific to Oracle. In PostgreSQL = LIMIT 50 Use of MAX leads to sequential scan in Postgres, change to: SELECT o_id-3333 FROM orders ORDER BY o_id DESC LIMIT 1 Current version does very basic optimizations on the slave side. Further work on optimizations at the middleware layer will boost performance even more Optimizations can be very specific to the local data
©Gustavo Alonso. ETH Zürich.34 GANYMED: Our real goals
©Gustavo Alonso. ETH Zürich.35 Database scavenging o Ideas similar to cluster/grid computing tools that place computing jobs in a pool of computers o We want to dynamically place database slaves for master databases in a pool of computers o The goal is to have a true low cost, autonomic database cluster GANYMED DB-MASTER A DB-MASTER B DB-MASTER C DB-MASTER D SLAVE CLUSTER
©Gustavo Alonso. ETH Zürich.36 Steps to get there o We already have the performance and scalability gain o We already have the ability to replicate commercial engines (Oracle, DB2, SQL Server) o What is missing Optimization of write set extraction or SQL update propagation Optimization of SQL statements forwarded to slaves Optimization of replication strategies in slaves Dynamic creation of slaves (many possibilities) Autonomic strategies for dynamic creation/deletion of slaves Grid engine for resource management
©Gustavo Alonso. ETH Zürich.37 Databases as commodity service o Remote applications use the database through a web services enabled JDBC driver (WS-JDBC) GANYMED DB-MASTER A DB-MASTER B DB-MASTER C DB-MASTER D SLAVE CLUSTER WEB SERVICES INTERFACE (WS-JDBC) INTERNET
©Gustavo Alonso. ETH Zürich.38 Conclusions o Ganymed synthesizes a lot of previous work in DB replication Postgres-R (McGill) Middle-R (Madrid Technical Uni.) Middleware based approaches (U. Of T.) C-JDBC (INRIA Grenoble, Object Web) ... o Contributions There is nothing comparable in open source solutions Database independent Very small footprint Easily extensible in many context Can be turned into a lazy replication engine Can be used for data caching across WANs Almost unlimited scalability for dynamic content \ web data o Very powerful platform to explore innovative approaches Databases as a commodity service Database scavenging Optimizations to commercial engines through open source slaves
Distributed DBMS©M. T. Özsu & P. Valduriez Ch.13/1 Outline Introduction Background Distributed Database Design Database Integration Semantic Data Control.
Consistent and Efficient Database Replication based on Group Communication Bettina Kemme School of Computer Science McGill University, Montreal.
PSSA Preparation. Question 1(no calculator) D Question 2 (no calculator)
Chapter 24 Replication and Mobile Databases Transparencies © Pearson Education Limited 1995, 2005.
1 Scaleable Replicated Databases Jim Gray (Microsoft) Pat Helland (Microsoft) Dennis Shasha (Columbia) Pat ONeil (U.Mass)
Database Replication techniques: a Three Parameter Classification Authors : Database Replication techniques: a Three Parameter Classification Authors :
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 11 Membrane Structure Essential Cell Biology Third Edition Copyright © Garland Science 2010.
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Subtraction: Adding UP. Category 1 The whole is a multiple of ten.
Distributed databases 1. 2 Outline introduction principles / objectives problems.
1 Database Systems: Design, Implementation, and Management CHAPTER 10 Distributed Database Management System.
Time for a BREAK! You have 45 Minutes. Time Left 44.
Factor P (8-5ab) 2. 4(d² + 4) 3. 3rs(2r – s) 4. 15cd(1 + 2cd) 5. 8(4a² + 3b²) 6. 12xy(3y – 4x) 7. 5x²y(6x + 7y) 8. 3cd²(3c² - 2d) 9. 15bc³(5b +
1 Prof. Valter Bezerra Dantas
1 Term 2, 2004, Lecture 9, Distributed DatabasesMarian Ursu, Department of Computing, Goldsmiths College Distributed databases 3.
C Copyright © 2005, Oracle. All rights reserved. Practice Solutions.
Solve Multi-step Equations Students will solve equations with multiple steps (more than two) using distributive property, combining like terms, and inverse.
1 Term 2, 2004, Lecture 6, TransactionsMarian Ursu, Department of Computing, Goldsmiths College Transactions 3.
CALENDAR NEW CALENDAR
Chapter 15 Intracellular Compartments and Transport Essential Cell Biology Third Edition Copyright © Garland Science 2010.
1 Before Between After 2 What comes before. _____ 10 _____
FACTORING Think unfoil Work down, Show all steps ax 2 + bx + c.
×1= 9 4 1×1= 1 5 8×1= 8 6 7×1= 7 7 8×3= 24.
Simulations The basics for simulations. Simulation is a way to model random events, such that simulated outcomes closely match real-world outcomes. By.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 2 Author: Julia Richards and R. Scott Hawley.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
BMU - E I 1 Development of renewable energy sources in Germany in
Megastore: Providing Scalable, Highly Available Storage for Interactive Services. Presented by: Hanan Hamdan Supervised by: Dr. Amer Badarneh 1.
I 1. can 2 see 3 A 4 to 5 come 6 my 7 the 8.
Chapter 10 Analyzing Genes and Genomes Essential Cell Biology Third Edition Copyright © Garland Science 2010.
by D. Fisher (2 + 1) + 4 = 2 + (1 + 4) Associative Property of Addition 1.
1 Senn, Information Technology, 3 rd Edition © 2004 Pearson Prentice Hall James A. Senns Information Technology, 3 rd Edition Chapter 7 Enterprise Databases.
PP Test Review Sections 6-1 to 6-6 Mrs. Rivas 1. 2.
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
Year 6 mental test 5 second questions Multiplication and Division Tables knowledge.
Petersons Practice AP Exam Cengage Learning Infotrack Database.
12 1 Chapter 12 Distributed Database Management Systems Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
The 5S numbers game. 1. This sheet represents our current work place. Our job during a 20 second shift, is to strike out the numbers 1 to 49 in correct.
and 5. and and
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
Chapter 14 Energy Generation in Mitochondria and Chlorplasts Essential Cell Biology Third Edition Copyright © Garland Science 2010.
Chapter 12 Membrane Transport Essential Cell Biology Third Edition Copyright © Garland Science 2010.
A Guide to MySQL 4. 2 Objectives Retrieve data from a database using SQL commands Use compound conditions in queries Use computed columns in queries Use.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
© 2017 SlidePlayer.com Inc. All rights reserved.