Magpie: Python at Speed and Scale Using Cloud Backends

Magpie: Python at Speed and Scale Using Cloud Backends

Magpie: Python at Speed and Scale using Cloud Backends Alekh Jindal K. Venkatesh Emani Maureen Daum∗ Gray Systems Lab, Microsoft Gray Systems Lab, Microsoft University of Washington [email protected] [email protected] [email protected] Olga Poppe Brandon Haynes Anna Pavlenko Gray Systems Lab, Microsoft Gray Systems Lab, Microsoft Gray Systems Lab, Microsoft [email protected] [email protected] [email protected] Ayushi Gupta∗ Karthik Ramachandra Carlo Curino Apple Microsoft Azure Data Gray Systems Lab, Microsoft [email protected] [email protected] [email protected] Andreas Mueller Wentao Wu Hiren Patel Gray Systems Lab, Microsoft Microsoft Research Microsoft [email protected] [email protected] [email protected] ABSTRACT 1 INTRODUCTION Python has become overwhelmingly popular for ad-hoc data anal- Python has become the lingua franca for ad-hoc data analysis (typ- ysis, and Pandas dataframes have quickly become the de facto ically over text or CSV files), driven primarily by its concise, com- standard API for data science. However, performance and scaling to prehensible code that requires less time and effort to write relative large datasets remain significant challenges. This is in stark contrast to other languages. Furthermore, there is a rapid convergence to- with the world of databases, where decades of investments have led wards dataframe-oriented data processing in Python, with Pandas to both sub-millisecond latencies for small queries and many orders dataframes being one of the most popular and the fastest growing of magnitude better scalability for large analytical queries. Further- API for data scientists [46]. Many new libraries either support the more, databases offer enterprise-grade features (e.g., transactions, Pandas API directly (e.g., Koalas [15], Modin [44]) or a dataframe fine-grained access control, tamper-proof logging, encryption) as API that is similar to Pandas dataframes (e.g., Dask [11], Ibis [13], well as a mature ecosystem of tools in modern clouds. cuDF [10]). This trend has resulted in a language surface for data sci- In this paper, we bring together the ease of use and versatility of ence in Python that is increasingly well defined and converging on Python environments with the enterprise-grade, high-performance a common set of primitives. Notwithstanding this popularity, scal- query processing of cloud database systems. We describe a system ing data processing with Pandas and achieving good performance we are building, coined Magpie, which exposes the popular Pandas in production remains a substantial challenge [9, 20, 25, 42]. API while lazily pushing large chunks of computation into scalable, Cloud environments, on the other hand, have enabled users to efficient, and secured database engines. Magpie assists the data manage and process data at hyper scale. Furthermore, in contrast to scientist by automatically selecting the most efficient engine (e.g., the effort of setting up a database on-premise, the cloud hasmade SQL DW, SCOPE, Spark) in cloud environments that offer multiple it ridiculously easy to try out and operate a variety of backends, i.e., engines atop a data lake. Magpie’s common data layer virtually database services with either co-located or disaggregated storage, eliminates data transfer costs across potentially many such engines. on demand [4, 5]. As a result, modern enterprises are more likely to We describe experiments pushing Python dataframe programs into already have their data in the cloud and operate multiple backends, the SQL DW, Spark, and SCOPE query engines. An initial analysis each optimized for different scenarios. The question therefore is of our production workloads suggest that over a quarter of the whether we can bring these two worlds together: the versatility computations in our internal analytics clusters could be optimized and easy-to-use aspects of Python data processing environments, through Magpie by picking the optimal backend. and the scale and performance of cloud environments. The above question exposes a daunting set of challenges. Pandas evaluates data operations eagerly over in-memory data while cloud ∗Work done while at Microsoft. backends process large query graphs that are pushed closer to the data in distributed storage. It is often tedious to embed Python code (usually via UDFs) into cloud backends, which generally provide a SQL interface. Despite the rise of newer managed services such This article is published under a Creative Commons Attribution License as Azure Synapse [7] which allow customers to effortlessly switch (http://creativecommons.org/licenses/by/3.0/), which permits distribution and reproduction in any medium as well as allowing derivative works, between different backends, choosing between these backends isa provided that you attribute the original work to the authors and CIDR 2021. challenging problem (as has been observed in previous polystore 11th Annual Conference on Innovative Data Systems Research (CIDR ’21). systems [26]). Finally, providing a good data science experience on January 10-13, 2021, Chaminade, USA. CIDR’21, January 10–13, 2021, Chaminade, CA Jindal, et al. Ibis → SQL Server Higher-level Ibis Ibis → SCOPE Abstractions Added by Magpie Vaex DASK Cuda Ray PySpark SQL + APIs Dataframe Dataframe Dataframe Programs Dataframe SQL + User Defned Functions Built-in SQL Extensions Functions Data Distributed Relational Tables Layer NumPy Arrays Native Backends Python Nvidia Azure Apache Microsoft Apache Google Microsoft Dask Ray PySpark Synapse PostgreSQL RAPIDS Analytics Spark SCOPE MADlib BigQuery SQL Server Figure 1: The data science jungle from a subset of current data science tools. top of cloud data services remains nontrivial, especially given the the techniques behind pushing Pandas operations into backends. unprecedented growth in data volume and complexity. Section 6 describes how Magpie chooses the best engine for a work- Fortunately, we identify four key enablers to bridge the gap be- load. We describe our common data layer in Section 7 and conclude tween the Python and cloud worlds. First, there is an active ongoing in Section 8 with a discussion of the road ahead. effort, led by the broader Python community, to standardize the Python APIs for data by bringing different variants of dataframe 2 THE DATA SCIENCE JUNGLE APIs under a common umbrella [1]. Second, many dataframe op- erations can be mapped to relational algebra, as also shown in As illustrated in Figure 1, current data science tools confront data prior work such as Modin [44] and Ibis [13], and hence can be scientists with a jungle of higher-level abstractions, APIs, data pushed down to a database (we discuss related work further in Sec- layers, and backends. The plethora of tools is driven by two factors. tion 2). Third, there is a shift from polystores (e.g., [26, 38, 39]) to First, the Pandas API is the de-facto choice for data scientists to polyengines operating on top of common disaggregated storage analyze data. This is supported by the fact that nearly all the Python- in the cloud. As a result, data is no longer locked away in data- based tools in Figure 1 provide dataframes-based APIs that resemble base stores and query engines are increasingly fungible. Finally, the Pandas API. Second, Pandas is not designed to scale to large there is an emergence of a common data format—Apache Arrow[2]— data, as noted by the creators of Pandas [41]. which significantly reduces data transfer costs and makes backend On the one hand, solutions have evolved within the Python interoperation practical. ecosystem to scale Pandas. Modin, for instance, is backed by the Motivated by these trends, in this paper we present a vision of Ray/Dask parallel processing engines that use distributed Pandas scalable and efficient data science on top of cloud backends. Ourgoal dataframes to leverage multiple cores for faster processing. CuDF is to let data scientists focus on data analysis using familiar Python is backed by RAPIDS and provides libraries to execute data ana- APIs and then transparently execute their workloads on the best- lytics pipelines on GPUs, building on NVIDIA CUDA primitives performing backend. We present Magpie, a data science middleware for low-level compute optimizations. PySpark provides a Python that exposes the popular Pandas API, automatically selects the best- API to interact with the Spark ecosystem, and Koalas takes it a step performing cloud backend for each Pandas script, lazily pushes further by mimicking the Pandas API backed by Spark distributed down large chunks of Pandas operations to those backends, and processing. Furthermore, Apache Arrow in-memory columnar data uses Arrow and ArrowFlight to communicate efficiently and cache format coupled with ArrowFlight for data transmission is fast de- intermediate results at the data layer. We illustrate the benefits veloping as a unifying data storage format across data engines and with Magpie in two different analytics environments at Microsoft— APIs. a data warehousing environment consisting of data already within On the other hand, hybrid approaches have evolved within the Azure SQL Data Warehouse (SQL DW) and a big data analytics database ecosystem to push the capabilities of relational engines to environment consisting of SCOPE and Spark query engines with support dataframe and tensor computations. The Apache MADlib disaggregated storage. Our experiments show that pushing Pandas project [3] provides SQL-based

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us