0% found this document useful (0 votes)
22 views32 pages

157496196

Uploaded by

akash aku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
22 views32 pages

157496196

Uploaded by

akash aku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 32
HOPerpHps Database Managem« Chapter 11 Distributed Databases Jerry Post Copyright © 2013 ~» Why do you need a distributed database? ~ What are distributed databases? «> How is data distributed with client/server systems? ~ Can a Web approach solve the data distribution issues? ~» How much data can you send to a client form? ~ How do you transfer data across diverse systems? *» How will Sally's employees access the database? Dis ~> Definition «> Advantages / Uses ~ Problems / Complications > Client-Server / SQL Server ~> Microsoft Access Britain France | SELECT Sales FROM Britain.Sales UNION, SELECT Sales FROM France.Sales UNION SELECT Sales FROM Italy.Sales Germany Italy ~» Multiple independent databases + Each DBMS is a complete DBMS (engine, queries, locking, transactions, etc.) + Usually on different machines. + Usually in different locations. * Connected by a network. ~ Might be different environments + Hardware + Operating System + DBMS Software Database Apollo ee France Database Athena United States Distribute ~ C.J. Date + Distributed query processing. + Rule 0: Transparency: the + Distributed transaction management. user should not know or care that the database is ; arcware SeebanceiN distributed. Lele independence. + Local autonomy. + Network independence. + No reliance on a central site. + DBMS independence. + Continuous operation. + Location independence. + Fragmentation independence (physical storage). + Replication independence. ~» Each database can continue to run even if portion fails. “> Data and hardware can be moved without affecting operations or users. + Expanding operations. + Performance issues. ~» System expansion and upgrades. + Add new section without affecting others. + Upgrade hardware, network and DBMS. ~» Business operations are often distributed + Work and data are segmented by department. + Work and data are segmented by geographical location. ~> Improved performance + Most updates and queries are perform locally. + Maintain local control and responsibility \ future over data. expansion ~> Can still combine data across the De system. = * Scalability and expansion + Add on, not replacement. Creating < ~» Design administration plan. ~ Choose hardware and DBMS vendor, and network. ~» Set up network and DBMS connections. ~ Choose locations for data. ~» Choose replication strategy. «> Create backup plan and strategy. * Create local views and synonyms. ~ Perform stress test: loads and failures. ~» Drives: 60 - 400 MB per sec. (with SSD or RAID) «> LANs: 10-100 MB per sec (100-1000 mbps). ~» WANs: 0.2 - 300 MB per sec. ~> Faster is possible but expensive! ~> Goal is to minimize transmissions. + Each system must be capable of evaluating queries--preferably SQL. + Results depend heavily on how the system joins tables. - 60 — 400 7 LAN Disk drive ~» Example + NY: Customers: 1M rows + LA: Production: 10 M rows + Chicago: Sales: 20 M rows + Query: List customers who bought blue products on March 1 + Bad idea #1 4 Transfer all rows to Chicago 4 Then JOIN and select + Better idea #2 (probably) 4 Transfer blue products from LA to Chicago + Better idea #3 ~ Get sale items on March 1 4 Get blue products from LA 4 Send C# to NY Customers(Ci, ...)| 1,000,000 C# list from desired Pi# Chicago Matching Sales(S#, C#, Sdate) | Customer 20,000,000 data Saleltem(S#, P#,...) 50,000,000 Blue P# sold on March 1 Products(P#, Color...) 10,000,000 10 subscribe Main — Replica Published changes Changed data Goals + Minimize transmissions + Improve performance + Support heavy multiuser access. ~> Problems + Updating copies 4 Bulk transmissions 4 Site unavailable + Concurrency 4 Easier for two people to change the same data at the same time. «> Decision support systems. ~> Data warehouse. France: Customers & Sales Spain: Customers & Sales Periodic updates Britain: Customers, & Sales France: Customers — & Sales D q Spain: Customers Update data. 12 ~» Each DBMS must maintain lock facility. ~ To update, each DBMS must utilize and anes recognize other lock mechanisms and Jones 7 8898 return codes. ~ Each DBMS must have a deadlock resolution protocol that recognizes the distributed databases. Waiting \ + Random wait. + Optimistic updates. + Two-phase commit. DBMS #2 Transadtion B Accounts Waiting Jones 3561 “J Locked 13 ~» Two (or more) separate lock man rs. . a age! S. . Database 1 «> DBMS initiating update serves as the Initiate Transaction coordinator. 1. Prepare to commit. ~ Two phases Il agree? + Coordinator sends message and data . Ty. 2. Commit to all machines to “get ready.” = + Local machines save data in logs, verify update status and return \ message. 7 + If all locals report OK, then coordinator Database 2 writes log and instructs others to Lock tables. proceed. If any fail, it sends Rollback Save log.* message. Update all tables: 14 Transaction Manager Transaction Manager Resource Manager Resource DBMS Manager DBMS. Transaction Manager| , Resource Transaction Manager Processing Monitor DBMS The distributed transaction coordinator/transaction processing monitor handles the transaction decisions and coordinates across the participating systems. 15 Question Concurrent Replication What level of data consistency is needed? High Low — Medium How expensive is storage? Medium — High Low What are the shared access requirements? Global Local How often are the tables updated? Often Seldom Required speed of updates (transactions)? Fast ‘Slow How important are predictable transaction times? _| High Low DBMS support for concurrency and locking? Good — Excellent _| Poor Can shared access be avoided? No Yes 16 Server Server Shared Database Front-end ¥. User Interface Clients Clients Older, but common for retail stores/checkout computers. 18 LAN File Server MyFile.mdb CustID Name ... 15 Jenkins... Forms||425 Juarez der ... Application and query DBMS ransferred. software One row at a time transferred. transferred, until all rows are examined. SELECT * FROM Customer WHERE City = “Sandy” 20 ~» One machine machine is dominant (server) and handles data for many clients. File Server *~ Client machines handle front-end tasks DBMS and small data tables that are not Shared L shared. “ Server | Data Send SQL \ ‘G statement. \ % ~B: 21 Thr ~> Server Databases «> Client front-end ~ Middle + Locate databases + Business rules + Program code Database Server: Databases. Transactions: Legacy applications. Database links. Business rules. Program code. Middleware Application. eB Front-end. 5. User Interface. Client Database In Independent Application Query: works with any DBMS SELECT SalelD, SaleDate, CustomerID, CustomerName FROM SaleCustomer Saved Oracle Query SELECT SalelD, SaleDate, CustomerID, LastName || ', ‘ || FirstName AS CustomerName FROM Sale, Customer WHERE Sale.CustomerlD=Customer.CustomerID Saved SQL Server Query SELECT SalelD, SaleDate, CustomerID, LastName + ‘, ' + FirstName AS CustomerName FROM Sale INNER JOIN Customer ON Sale.CustomerID = Customer.CustomerID 25 Internet Router Router Servo, > request result page Client Web Server Browser HTML http://server.location/page forms Data SQL Database Server 26 My main page

My text goes in paragraphs.

Additional tags set boldface and Italic.

Tables are more complicated and use a set of tags for rows and columns.

First cellSecond cell
Next rowSecond column

There are form tags to create input forms for collecting data. But you need CGI program code to convert and use the input data.

a 27 he My text goes in paragraphs. Additional tags set boldface and Italic. Tables are more complicated and use a set of tags for rows and columns. There are form tags to create input forms for collecting data. But you need CGI program code to convert and use the input data. np ao DBMS Web Server
ELECT [CustomeriD], ... jdateCommand="UPDATE [Customer] SET... ‘asp:Parameter Name="CustomerlD" Type="Int32" /> eleteParameters> - oe Web Browser Customers CustomerID 1653 LastName [Jones FirstName Mary Save | CSS Style Sheet PageTitle { font-weight: bold, © Request Server/Form.html Server @® Initial f Catalog Search Results Black Cat [Ca Bombay fuesvot [Black (8279.54 (Car Manse 21701 [Black (8215.92 [Cat Bombay far30701 [Black ($213.18 [65 Bryce [Cat Persian (12301 |WhateBlack $133.24 [77 Damon|Cat Bombay [1/17/01 [Black $178.16 | 98|stan [Cat Sphym VVO1[Black $241.67 [103 Lee [Cat Siamese [7717001 [White/Black [$232.90 [106 fTaylor [Cat Oriental Shorthair [2/21/01 [Yellow/Black $220.94 [115 Tewel [Cat|Korat [1/15/01 [Black $210.88 [122 Gayle [Cat Bombay rami lack $225.68 [168 Ray [Cat Japanese Bobtad | 6/4701 [Black {$225.68 [192 Saly [Cat Amencan Shorter 6/26/01 [Black $198.87 31 Order Form Order ID 1015 Customer | Jones, Martha y Order Date 12-Aug What if there are 10,000 customers? How much time to load the combo box? How do you refresh/reload the combo box? Alternatives? 32 Server i Generate form Receive form data Transmission Transmission delay delay Form received Client ¥. User delay time 33 5° Data is replicated to multiple, connected servers in the Internet cloud. Client requests are filled from the nearest available server, spreading the bandwidth and processor demands across the network. Cloud D Amazon S3 Web server Bucket Name HTML, nev, Cole Code, Bucket +Key SP Developer User Developer opens Amazon S3 account and creates/names a bucket. Developer uploads content (objects) to bucket and assigns a key to each object. Developer writes Web server code with HTML page and background code that calls the S3 service with the bucket name and object key. Web page is constructed on request and delivered with the object. ~» Many cloud systems are proprietary and not relational. «> Designed to handle data that rarely changes—typically through bulk uploads. ~> So little fear of concurrency or transaction issues. «> Microsoft Azure SQL is an exception. ~» Need to handle concurrency (and transactions/logs) in your own code. » Always use optimistic concurrency (not pessimistic locking). * See Chapter 7, but keep the original values when you read data and use it in the WHERE clause when you alter data to see if it has changed.

You might also like