HHVM Jump-Start: Boosting Both Warmup and Steady-State Performance at Scale

HHVM Jump-Start: Boosting Both Warmup and Steady-State Performance at Scale

HHVM Jump-Start: Boosting Both Warmup and Steady-State Performance at Scale Guilherme Ottoni, Bin Liu Facebook, Inc. Menlo Park, CA, USA fottoni,[email protected] Abstract—Just-In-Time (JIT) compilation is often employed information for optimizations. This is achieved via profile- in Virtual Machines (VMs) to translate their virtual-machine guided optimizations (PGO), also known as feedback-driven languages into real-machine code. This approach not only brings optimizations (FDO). To implement PGO, VMs use multi- portability, but it also enables aggressive compiler optimizations based on runtime behavior observed via profiling. The downside tier compilation, in which the code is first compiled with a of JIT compilation, compared to Ahead-Of-Time native compila- simplistic JIT (or even interpreted) to collect profile data (tier tion, is that the profiling and compilation overheads are incurred 1 compilation), and later recompiled in optimized mode by during execution. To mitigate these overheads, previous work leveraging the profile data (tier 2 compilation). have proposed sharing either profile data or final JIT compiled Compared to AOT, the downside of JIT compilation is the code across VM executions. Unfortunately, these techniques have drawbacks, including steady-state performance degradation and runtime overhead, particularly during the application’s start-up. difficulty of use. To address these issues, this paper presents the Because the compilation is performed at runtime, every cycle Jump-Start mechanism implemented inside the HipHop Virtual spent compiling the code is a missed cycle that could have Machine (HHVM). Jump-Start is a practical approach to share been used to actually execute the application. This overhead is VM profile data at a large scale, being used to power one of the very pronounced during the start of the application, while it largest websites in the world. In this paper, we argue for HHVM’s Jump-Start approach, describe it in detail, and present steady- is being profiled and compiled, which is typically called the state optimizations built on top of it. Running the Facebook execution’s warmup phase. After this phase, the application’s website, we demonstrate that Jump-Start effectively solves the execution reaches its steady-state or peak performance by warmup problem in HHVM, reducing the server capacity loss executing optimized JITed code. during warmup by 54.9%, while also improving steady-state The poor performance during a VM’s warmup phase is performance by 5.4%. Index Terms—virtual machine, JIT compilation, warmup, per- a well-known and important problem [1]–[5]. Although this formance optimization problem has been extensively studied in the past, the lack of proper solutions in most production-quality VMs attests to the I. INTRODUCTION difficulty of solving this problem in practice. In this paper, we describe Jump-Start, which is the approach Virtual Machines (VMs) have become a common strategy for used to address the warmup problem in the HipHop Virtual implementing a variety of high-level programming languages. Machine (HHVM) [6], [7]. HHVM is a production-quality, high- This approach, which became very popular with the Java performance VM implementing the Hack dialect of PHP [8], Virtual Machine (JVM), is currently used to implement and which has been used to run some of the largest sites on languages like C#, JavaScript, Python, PHP/Hack, Lua, and the web, including Facebook, Wikipedia and Baidu [9]. Jump- many more. In a VM-based implementation, the application’s Start adopts the approach of reusing JIT profile data across source code, instead of being directly compiled to machine VM executions, similar to earlier work done in the context of code, is compiled down to a higher-level virtual machine Java [1], [4], [10]. In contrast to earlier work though, this paper instruction set, typically called a bytecode.1 During runtime, describes how HHVM leverages Jump-Start to improve not only the application is executed via either interpretation or native warmup but also steady-state performance. Furthermore, this machine code that is translated from the bytecode using a paper describes practical aspects of our experience deploying Just-In-Time (JIT) compiler. Compared to implementations Jump-Start in a large-scale production scenario, namely running based on Ahead-Of-Time (AOT) compilation to machine code, the Facebook website. there are two important advantages of VMs: portability and Overall, this paper makes the following contributions: the ability to transparently leverage runtime information to 1) It presents the design of Jump-Start and its implementa- generate optimized machine code. tion within HHVM. Optimized VMs use JIT compilation to improve performance. 2) It describes several Jump-Start-based steady-state opti- As mentioned above, an advantage of using JIT instead of mizations implemented in HHVM. AOT compilation is the ability to transparently use runtime 3) It presents a thorough evaluation of the impact of Jump- 1The high-level representation may even be the source language, in so-called Start on HHVM for running a real-world, large-scale language VMs, which are typical for JavaScript. workload, the Facebook website. 978-1-7281-8613-9/21 c 2021 IEEE 340 CGO 2021, Virtual, Republic of Korea Accepted for publication by IEEE. c 2021 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/ republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. 550 4) It discusses reliability and other practical aspects of D deploying Jump-Start in a production environment. 500 The rest of this paper is organized as follows. Section II 450 400 presents background on HHVM as well as motivation for Jump- C Start. Section III then makes the case for the design decisions 350 behind Jump-Start, which is then presented in Section IV. 300 The optimizations to improve steady-state performance using 250 Jump-Start are presented in Section V. Section VI discusses 200 A B reliability concerns and how this work addresses them. After SizeCode (MB) 150 that, Section VII presents an evaluation of Jump-Start, followed 100 by a discussion of related work in Section VIII. Finally, 50 0 Section IX concludes the paper. 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 Time (min) II. BACKGROUND AND MOTIVATION The ability to seamlessly leverage runtime information is Fig. 1: JITed code size over time for HHVM running the Facebook website particularly important in JIT compilers for dynamic languages. without Jump-Start. This is because, in lack of profiling information, the quality of the compiled code for applications written in such languages and require the HHVM server to be restarted whenever a new suffers tremendously due to the wide realm of potential runtime revision of the application is deployed. At runtime, HHVM behavior enabled by various dynamic features. Although VMs can execute the application’s bytecode representation through can naturally support profile-guided optimizations through either interpretation or JIT compilation. We discuss these two JIT compilation, the overheads of JIT compilation can be components next. significant, particularly for large-scale applications with huge HHVM implements a traditional threaded bytecode inter- amounts of code. preter [11], which serves two main purposes. First, it allows In this work, we study how to reduce the overhead of JIT execution to make progress while the code is being compiled. compilation in the context of HHVM [6], [7]. HHVM is an ideal Second, the interpreter provides a last resort for execution. case study for this problem due to a combination of several This second purpose is particularly useful in case of HHVM factors: (1) it runs large-scale applications, (2) it implements because it removes the need to compile the entire source code a dynamic language where profile-guided optimizations are which, as discussed in Section II-B, can be quite large. important to obtain performance, (3) it is a highly optimized, The HHVM JIT compiler includes two alternative compila- production-quality VM, and (4) it employs state-of-the-art tion strategies. The first one is a tracing-based compiler, which compilation techniques [7]. In this section, we first provide breaks the application into tracelets that can be efficiently a brief background about HHVM’s compilation pipeline compiled purely based on information collected by inspecting (Section II-A), then we outline the challenges faced by HHVM the live VM state [6]. The machine code produced for a regarding JIT compilation overhead (Section II-B), followed compilation unit using this strategy is called a live translation. by a discussion of available opportunities (Section II-C). The second compilation strategy uses a region-based approach A. HHVM Background that aggressively optimizes arbitrary code regions by lever- HHVM employs a traditional VM architecture where the aging runtime information collected through profiling, thus source code is compiled to a bytecode representation offline, implementing a traditional PGO framework [7]. For a given before the application starts to execute. HHVM uses a custom compilation unit, the machine code produced for profiling bytecode designed specifically for representing PHP and Hack is called a profiling translation, while the final optimized programs [6]. Due to the dynamically typed nature of these code is called an optimized translation. In practice, the hottest languages, the bytecode is untyped. The bytecode representation portions of the application are compiled by the profile-guided of the source code is deployed to the execution environment region compiler to obtain the highest performance, while the — in Facebook’s case, to its fleet of web servers spread remaining portions of the application that are still regarded across many data centers.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 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