<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Towards a Memory-Adaptive Hybrid Hash Join Design</title></titleStmt>
			<publicationStmt>
				<publisher>2023 IEEE International Conference on Big Data (BigData)</publisher>
				<date>12/15/2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10548704</idno>
					<idno type="doi">10.1109/BigData59044.2023.10386098</idno>
					
					<author>Giulliano Silva Zanotti Siviero</author><author>Shiva Jahangiri</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[In database management systems (DBMSs) that handle multiple concurrent queries, adapting to fluctuating workloads is crucial. This flexibility allows the DBMS to revise decisions based on current workload and available resources. As memory availability changes with the arrival or completion of queries, having memory-intensive operators like the Hybrid Hash Join that dynamically adapt is vital. This paper introduces a new memory-adaptive Hash-Based join algorithm design implemented in Apache AsterixDB and evaluates its responsiveness to memory variability.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>INTRODUCTION</head><p>Despite years of research, managing memory for concurrent queries remains a complex issue for most DBMSs. Due to limited memory capacity, allocating memory judiciously among memory-intensive operators of concurrent queries is essential. Many DBMSs use fixed memory allocations for these operators, but this static approach limits flexibility with unpredictable workloads, often leading to resource underutilization and suboptimal system performance.</p><p>The Hybrid Hash Join (HHJ), a commonly used and memory-intensive join operator, can greatly influence system performance. While studies in the 1990s focused on memoryadaptive HHJ designs using HDD simulators <ref type="bibr">[6,</ref><ref type="bibr">13]</ref>, many current DBMSs still employ memory-static (non-adaptive) operators, retaining allocated memory throughout the query execution <ref type="bibr">[1,</ref><ref type="bibr">2,</ref><ref type="bibr">3,</ref><ref type="bibr">4]</ref>. We argue that static memory allocation remains problematic even with modern databases using rapid SSDs or disaggregated storage. Such static memory allocation can lead to unnecessary delays for queries, resource underutilization, and unnecessary scaling in cloud environments.</p><p>In this work, we design and implement a memory-adaptive HHJ (MA-HHJ) algorithm for big data management systems and evaluate its responsiveness to the memory change requests of resource manager. We use Apache AsterixDB <ref type="bibr">[2,</ref><ref type="bibr">5]</ref>, an open-source big data management system, for implementation and evaluation of our approach on a real system.</p><p>The remainder of the paper is organized as follows: Section I discusses previous work related to this study. Section II describes the design of our MA-HHJ algorithm and provides details of its implementations. Section III describes the exper-Shiva Jahangiri</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Department of Computer Science and Engineering</head><p>Santa Clara University Santa Clara, United States sjahangiri@scu.edu iments conducted and their preliminary results, while Section I V concludes the paper.</p><p>Hybrid Hash Join was proposed initially in the 1990s, and several studies were conducted analyzing its performance theoretically and empirically <ref type="bibr">[8,</ref><ref type="bibr">9,</ref><ref type="bibr">14]</ref>. The initial design of HHJ relied heavily on precise data statistics to determine the optimal number of partitions and to choose the in-memory resident partition accurately. This approach aimed to maximize memory utilization and minimize disk spilling. Nevertheless, maintaining these statistics is not always practical.</p><p>To overcome this challenge, the authors of <ref type="bibr">[11]</ref> developed a dynamic destaging approach for HHJ, enabling all partitions to expand within the available memory limits. When memory becomes limited, the algorithm dynamically selects partitions to spill during runtime. This approach termed Dynamic Hybrid Hash Join (DHHJ), has been incorporated into several contemporary DBMSs, including Apache AsterixDB <ref type="bibr">[10]</ref>, which is utilized in this study. While DHHJ enhances the flexibility of the original HHJ design, it still manages memory statically and cannot adjust to memory changes. To address this issue, the authors of <ref type="bibr">[15]</ref> introduced a Hash-Based algorithm capable of adapting to memory fluctuations during the Build Phase through a bucket tuning method. Subsequently, two additional memory-adaptive algorithms, Partially Preemptible Hash Join <ref type="bibr">[12]</ref> and Memory-Contention Responsive Hash Join <ref type="bibr">[7]</ref>, were proposed. These algorithms adjust to new memory allocations during the Probe Phase. Notably, the Memory-Contention Responsive Hash Join is straightforward to implement and, as indicated in <ref type="bibr">[7]</ref>, offers superior performance compared to Partially Preemptible Hash Join. Both algorithms were assessed and contrasted in Davison <ref type="bibr">[7]</ref> using a simulator due to the limited computing resources available at that time.</p><p>To the best of our knowledge, these foundational papers set the stage for memory-adaptive database operations. In contemporary DBMSs, however, there is a noticeable preference for simpler, memory-static operators despite the efficiency gains offered by memory-adaptive alternatives <ref type="bibr">[1,</ref><ref type="bibr">2,</ref><ref type="bibr">3,</ref><ref type="bibr">4]</ref>. For instance, in Amazon Redshift, the memory of queued queries can be modified; however, the already-executing queries will retain their initial memory allocations <ref type="bibr">[1]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. M E M O RY-A D PAT I V E H Y B R I D HAS H JOIN: DESIGN</head><p>In this section, we outline the structure and implementation specifics of MA-HHJ. This variant, which is an adaptation of AsterixDB's standard HHJ algorithm <ref type="bibr">[10]</ref> to be memory-adaptive, interacts frequently with the resource manager for memory budget adjustments through two mechanisms: 1) Event-based: When extra memory is needed, such as to avoid disk spilling, the HHJ operator will request it from the resource manager. 2) Frame-Interval: The algorithm initiates a check with the resource manager at intervals of every X frames processed by the HHJ. It is important to note that the resource manager is responsible for deciding memory allocation for operators to optimize performance. Our focus is solely on crafting an MA-HHJ responsive to memory changes. Our resource manager is a simulated component described in Section III. Each interaction with the resource manager results in one of the following three responses: 1) an increase, 2) decrease, or 3) no change in memory allocation. A. Build Phase.</p><p>MA-HHJ can respond to memory decrease responses by releasing unused memory and spilling partitions, if necessary. Such partition spillings are simple since records are not inserted in the hash table yet.</p><p>In case of a memory increase response, MA-HHJ will accept the extra memory offered only if it can use it immediately. Before building the hash table, the MA-HHJ tries to reload spilled partitions into memory if enough memory is available. Listing 1 illustrates how our algorithm handles memory budget changes during the Build Phase. In case of memory increment, spilled partitions may be reloaded into memory during the Probe Phase if enough memory is available; however, their state is different from memory-resident partitions since there might have been some tuples from the Build input that probed the hash table while such partitions were disk-resident; thus they were written to disk as well to be processed later. To handle this situation, an additional step is necessary by the end of the Probe Phase to probe such "missed" tuples by probing them against the reloaded partitions. It is important to note that restoring diskresident partitions during the Probe Phase may avoid unnecessary rounds of Joins. Listing 2 delves into this possibility.</p><p>In case of memory decrement, partition spellings trigger a hash table rebuilt to avoid the complexity of maintaining this data structure. To account for different memory contention scenarios, the resource manager assigns the memory budget for the operator according to the following distribution: During 80% of the time, the memory was chosen randomly from 80% to 100% of the maximum memory for join and the rest of the time between the minimum possible (20 frames based on <ref type="bibr">[10]</ref>) to 100% of the maximum required memory for join.</p><p>As Figure <ref type="figure">1</ref> shows, more frequent check-ins with the resource manager improve the responsiveness of MA-HHJ to memory changes with the expense of a higher amount of I/O, which can lead to higher execution time for the operator. &#168;Due to space limitations, we only present the results of Frame-based experiments. The increase in I/O operations and volume directly impacts the operator's execution time, Figure 2 presents the impact of memory adaptivity over the operator's execution time. The central contribution of this study lies in understanding how memory variance and the frequency of memory budget updates impact the I/O volume and, consequently, the execution time of an operator. We showed that the responsiveness of MA-HHJ is directly impacted by the frequency of operator check-ins with the resource manager. The future work of this study involves studying and designing dynamic memory assignment logic for the resource manager in order to maximize its performance goals as well as designing memory-adaptive versions of other memory-intensive operators such as sort.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>979-8-3503-2445-7/23/$31.00 &#169;2023 IEEE</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_1"><p>Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on October 14,2024 at 22:53:23 UTC from IEEE Xplore. Restrictions apply.</p></note>
		</body>
		</text>
</TEI>
