Top Banner
CS848 Paper Presentation MTCache: Transparent Mid-Tier Database Caching in SQL Server Larson, Goldstein, Zhou ICDE 2004 Presented by Ken Salem David R. Cheriton School of Computer Science University of Waterloo 11 January 2010
28

CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Mar 17, 2018

Download

Documents

dinhduong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

CS848 Paper PresentationMTCache: Transparent Mid-Tier Database

Caching in SQL Server

Larson, Goldstein, ZhouICDE 2004

Presented by Ken Salem

David R. Cheriton School of Computer ScienceUniversity of Waterloo

11 January 2010

Page 2: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

3-Tier Web Service Architecture

WWW WWW WWW WWW WWW

APP APP APP APP APP

DBMS

Scalability Problem

• Web and App servers are easy to scale out.• DBMS can become a bottleneck

Page 3: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

3-Tier Web Service Architecture

WWW WWW WWW WWW WWW

APP APP APP APP APP

DBMS

Scalability Problem

• Web and App servers are easy to scale out.• DBMS can become a bottleneck

Page 4: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache

WWW WWW WWW WWW WWW

APP APP APP APP APP

DBMS

Objective

• reduce load on backend DBMS, eliminating bottleneck• scale out by adding more MTCache nodes

Page 5: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache

MTCache MTCache MTCache MTCache MTCache

WWW WWW WWW WWW WWW

APP APP APP APP APP

DBMS

Objective

• reduce load on backend DBMS, eliminating bottleneck• scale out by adding more MTCache nodes

Page 6: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache Databases

MTCache MTCache

Customer Orders Orderline Stock

Customer

Orders

Orderline

Stock

Customer

Orders

Orderline

Stock

Backend DBMS

mat. viewmat. view

SELECT cols FROM Customer

WHERE condition

SELECT cols FROM Orderline

WHERE condition

Page 7: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache Operation

• each Application Server directs its database requests to anMTCache server, rather than the backend DBMS

• MTCache forwards INSERT, DELETE, UPDATE requeststo the backend database and forwards the response to theApp Server.

• Queries (SELECTs) are handled by MTCache, whichmakes a cost-based decision about whether to:

• handle the query locally• handle the query remotely• split the query (and the processing) into local and remote

parts

• The backend DBMS lazily propagates updates toMTCache nodes

Page 8: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache Operation

• each Application Server directs its database requests to anMTCache server, rather than the backend DBMS

• MTCache forwards INSERT, DELETE, UPDATE requeststo the backend database and forwards the response to theApp Server.

• Queries (SELECTs) are handled by MTCache, whichmakes a cost-based decision about whether to:

• handle the query locally• handle the query remotely• split the query (and the processing) into local and remote

parts

• The backend DBMS lazily propagates updates toMTCache nodes

Page 9: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache Operation

• each Application Server directs its database requests to anMTCache server, rather than the backend DBMS

• MTCache forwards INSERT, DELETE, UPDATE requeststo the backend database and forwards the response to theApp Server.

• Queries (SELECTs) are handled by MTCache, whichmakes a cost-based decision about whether to:

• handle the query locally• handle the query remotely• split the query (and the processing) into local and remote

parts

• The backend DBMS lazily propagates updates toMTCache nodes

Page 10: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

MTCache Operation

• each Application Server directs its database requests to anMTCache server, rather than the backend DBMS

• MTCache forwards INSERT, DELETE, UPDATE requeststo the backend database and forwards the response to theApp Server.

• Queries (SELECTs) are handled by MTCache, whichmakes a cost-based decision about whether to:

• handle the query locally• handle the query remotely• split the query (and the processing) into local and remote

parts

• The backend DBMS lazily propagates updates toMTCache nodes

Page 11: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Synchronization

MTCache MTCache

Customer Orders Orderline Stock

Customer

Orders

Orderline

Stock

Customer

Orders

Orderline

Stock

Backend DBMS

mat. viewmat. view

SELECT cols FROM Customer

WHERE condition

SELECT cols FROM Orderline

WHERE condition

Page 12: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

SynchronizationCreate New Order

updateinsert insert

MTCache MTCache

Customer Orders Orderline Stock

Customer

Orders

Orderline

Stock

Customer

Orders

Orderline

Stock

Backend DBMS

mat. viewmat. view

SELECT cols FROM Customer

WHERE condition

SELECT cols FROM Orderline

WHERE condition

Page 13: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Synchronization

lazy update propagation

Create New Order

updateinsert insert

MTCache MTCache

Customer Orders Orderline Stock

Customer

Orders

Orderline

Stock

Customer

Orders

Orderline

Stock

Backend DBMS

mat. viewmat. view

SELECT cols FROM Customer

WHERE condition

SELECT cols FROM Orderline

WHERE condition

Page 14: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 1

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = 1533

• MTCache can execute this query locally, and avoidcontacting the backend DBMS

• If the query OL O ID were 3555, then MTCache wouldhave to forward the query to the backend DBMS

Page 15: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 1

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = 1533

• MTCache can execute this query locally, and avoidcontacting the backend DBMS

• If the query OL O ID were 3555, then MTCache wouldhave to forward the query to the backend DBMS

Page 16: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 1

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = 1533

• MTCache can execute this query locally, and avoidcontacting the backend DBMS

• If the query OL O ID were 3555, then MTCache wouldhave to forward the query to the backend DBMS

Page 17: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 1

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = 1533

• MTCache can execute this query locally, and avoidcontacting the backend DBMS

• If the query OL O ID were 3555, then MTCache wouldhave to forward the query to the backend DBMS

Page 18: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 2

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(L.QUANTITY)FROM OrderLine L, Order O, Customer CWHERE L.OL_O_ID = O.O_IDAND O.O_C_ID = C.C_IDAND C.C_LAST = ‘‘Smith’’AND O.O_ID < 2000

• MTCache can execute part of the query locally and part atthe backend, or it can send the entire query to thebackend. Decision is cost-based

Page 19: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 2

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(L.QUANTITY)FROM OrderLine L, Order O, Customer CWHERE L.OL_O_ID = O.O_IDAND O.O_C_ID = C.C_IDAND C.C_LAST = ‘‘Smith’’AND O.O_ID < 2000

• MTCache can execute part of the query locally and part atthe backend, or it can send the entire query to thebackend. Decision is cost-based

Page 20: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Query Processing 2

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Suppose query is:SELECT SUM(L.QUANTITY)FROM OrderLine L, Order O, Customer CWHERE L.OL_O_ID = O.O_IDAND O.O_C_ID = C.C_IDAND C.C_LAST = ‘‘Smith’’AND O.O_ID < 2000

• MTCache can execute part of the query locally and part atthe backend, or it can send the entire query to thebackend. Decision is cost-based

Page 21: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Parameterized Queries

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Consider this query:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = @ID

• SQL Server may have to optimize this query before thevalue of the parameter (@ID) is known.

• In the case, MTCache will generate a dynamic plan.

Page 22: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Parameterized Queries

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Consider this query:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = @ID

• SQL Server may have to optimize this query before thevalue of the parameter (@ID) is known.

• In the case, MTCache will generate a dynamic plan.

Page 23: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Parameterized Queries

• Suppose MTCache has:SELECT * FROM OrderLineWHERE OL_O_ID < 3000

• Consider this query:SELECT SUM(0L_QUANTITY) FROM OrderLineWHERE OL_O_ID = @ID

• SQL Server may have to optimize this query before thevalue of the parameter (@ID) is known.

• In the case, MTCache will generate a dynamic plan.

Page 24: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Scale-Out Experiment

• workload: TPC-W, which models e-commerce activity• backend DBMS server: dual CPU• mid-tier MTCache servers: single CPU• workload is CPU-bound• scale-out experiment: increase number of clients and

number of MTCache servers to see whether throughput(WIPS) scales

• how many WIPS per MTCache, and does it scale linearly?• by how much does MTCache reduce the load on the

backend DBMS?

Page 25: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Baseline Results (No MTCache)

• browsing workload: 50 WIPS• shopping workload: 82 WIPS• ordering workload: 283 WIPS

Page 26: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Scale-Out

Page 27: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

More Scale-Out Results

Workload No MTCache 5 MTCache MaxWIPS CPU Util. WIPS CPU Util. MTCache

Browsing 50 90% 129 8% 50+Shopping 82 90% 199 16% 25+Ordering 283 90% 271 55% <10

Page 28: CS848 Paper Presentation MTCache: Transparent …kmsalem/courses/CS848W10/presentations/...CS848 Paper Presentation MTCache: Transparent Mid-Tier ... rather than the backend DBMS ...

Closing Observations

• complexity• interaction with many parts of DBMS (query proc, query

opt, replication pub/sub, transaction, . . .)

• physical design is manual• no synchronization guarantees, not even session

guarantees (note 2005 VLDB paper [gula05])