PIQL: Success- Tolerant Query Processing in the Cloud Michael Armbrust, Kristal Curtis, Tim Kraska...
-
Upload
elwin-welch -
Category
Documents
-
view
219 -
download
1
Transcript of PIQL: Success- Tolerant Query Processing in the Cloud Michael Armbrust, Kristal Curtis, Tim Kraska...
PIQL: Success- Tolerant Query Processing in the Cloud
Michael Armbrust, Kristal Curtis, Tim KraskaArmando Fox, Michael J. Franklin, David A.
PattersonAMP Lab, EECS, UC Berkeley
Introduction
• Large-scale websites are increasingly moving from relational databases to distributed key-value stores.
• Why? - High request rate- Low latency workloads- Scalability
Key-value stores at a cost of ?
• Writing complex imperative functions• Index management• Intra query parallelization• And LOSS of DATA INDEPENCE
A blend of both: PIQL
• Performance predictable subset of SQL• Benefits of RDBMS such as ability to express
queries declaratively• Physical data independence• Automatic index selection and maintenance• Real time guarantees on PERFORMANCE that
come from underlying key-value store
Features:
• Run on the top of key/value stores• Bounds on the number of operations that will
be performed on key-value store• Compile time feedback on worst-case
performance for all queries• Automatic selection and maintenance of
indexes
Alternative approach
• Complex developer written imperative programs• Example:
Data model of Cassandra For a query: search for messages that contain
certain wordValues inserted of the form:row -> userid, supercolumn ->word, column ->messageTimestamp, value->messageId
Equivalent PIQL query:
FETCH messageOF user BY recipientWHERE user = [this] ANDmessage.text CONTAINS [1: word]ORDER BY timestamp
Query Scaling classes
• Class 1: (Constant)- Amount of data required to process the query is constant
• Class 2: (Bounded)- Amount of data required to process the query is naturally bounded
• Class 3: (Sub-linear or Linear)- Amount of data required to process the query grows sub-linearly eventually
• Class 4: (Super-linear)-
PIQL Query Syntax
• name• Parameters [ordinal:name]General syntax:QUERY nameFETCH entity[OF joined-entity alias BY relationship] ...
WHERE predicates[{PAGINATE perpage | LIMIT count}]
Example Class 1
• To return profile of a user given a user nameQUERY userByNameFETCH userWHERE user.name = [1:name]
• Calculating bound:Simple: 1 or zero results
Example Class 2
• To return users by their hometownQUERY userByHometownFETCH userWHERE user.hometown = [1:hometown]LIMIT [1:count] MAX 100
• Calculating bound:• LIMIT clause returns at most 100 items
Example Class 3
• To return a list of the most recent thoughts owned by a particular user
QUERY userThoughtsFETCH thought ofuser by ownerWHERE user.name = [1:username]ORDER BY timestampLIMIT [2:count] MAX 100Bound: 100
Example Class 4
To return a paginated list, 10 at a time, of the most recent thoughts of all the approved subscriptions owned by the current user.
QUERY thoughtstreamFETCH thoughtOF user friend BY ownerOF subscription BY targetOF user me BY ownerWHERE me.username=[1:username] AND approved = true
ORDER BY timestampPAGINATE 10
Comparison
• Graph
Queries in PIQL
• Entities analogous to Relations• Queries are specified as templates ahead of
time• No of operations required in worst case are
provided to developer as feedback at compile time
Architecture Overview
Optimization in PIQL
• Phase 1-(Stop Operator Insertion)
Optimization in PIQL
• Phase 2
Prediction Framework
Performance Insight Assistant• Provides feedback to developer to fix ‘unsafe’
queries• Guidance on how to set a ‘Cardinality limit’
compatible with SLO Compliance• Provides a chart of latency distribution for
each setting of the cardinality
Performance Insight assistant
• Predicted Heat Map for Thoughtstream query
Execution Engine
• Leverages key-value store to achieve scalability and high performance
• Requests to a key-value store are done in parallel
• Limit hint information is used to prefetch all required data in single request
Performance overview
Fig: System scaling in number of users/machines with constant query latency
Conclusion
• Performance predictability and scalability of Key-value stores + Scale independence of Relational Model= PIQL
• GQL, HIVE, PIG, VoltDB are also on similar grounds but they are focused on Batch Analytics rather than Interactive applications