In recent years, the multi-core hardware has been gradually applied to data warehouse products. At present, the main core hardware includes the core CPU represented by IntelSCC, the kernel coprocessor represented by Intel, and the multi-core GPU represented by NVIDIA and AMD. The first chapter introduces the current main multi-core hardware and its features.
In recent years, the multi-core hardware has been gradually applied to data warehouse products. At present, the main public-core hardware includes the multi-core CPU represented by Intel SCC, the multi-core coprocessor represented by Intel Zhiqiang fusion kernel series, and the multi-core GPU represented by NVIDIA and AMD. The first chapter introduces the current main multi-core hardware and its features.
In recent years, the multi-core hardware has been gradually applied to data warehouse products. At present, the main public-core hardware includes the multi-core CPU represented by Intel SCC, the multi-core coprocessor represented by Intel Zhiqiang fusion kernel series, and the multi-core GPU represented by NVIDIA and AMD. The first chapter of this article introduces the current main multi-core hardware and its features, and compares the multi-core hardware in terms of cost effectiveness and versatility; the second chapter introduces the optimization technology of typical operators in the data warehouse on the multi-core hardware.
1. main core hardware 1.1. although the multi-core CPU of multi-core CPU is not a strict multi-core CPU, in many current studies, multi-core CPU is considered as a hardware with similar cores for comparative research. Multi-core CPUs are generally considered as general CPUs with 8 cores or less. Each core has an independent L2 and L1 Cache, data can be exchanged between multiple cores through the shared memory or L3 Cache. However, the number of cores is not a strict line between multiple cores and the multi-core. Intel currently supports up to 10 CPUs. The main difference between multi-core and multi-core is the universality and architecture. 1.2. The CPU of the multi-core CPU is not common at present and is not sold in the market. The multi-core CPU represented by Intel SCC is only available to cooperative universities and research institutes for research purposes. SCC is often seen in recent years.
Intel SCC integrates 48 peer cores, that is, each core has the same functions and performance, and each core has its own L2 Cache. Every two cores are integrated into one tile, and a total of 24 tile forms a 4*6 matrix, which is connected through the internal tell bus of the CPU. The two cores in each tile share a part (16 KB) of L1 Cache, which becomes MPB (Massage Passing Buffer ). All the MPB In the tile can be accessed by any core, thus forming a kb L1 Cache.
Each core in SCC has a 1 GHz clock speed and strong logic computing capability. The supported instruction sets are similar to common CPUs. This ensures universality while increasing the number of cores. In addition, the special Cache design allows you to optimize specific computing tasks. 1.3. multi-core coprocessor co-processor through high-speed bus and CPU connections or PCI-E excuse to connect to the North Bridge, is to assist the CPU to complete a specific computing task calculator. The ARM-based microprocessor can support a large number of 10 coprocessors and is widely used in Embedded terminals and smart devices. On the general computing platform, Intel also launched a series of co-processing products.
Xeon integrated core co-processor is actually a equipped with multi-core processor, Display memory (GDDR5), PCI-E16X interface peripherals, through the PCI-E socket access motherboard, through the North Bridge and CPU, Master Memory connection.
At present, the strong-converged processor can inherit a maximum of 61 cores, one of which processes PCI-E data transmission, and the other 60 cores are equivalent computing units. The supported type of on-board memory is DDR5, with a memory access bandwidth of more than 300 Gbit/s, and a maximum of 16 Gbit/s can be supported. Compared with GPUs, the coprocessor supports similar memory access bandwidth, but the maximum memory size is 1-2 times, at the same time, the number of coprocessor cores is relatively small, but the logic computing capability is stronger, and the versatility is better. 1.4. multi-core GPU is currently the most common multi-core hardware. Major GPU manufacturers, vodda and AMD, both provide multi-core GPU products. Among them, the CUDA technology implemented by mongoda has been widely used. In terms of architecture, GPU and coprocessor have similarities. However, the core computing capability and logic capability of the multi-core GPU are strong, so the GPU is more specific and more universal. In addition, the GPU core is usually divided into several groups, each group has dozens of cores, which can execute the same command at the same time and process different data, that is, SIMP. 1.5. multi-core hardware is more universal
1. multi-core CPU: universal, direct access to the system memory through the data bus, bandwidth 20-30 GB/s;
2. multi-core CPU: the architecture is similar to GPU and co-processor, but the main memory of the system can be accessed directly.
3. multi-core coprocessor: similar to GPU, the single-core computation capability and logic computation capability are stronger, and the versatility is better.
4. multi-core GPU: floating point computation ability, poor logic operation ability, memory several GB, Bandwidth 200 GB/s, but need to access data from the master through the PCI-E bus (PCI-E 16x: 4 GB/s ), poor versatility
Comparison of energy consumption and cost effectiveness
GPGPU has the highest cost performance and the lowest energy consumption, but the software development cost is high, in some algorithms, the CPU performance is not prominent. The overall CPU performance is better than that of the multi-core CPU.
In conclusion, except for general multi-core CPUs, Memory-core does not share all primary Memory and cache resources. Both the CPU and GPU are NUMA (Non Uniform Memory Access Architecture, non-uniform memory access architecture. The algorithm needs to access data. To increase the degree of parallelism, we need to increase the local GPU for data access and the bandwidth for the coprocessor to access the system memory to be more than 50 times lower than the local memory access bandwidth.
2. the data warehouse optimization technology on the core is 2.1. cache-optimized multi-core processors generally have different caching designs from general multi-core CPUs. For example, SCC support cross-core access of L1 Cache. In the data warehouse algorithm, because the Data Locality is poor, if the data enters the core through multi-level cache, processing will inevitably affect the efficiency. Therefore, the table scan algorithm can be used during optimization, load the data directly into MPB, and then enter the core for predicate filtering. 2.2. the connection algorithms used in optimizing data warehouses include sort-merge connections and hash connections.
Because multiple threads (cores) do not need to share data during the process of sorting and merging, Sort-merge connections are suitable for implementation on the multi-core hardware. However, sort-merge has many limitations. For example, connections in a data warehouse are usually performed between a dimension table and a fact table, while fact tables are very large, sort-merge requires fact tables to be sorted on the connection attributes. The cost of sorting is very high.
For more general hash connections, multiple threads (cores) need to access the shared hash table and hash Bucket During hash Data Division and connection. If optimization is not performed, it is impossible to significantly improve the performance of multiple cores. Therefore, some optimization technologies have emerged.
The common optimization technology is based on buckets. That is, data is first divided into irrelevant buckets and then linked. The algorithm is divided into two parts: bucket and connection.
In the bucket-based phase, to improve performance by using multiple cores, you must ensure that data cannot be shared among multiple cores. There are two common algorithms:
1. sharding Algorithm Similar to quickSort
Step 1: Separate the elements whose last hash value is 0 and 1 in array.
Step 2: separate the two child arrays based on the values of the last two subarrays of the hash value, recursively returning them until the number of elements in the subarray is less than a certain threshold value.
2. Two-Phase bucket-based algorithm
The number of Hash buckets is fixed. In the first stage, each core Splits a data table into its own bucket. In the second stage, each core combines buckets in a column. 2.1.
. 1. Two-Phase bucket-based algorithm
The first algorithm is more complex (n * log n). Although the latter algorithm is linear in time, the number of bins must be pre-fixed, if the data is skewed, the distribution of buckets is unbalanced.
The connection algorithm after bucket sharding can use a bitmap-based connection algorithm. As shown in 2.2, the first stage is the bucket-based computing. The second stage is to calculate a bitmap on a bucket in the left table, which is actually a bloom filter, in the third stage, the right table is filtered Based on the bitmap of the Left table to avoid unnecessary connection operations and a large amount of memory access.
2. Bucket-based connection Algorithm
In addition, due to the small dimension table in the data warehouse, the join algorithm can filter the predicates in the dimension table to obtain a Boolean vector and read the Boolean vector into the buffer zone of each core, connect to a fact table.
There is also a connection optimization technology called Invisible Join, which is a query rewriting technology. Because the dimension table is small, when the dimension table is connected to the fact table, the join condition is converted into a fact table predicate. For example, a foreign key of a fact table is connected to a primary key of a dimension table. If the value of a dimension table's primary key is within a continuous range, you can rewrite it into a between predicate on the fact table's foreign key, thus avoiding repeated random access to the dimension table.