Docsity

Buffering Database Operations - Computer Systems Architecture - Lecture Slides, Slides of Computer Architecture and Organization

Partial preview of the text

Download Buffering Database Operations - Computer Systems Architecture - Lecture Slides and more Slides Computer Architecture and Organization in PDF only on Docsity!

Buffering Database Operations for Enhanced Instruction Cache Performance

Outline

  • Introduction
  • Related Work
  • Memory Hierarchy
  • Pipelined Query Execution
  • A New Buffer Operator
  • Buffering Strategies
  • Instruction Footprint Analysis
  • Overall Algorithm
  • Experimental Validation
  • Conclusion and Future Work

Introduction

  • Relatively little research has been done on improving the instruction cache performance.
  • In this paper, the focus is on
    • improving the instruction cache performance for conventional demand-pull database query engines
    • achieving fast query execution throughput
    • not making substantial modifications to existing database implementations

Related Work

  • There are many techniques proposed to improve instruction cache performance at compiler level.
  • For database systems, these techniques do not solve the fundamental problem: - Large instruction footprints during database query execution, leading to a large number of instruction cache misses
  • The challenge:
    • Reducing the effective size of the query execution footprints without sacrificing performance
  • This issue should be resolved at the “query compiler” level (during query optimization)

Related Work

  • Zhou and Ross use a similar buffer strategy to batch access to a tree-based index (“Buffering accesses to memory-resident index structures”, In Proceedings of VLDB Conference, 2003)
  • The performance benefits of such buffering are due to improved data cache hit rates.
  • The impact of buffering on instruction-cache behaviour is not described.

Memory Hierarchy

  • Modern computer architectures have a hierarchical memory system, where access by the CPU to main memory is accelerated by various levels of cache memories.
  • Cache memories based on the principles of spatial and temporal locality****.
  • A cache hit happens when the requested data (or instructions) are found in the cache.
  • A cache miss incurs when the CPU loads data (or instructions) from a lower cache or memory

Memory Hierarchy

  • Latency is the time span that passes after issuing a data access until the requested data is available in the CPU
  • In hierarchical memory systems, latency increases with distance from the CPU
  • L2 cache sizes are expected to increase(2MB for Pentium M), L1 cache sizes will not increase at the same rate. Larger L1 caches are slower than smaller L1 caches, and may slow down the processor clock.
  • The aim in this paper is to minimize L1 instruction cache misses

Memory Hierarchy

  • Modern processors implement a Trace Cache instead of a conventional L1 instruction cache.
  • A trace cache is an instruction cache that stores instructions either after they have been decoded, or as they are retired. This allows the instruction fetch unit of a processor to fetch several basic blocks, without having to worry about branches in the execution flow.
  • Upon a trace cache miss, the instruction address is submitted to the instruction translation look aside buffer (ITLB), which translates the address into a physical memory address before the cache lookup is performed.
  • The TLB ( Translation Look aside Buffer ) is responsible for translating the virtual address into a physical address. The TLB is a little cache that contains recent translations. If it's not in the TLB then the translation must be loaded from the memory hierarchy, possible all the way down from main memory.

Memory Hierarchy

  • CPUs try to predict the outcome of branches, and have special hardware for maintaining the branching history of many branch instructions.
  • For Pentium 4 processors, the trace cache integrates branch prediction into the instruction cache by storing traces of instructions that have previously been executed in sequence, including branches.

Pipelined Query Execution

  • Each operator supports an open-next-close iterator interface
  • Open(): initializes the state of the iterator by allocating buffers for its inputs and output, and is also used to pass in arguments such as selection predicates that modify the behavior of the operator.
  • Next(): calls the next() function on each input node recursively and processes the input tuples until one output tuple is generated. The state of the operator is updated to keep track of how much input has been consumed.
  • Close(): deallocates the state information and performs final housekeeping

Instruction Cache Thrashing

  • If the instruction cache is smaller than the total instruction footprint, every operator finds that some of its instructions are not in the cache.
  • By loading its own instructions into the instruction cache, capacity cache misses occur to evict instructions for other operators from the cache.
  • However, the evicted instructions are required by subsequent requests to the operators, and have to be loaded again in the future. This

Simple Query

SELECT

SUM(l_extendedprice *

(1 - l_discount) *

(1 + l_tax)) as sum_charge,

AVG(l_quantity) as avg_qty,

COUNT(*) as count_order

FROM lineitem

WHERE

l_shipdate <= date '1998-11-01';

An Example for Usage of Buffer Operator

A New Buffer Operator

  • To avoid the instruction cache thrashing problem, implementing a new light-weight buffer operator using the conventional iterator interface is proposed.
  • A buffer operator simply batches the intermediate results of the operators below it.
  • Organize the tree of operators into execution groups. Execution groups are candidate units of buffering.
  • The new buffer operator supports the open-