Page
1
(This page has no text content)
Page
2
Batch data Streaming data Ingestion Slow storage/Direct data lake access Fast storage Operational metadata Data warehouse Real-time processing and analytics Data consumers Data consumers Data consumers ETL tools overlay Orchestration overlay Batch processing and analytics
Page
3
Designing Cloud Data Platforms DANIL ZBURIVSKY AND LYNDA PARTNER M A N N I N G SHELTER ISLAND
Page
4
For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com ©2021 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Susan Ethridge 20 Baldwin Road Technical development editor: Robert Wenner PO Box 761 Review editor: Mihaela Batinic Shelter Island, NY 11964 Production editor: Deirdre Hiam Copy editor: Katie Petito Proofreader: Katie Tennant Technical proofreader: Borko Djurkovic Typesetter: Gordan Salinovic Cover designer: Marija Tudor ISBN 9781617296444 Printed in the United States of America
Page
5
iii brief contents 1 ■ Introducing the data platform 1 2 ■ Why a data platform and not just a data warehouse 18 3 ■ Getting bigger and leveraging the Big 3: Amazon, Microsoft Azure, and Google 37 4 ■ Getting data into the platform 78 5 ■ Organizing and processing data 127 6 ■ Real-time data processing and analytics 156 7 ■ Metadata layer architecture 197 8 ■ Schema management 228 9 ■ Data access and security 261 10 ■ Fueling business value with data platforms 289
Page
6
(This page has no text content)
Page
7
v contents preface xi acknowledgments xiii about this book xv about the authors xviii about the cover illustration xix 1 Introducing the data platform 1 1.1 The trends behind the change from data warehouses to data platforms 2 1.2 Data warehouses struggle with data variety, volume, and velocity 3 Variety 4 ■ Volume 5 ■ Velocity 5 ■ All the V’s at once 6 1.3 Data lakes to the rescue? 6 1.4 Along came the cloud 7 1.5 Cloud, data lakes, and data warehouses: The emergence of cloud data platforms 9 1.6 Building blocks of a cloud data platform 10 Ingestion layer 10 ■ Storage layer 11 ■ Processing layer 12 Serving layer 13
Page
8
CONTENTSvi 1.7 How the cloud data platform deals with the three V’s 14 Variety 14 ■ Volume 15 ■ Velocity 15 ■ Two more V’s 16 1.8 Common use cases 16 2 Why a data platform and not just a data warehouse 18 2.1 Cloud data platforms and cloud data warehouses: The practical aspects 19 A closer look at the data sources 20 ■ An example cloud data warehouse–only architecture 22 ■ An example cloud data platform architecture 23 2.2 Ingesting data 24 Ingesting data directly into Azure Synapse 25 ■ Ingesting data into an Azure data platform 26 ■ Managing changes in upstream data sources 26 2.3 Processing data 28 Processing data in the warehouse 29 ■ Processing data in the data platform 31 2.4 Accessing data 33 2.5 Cloud cost considerations 34 2.6 Exercise answers 36 3 Getting bigger and leveraging the Big 3: Amazon, Microsoft Azure, and Google 37 3.1 Cloud data platform layered architecture 38 Data ingestion layer 40 ■ Fast and slow storage 44 ■ Processing layer 46 ■ Technical metadata layer 47 ■ The serving layer and data consumers 49 ■ Orchestration and ETL overlay layers 53 3.2 The importance of layers in a data platform architecture 59 3.3 Mapping cloud data platform layers to specific tools 60 AWS 62 ■ Google Cloud 66 ■ Azure 70 3.4 Open source and commercial alternatives 74 Batch data ingestion 74 ■ Streaming data ingestion and real-time analytics 75 ■ Orchestration layer 75 3.5 Exercise answers 77
Page
9
CONTENTS vii 4 Getting data into the platform 78 4.1 Databases, files, APIs, and streams 79 Relational databases 80 ■ Files 81 ■ SaaS data via API 82 Streams 82 4.2 Ingesting data from relational databases 83 Ingesting data from RDBMSs using a SQL interface 84 ■ Full- table ingestion 86 ■ Incremental table ingestion 91 ■ Change data capture (CDC) 94 ■ CDC vendors overview 98 ■ Data type conversion 100 ■ Ingesting data from NoSQL databases 103 Capturing important metadata for RDBMS or NoSQL ingestion pipelines 104 4.3 Ingesting data from files 107 Tracking ingested files 109 ■ Capturing file ingestion metadata 112 4.4 Ingesting data from streams 114 Differences between batch and streaming ingestion 117 Capturing streaming pipeline metadata 119 4.5 Ingesting data from SaaS applications 120 No standard approach to API design 121 ■ No standard way to deal with full vs. incremental data exports 122 ■ Resulting data is typically highly nested JSON 122 4.6 Network and security considerations for data ingestion into the cloud 123 Connecting other networks to your cloud data platform 123 4.7 Exercise answers 126 5 Organizing and processing data 127 5.1 Processing as a separate layer in the data platform 129 5.2 Data processing stages 131 5.3 Organizing your cloud storage 132 Cloud storage containers and folders 134 5.4 Common data processing steps 140 File format conversion 140 ■ Data deduplication 145 Data quality checks 150 5.5 Configurable pipelines 152 5.6 Exercise answers 155
Page
10
CONTENTSviii 6 Real-time data processing and analytics 156 6.1 Real-time ingestion vs. real-time processing 157 6.2 Use cases for real-time data processing 160 Retail use case: Real-time ingestion 160 ■ Online gaming use case: Real-time ingestion and real-time processing 161 ■ Summary of real-time ingestion vs. real-time processing 164 6.3 When should you use real-time ingestion and/or real-time processing? 164 6.4 Organizing data for real-time use 167 The anatomy of fast storage 167 ■ How does fast storage scale? 170 ■ Organizing data in the real-time storage 172 6.5 Common data transformations in real time 178 Causes of duplicates in real-time systems 178 ■ Deduplicating data in real-time systems 181 ■ Converting message formats in real-time pipelines 186 ■ Real-time data quality checks 187 Combining batch and real-time data 188 6.6 Cloud services for real-time data processing 190 AWS real-time processing services 190 ■ Google Cloud real-time processing services 192 ■ Azure real-time processing services 193 6.7 Exercise answers 195 7 Metadata layer architecture 197 7.1 What we mean by metadata 198 Business metadata 198 ■ Data platform internal metadata or “pipeline metadata” 199 7.2 Taking advantage of pipeline metadata 199 7.3 Metadata model 203 Metadata domains 204 7.4 Metadata layer implementation options 213 Metadata layer as a collection of configuration files 214 Metadata database 217 ■ Metadata API 218 7.5 Overview of existing solutions 220 Cloud metadata services 221 ■ Open source metadata layer implementations 223 7.6 Exercise answers 227
Page
11
CONTENTS ix 8 Schema management 228 8.1 Why schema management 229 Schema changes in a traditional data warehouse architecture 230 Schema-on-read approach 231 8.2 Schema-management approaches 232 Schema as a contract 233 ■ Schema management in the data platform 235 ■ Monitoring schema changes 241 8.3 Schema Registry Implementation 243 Apache Avro schemas 243 ■ Existing Schema Registry implementations 245 ■ Schema Registry as part of a Metadata layer 246 8.4 Schema evolution scenarios 248 Schema compatibility rules 249 ■ Schema evolution and data transformation pipelines 251 8.5 Schema evolution and data warehouses 255 Schema-management features of cloud data warehouses 257 8.6 Exercise answers 260 9 Data access and security 261 9.1 Different types of data consumers 262 9.2 Cloud data warehouses 263 AWS Redshift 264 ■ Azure Synapse 268 ■ Google BigQuery 270 ■ Choosing the right data warehouse 273 9.3 Application data access 274 Cloud relational databases 275 ■ Cloud key/value data stores 276 ■ Full-text search services 277 ■ In-memory cache 278 9.4 Machine learning on the data platform 278 Machine learning model lifecycle on a cloud data platform 279 ML cloud collaboration tools 282 9.5 Business intelligence and reporting tools 283 Traditional BI tools and cloud data platform integration 283 Using Excel as a BI tool 284 ■ BI tools that are external to the cloud provider 284
Page
12
CONTENTSx 9.6 Data security 285 Users, groups, and roles 285 ■ Credentials and configuration management 286 ■ Data encryption 286 ■ Network boundaries 287 9.7 Exercise Answers 288 10 Fueling business value with data platforms 289 10.1 Why you need a data strategy 290 10.2 The analytics maturity journey 291 SEE: Getting insights from data 292 ■ PREDICT: Using data to predict what to do 293 ■ DO: Making your analytics actionable 294 ■ CREATE: Going beyond analytics into products 295 10.3 The data platform: The engine that powers analytics maturity 296 10.4 Platform project stoppers 297 Time does indeed kill 297 ■ User adoption 298 ■ User trust and the need for data governance 299 ■ Operating in a platform silo 300 ■ The dollar dance 301 index 304
Page
13
xi preface This book is a true collaboration, a team effort between two very different people who share a love of data, new technology, and solving customer problems. We (Danil and Lynda) worked together at a data, analytics, and cloud IT services company for five years, where we partnered up to develop a cloud analytics practice. Danil, with his years of Hadoop experience, brought the technical chops, and Lynda brought the business perspective. We realized early on that both were needed to solve real-world data problems, and over time, Danil became more business-oriented and Lynda became knowledgeable enough about the cloud and data to contribute and even sometimes challenge Danil. The move from Hadoop as a big data platform to cloud-native platforms for data and analytics was an easy one—we both love the promise of cloud and big data. With the support of our employer, we built an internal team and designed and delivered not just awesome technology solutions but solutions that delivered real business out- comes using data and cloud. We did this for dozens of customers, and over time, we developed a set of best practices and knowledge. It was this experience and our unique mix of technical and business skills that let us believe that we could take a really complicated technical subject and make it understandable for a broader audi- ence. We started with blog posts and white papers, and when Manning called and asked if Danil wanted to write another book (his first was on Hadoop), it seemed right and natural to do it together. Both of us were active speakers at industry events, so we took advantage of these opportunities to frame our ideas for the book and used audience feedback to refine
Page
14
them. We also agreed that we would weave in real customer stories because we both believe that stories make all learning easier. Once we realized that we were aligned on how to approach the book, there was nothing left but to start typing. It took almost two years, but we are both really happy with the outcome, and we hope you are too.
Page
15
xiii acknowledgments We knew this would be a lot of work—Danil especially, because he had done it before—but we both agree that it ended up being more work than either of us thought. We realized that we are both perfectionists, and we were each happy pushing the other to do better. The end result is a product we are both proud of, but we wouldn’t be here without a broader team of people who supported us. We’d like to thank a few of them here. First and foremost, we thank our spouses for putting up with our absences on weekends and holidays while we typed and typed and typed. It is still amazing to us that neither ever complained and both were always there for us. Our work communities have been incredibly supportive starting with our employer at the time, Pythian—especially founder Paul Vallée, who backed us when we said we thought we could develop and sell cloud-native data platforms at a time when people were saying “cloud native what?” Pythian also graciously allowed us to use the dia- grams that appear in chapter 10. The bottom line is that our employers, past and pres- ent, have encouraged us to keep writing and sharing our knowledge, and we are grateful for that support. A big, big thank you goes to the Kick AaaS team we worked with—Kevin Pedersen, Christos Soulios, Valentin Nikotin, and Rory Bramwell, who all took a gamble on a new direction and followed us into the unknown—they are the invisible authors of this book. And we will never be able to thank our customers enough, especially the first few who were patient as we learned how to make better and better designs on their behalf.
Page
16
ACKNOWLEDGMENTSxiv Next, we’d like to acknowledge the folks at Manning, especially our editor Susan Ethridge, who seemed to know just how hard to push to get us to produce our best work but who also knew when we just needed a sympathetic ear. The book is better because of you, Susan, and you’ve become a friend in the process. We will miss our weekly meetings! Deirdre Hiam, our project editor; Katie Petito, our copyeditor; Katie Tennant, our proofreader; and Mihaela Batinic, our reviewing editor: thank you, all. And lastly, we thank the people who reviewed our book as we wrote it and gave great constructive feedback. We’re not going to lie, it was really difficult to send out our opus to strangers and ask them for feedback, but we did and we got great suggestions back. Thank you for taking the time, for being so constructive, and for the nice things you said about the book—it kept us going through the hard times. Thank you, all the reviewers whose suggestions helped make this a better book: Robert Wenner first and foremost (“What will Robert say?” became a common refrain in our meetings), Alain Couniot, Alex Saez, Borko Djurkovic, Chris Viner, Christopher E. Phillips, Daniel Berecz, Dave Corun, David Allen Blubaugh, David Krief, Emanuele Piccinelli, Eros Pedrini, Gabor Gollnhofer, George Thomas, Hugo Cruz, Jason Rendel, Ken Fricklas, MikeJensen, Peter Bishop, Peter Hampton, Richard Vaughan, Sambasiva Andaluri, Satej Sahu, Sean Thomas Booker, Simone Sguazza, Ubaldo Pescatore, and Vishwesh Ravi Shrimali.
Page
17
xv about this book Designing Cloud Data Platforms was written to help guide you in designing a cloud data platform that is both scalable and flexible enough to deal with the inevitable technol- ogy changes. It begins by explaining what exactly we mean by the term “cloud data platform,” why it matters, and how it is different from a cloud data warehouse. It then shifts into following the flow of data into and through the data platform—from inges- tion and organization, to processing and managing data. It wraps up with how differ- ent data consumers use the data in the platform and discusses the most common business issues that can impact the success of a cloud data platform project. Who should read this book The book is designed for someone who wants to understand what a data platform is and how it should be architected to take advantage of the cloud. It is detailed enough to get someone with a solid programming background well on their way to architect- ing a solution and also addresses the connection between technology and business so product owners and business and data analysts who may never have to design an archi- tecture will understand the concepts and rationale behind it. It goes into detail about subjects such as streaming versus batch, schema management, and other key design elements, but it is a book about designing, not programming.
Page
18
ABOUT THIS BOOKxvi How this book is organized: A roadmap Chapter 1 introduces the concept of a cloud data platform, describing the trends that are driving demand and introducing the key building blocks of a cloud data platform design. Chapter 2 compares and contrasts the differences between cloud data platforms and cloud data warehouses. Chapter 3 expands on the simple architecture introduced in chapter 1 and maps the layers in the architecture to tools available from each of AWS, Azure, and Google Cloud. Chapter 4 is all about getting data into the data platform—focusing on data com- ing from relational databases, files, streams, and SaaS systems via an API. Chapter 5 explains how to best organize and process the data in your data plat- form, introducing the concept of configurable pipelines and common data process- ing steps. Chapter 6 is dedicated to real-time data processing and analytics, the difference between real-time ingestion versus real-time processing, and how your real-time data should be organized and transformed. Chapter 7 introduces the important concept of a technical metadata layer and why it is needed, along with options for a technical metadata model, several implementa- tion options, and an overview of existing commercial and open source solutions. Chapter 8 takes on the long-standing challenges associated with schema manage- ment, provides several possible approaches, and discusses how schema evolution can be handled in a modern data platform. Chapter 9 discusses the different types of data consumers and data access points, including the data warehouse, application access, machine learning users, and BI and report tools. Chapter 10 wraps up the book by describing the way the data platform is used to drive business value and discusses a number of organizational challenges associated with ensuing data platform project success. About the code This book contains some examples of source code both in numbered listings and in line with normal text. In both cases, source code is formatted in a fixed-width font 'like this' to separate it from ordinary text. In many cases, the original source code has been reformatted; we’ve added line breaks and reworked indentation to accom- modate the available page space in the book. In rare cases, even this was not enough, and listings include line-continuation markers (➥). Code annotations accompany many of the listings, highlighting important concepts.
Page
19
ABOUT THIS BOOK xvii liveBook discussion forum Purchase of Designing Cloud Data Platforms includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask tech- nical questions, and receive help from the authors and from other users. To access the forum, go to https://livebook.manning.com/book/designing-cloud-data-platforms/ welcome/v-8/. You can also learn more about Manning’s forums and the rules of con- duct at https://livebook.manning.com/#!/discussion. Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the authors can take place. It is not a commitment to any specific amount of participation on the part of the authors, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking them some challenging questions lest their interest stray! The forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.
Page
20
xviii about the authors DANIL ZBURIVSKY has spent his entire career designing and supporting large-scale data infrastructure for enterprises across the globe. He started his career over 10 years ago at IT services company Pythian, managing open source database systems for a number of large-scale internet companies. He was an early champion of Hadoop, and while he managed a team that designed and implemented large-scale Hadoop analytics infra- structures, he wrote and published a book on Hadoop cluster deployment best prac- tices. Anticipating the impact the public cloud would have on data infrastructure, he was an early adopter of cloud data services and has architected and implemented modern cloud-based data platforms on all three public cloud platforms for dozens of enterprises across the globe. An avid surfer, Danil lives in Halifax, Nova Scotia, and spends his free time riding the waves, 12 months a year. LYNDA PARTNER has been on the business side of data for more than 20 years. She became addicted to data when, as founder of a SaaS company, she used data exten- sively to optimize how her customers used her product. When she later became Presi- dent of Intouch Insights, she pivoted a traditional market research firm into one of the first mobile data-capture companies, collecting valuable consumer data for major automotive vendors. In her current role as Vice President of Analytics for IT services company Pythian, she works with companies across a wide range of industries and countries, helping them turn data into insights, predictions, and products. When she isn’t working, you’ll find her at her island cottage, where she spends time kayaking and writing and plotting new uses for data.