
c 2019 by the authors; licensee RonPub, Lubeck,¨ Germany. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/4.0/). Open Access Open Journal of Cloud Computing (OJCC) Volume 6, Issue 1, 2019 http://www.ronpub.com/ojcc ISSN 2199-1987 Code Generation for Big Data Processing in the Web using WebAssembly Sven Groppe, Niklas Reimer Institute of Information Systems (IFIS), University of Lubeck,¨ Ratzeburger Allee 160, D-23562 Lubeck,¨ Germany, groppe@ifis.uni-luebeck.de, [email protected] ABSTRACT Traditional clusters for cloud computing are quite hard to configure and setup, and the number of cluster nodes is limited by the available hardware in the cluster. We hence envision the concept of a Browser Cloud: One just has to visit with his/her web browser a certain webpage in order to connect his/her computer to the Browser Cloud. In this way the setup of the Browser Cloud is much easier than those of traditional clouds. Furthermore, the Browser Cloud has a much larger number of potential nodes, as any computer running a browser may connect to and be integrated in the Browser Cloud. New challenges arise when setting up a cloud by web browsers: Data is processed within the browser, which requires to use the technologies offered by the browser for this purpose. The typically used JavaScript runtime environment may be too slow, because JavaScript is an interpreted language. Hence we investigate the possibilities for computing the work-intensive part of the query processing inside a virtual machine of the web browser. The technology WebAssemby for virtual machines is recently supported by all major browsers and promises high speedups in comparison with JavaScript. Recent approaches to efficient Big Data processing generate code for the data processing steps of queries. To run the generated code in a WebAssembly virtual machine, an online compiler is needed to generate the WebAssembly bytecode from the generated code. Hence our main contribution is an online compiler to WebAssembly bytecode especially developed to run in the web browser and for Big Data processing based on code generation of the processing steps. In our experiments, the runtimes of Big Data processing using JavaScript is compared with running WebAssembly technologies in the major web browsers. TYPE OF PAPER AND KEYWORDS Regular Research paper: Browser Cloud, Big Data, Browser Virtual Machine, WebAssembly, JavaScript 1 INTRODUCTION whole data has been processed and materialization of intermediate results to external storage like hard disks or SSDs is often avoided. Complex data processing tasks are typically splitted into basic operations, which form an operator graph. In However, if all operators implement the same interface the traditional way taken by databases each operator and can be dynamically composed in the operator graph, offers the same interface, the iterator interface, such that the method calls need to be virtual using indirect the operators can be orthogonally composed together addresses of the method implementations, which is the in the operator graph [10]. The iterator interface standard approach for calling overridden methods in offers especially a method to retrieve the next computed object-oriented languages. Indeed virtual method calls result, such that first results are determined before the are slower than direct method calls, where the addresses 1 Open Journal of Cloud Computing (OJCC), Volume 6, Issue 1, 2019 JavaScript-Engine a compiler that runs directly in the browser (see Query Figure 1) to start query processing at any browser in Parser the network. Alternative architectures with a server Algebra Expression increases latency and communication costs because + - x Opti- ← → . mizer of introducing additional communication over the Algebra Expression network. However, there is a lack of WebAssembly Code compilers that directly run in the browser. Hence our Gene- contribution includes a compiler from a Kotlin subset to Browser rator WebAssembly bytecode. WebAssembly Bytecode Furthermore, we run experiments to validate the Query Exe- performance speedup of WebAssembly bytecode cution executing Big Data processing tasks in comparison to WebAssembly-Engine running generated code in JavaScript. Figure 1: Query processing in the browser via code generation using an online kotlin compiler 2 BASICS While we introduce relevant programming languages of the method implementations are fixed and can be in Section 2.1, we describe different types of code determined at compile-time. For typical applications, generation in Section 2.2 as basics about code generation the difference in performance is insignificant. However, for query processing. We introduce the related work in for big data processing, where millions, billions or Section 2.3. more data items need to be processed, methods for data processing need to be also called millions, billions or more times, such that the performance is drastically 2.1 Programming Languages increased whenever direct addressing is used to call methods. Whenever queries to be processed are retrieved For the implementation we use the programming at runtime, direct method calls during data processing languages JavaScript (for our online compiler) and can be only achieved if code for the single data Kotlin (for the multiplatform engine), as well as processing steps are dynamically composed together, WebAssembly bytecode as compilation target for compiled and executed. This approach is called code executing the generated code from the query. For a better generation [19]. overview we introduce them with focus on the special For a long time, the Web environment doesn’t seem features in this context. to be suitable for Big Data processing, because there was no technology to establish a network between 2.1.1 JavaScript the browsers of a website, and browsers didn’t offer enough computing and storage resources. The situation JavaScript [28] is an object-oriented general-purpose changes from browser generation to browser generation interpreter language. It’s origins date back to 1995 when by supporting technologies like WebRTC [29] for JavaScript, which was called LiveScript at that time, real-time communication capabilities, and JavaScript has been integrated into the Netscape webbrowser to [28] and WebAssembly [27] for executing programs. introduce interactive features for websites. WebAssembly defines bytecode to be run in a virtual JavaScript runs a garbage collector in the background, machine and promises faster execution times than the which task is to clean up the memory by identifying and interpreted JavaScript language. deleting superflous objects and leaving the free space for Kotlin [15] is currently the rising star among newly the operating system. Being an interpreted language, the developed programming languages with 2.6 times code isn’t compiled beforehand. It is processed in the growth in contributors in one year on Github [11]. background when accessing a website. Over the years Furthermore, Kotlin is ideally designed for large-scale JavaScript has become a very integral part of the browser data processing [12]. Hence we focus on the use of engines and the browser developers continously increase Kotlin as programming language for formulating the their efforts to provide better JavaScript performance. generated code for Big Data processing. However, JavaScript execution is still outperformed by machine code by a factor of 10-100. Especially games or applications with huge amounts of data suffer a lot Code generation for Big Data processing requires from this fact. [5] 2 S. Groppe, N. Reimer: Code Generation for Big Data Processing in the Web using WebAssembly Android Big Data analytics engine, which owns a common code basis for Big Data processing over several target JVM Server platforms. Because of Kotlin’s multiplatform feature, this multiplatform Big Data analytics engine [7] is currently being developed in Kotlin. Hence it is very Desktop consistent to use Kotlin as programming language for the web compiler for running the generated code for Big Server Node.js Data processing. JS Browser 2.1.3 WebAssembly Kotlin WebAssembly The WebAssembly technology [27] includes a virtual machine that is being executed inside of the web browser. tvOS It’s instances are stored, controlled and called using (x64/arm64) JavaScript. WebAssembly’s virtual machine is based on the watchOS principle of the stack machine. As the stack is able to (x86/arm32/64) store several data types, it’s necessary to save additional information about the data type of the elements on the Android stack. This method prevents that operations are being LLVM/Native (arm32/64 executed on elements of a different data type. /x86/64) As a new way to deploy established programming languages to the web browser, WebAssembly has a iOS great potential. Hence there exists already a huge collection of projects that compile various languages to MacOS WebAssembly. [3] The currently available version 1.0 is the very first Linux release that is ready for productive use. It’s focused on the four skills compilation target, fast execution, Win compactness and linear memory to run C/C++ code and is called Minimum Viable Product (MVP). This is also Figure 2: Targets of Kotlin the first version that has been shipped with major web browsers. Before executing the bytecode it’s subjected for 2.1.2 Kotlin a machine-dependent optimization in the browser. Additionally,
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages15 Page
-
File Size-