1. Field of the Invention
The present application relates generally to computer and software systems. More particularly, the present application relates to parallel database systems.
2. Description of the Background Art
In a typical business intelligence (BI) environment, the database system processes a large number of queries with a wide spectrum of complexities. The complexity of the queries range from small queries accessing few rows in a database table, to medium queries processing millions of rows, to large queries processing billions of rows. This type of concurrent mixed workload presents challenges for the BI and enterprise data warehouse (EDW) systems. These systems generally include a large number of processors working cooperatively to process the workload.
Consider a query to be executed on a BI or EDW system having a large number of central processing units (CPUs). For one query to run on all of the system's CPUs, the query data often needs to be repartitioned, and in certain cases replicated, across the CPUs (i.e. for each CPU). Depending on the size of the query and the number of CPUs, such partitioning may cause a large overhead. The overhead may sometimes even exceed the benefit of the massive parallelism of the BI or EDW system. As such, running all queries at a full degree of parallelism (i.e. on all the CPUs of the system) will generally result in an inefficient use of system resources.
Hence, it is beneficial to have the capability to execute different queries at different degrees of parallelism on a query by query basis. For example, a small query may be most efficiently run on a single CPU, while a large query may take good advantage of all of the system CPUs in order to process a large amount of data effectively. In between those extremes, a medium size query may run more efficiently on a subset of the system CPUs.
However, as determined by the applicants, running small and medium queries on a subset of system CPUs introduces other challenges, including the following.
1) The system needs to figure out the potential required resources for the query to assure that reducing the degree of parallelism does not result in resource shortage.
2) The queries/workload need to be balanced evenly over the system CPUs to ensure fairness in the execution of the queries and an efficient utilization of system resources.
3) The CPU assignments for the queries need to minimize or limit the number of queries that a CPU is executing in order to minimize or limit resource contention and context switching.
Furthermore, query execution times can vary substantially. Hence, even a uniform distribution of queries over the system CPUs does not guarantee a balanced distribution of workload. As such, applicants believe that a good workload balancing across the CPUs generally requires feedback from the runtime system to indicate which CPUs are less utilized than others.
Unlike prior solutions which partition CPU nodes into groups, the solution disclosed herein does not rely on partition schemes set up by the user. Instead, the solution disclosed herein selects a number of CPUs based on pertinent properties of a query, and it automatically balances the queries across the system using adaptive segmentation.
For a query to be executed in parallel, data is distributed to each participating CPU where a portion of the query will be executed using an executive server process (ESP). Depending on the query plan steps, the data may need to be redistributed multiple times to different sets of ESPs for subsequent execution steps. Each group of ESPs executing the same task for a query (on different portions of the data) is called an ESP layer. A query may have one or more ESP layers depending on the execution steps. The maximum number of ESPs in any of the query's ESP layers determines the total number of CPUs needed by the query, which we will refer to as the degree of parallelism.
In accordance with an embodiment of the invention, the EDW server 112 may use a query optimizer module to determine a maximum degree of parallelism (MDOP) for the query. The query optimizer may generally consider any degree of parallelism from one CPU up to the total number of CPUs in the system. In an environment having a modest number of concurrent queries, better resource utilization may be achieved by a safe reduction of the degree of parallelism for most queries. This may be accomplished by determining the MDOP on a query by query basis. The query optimizer may be configured to only consider query plans with degrees of parallelism that do not exceed the MDOP computed for that query. One technique for determining the MDOP for a query is described below in relation to
In the second block 2, the EDW server 112 requests preparation of the query by its query compiler.
In the third block 3, the query compiler returns the compiled query. At this point the compiled query, while specifying the number of ESPs at each ESP layer, is not bound to any particular subset of CPUs. Thereafter, the EDW server 112 returns a “success” indication or notification to the application 104 per block 4.
The application 104 then requests execution of the query per block 5, and after receiving that request, the server 112 sends a request for permission to execute the query to the WMS 122 per block 6. When appropriate, the WMS 122 allows the server 112 to execute the query per block 7.
In accordance with an embodiment of the invention, the WMS 122 determines an affinity value based on the current runtime state and returns the affinity value to the EDW server 112 per block 7. The affinity value specifies the choice of CPU subsets (adaptive segmentation) to use for placement of executive server processes (ESPs) and may be advantageously used to achieve load balancing. The WMS has access to certain global information about the current state of the system which can be useful in determining the affinity value. This is shown by the WMS system's access to the System Information (System Info) and the runtime system (RTS) in
The server 112 requests execution of the query by the executor (EXE) per block 8. Included in the request is the affinity value for use by the executor (EXE). The executor uses the affinity value to place the ESPs onto the CPUs. Techniques disclosed herein for placing the ESPs onto the CPUs using the affinity value are described further below in relation to
The executor (EXE) places the compiled query onto the CPUs based on the affinity value, executes the query and returns the result per block 9. Thereafter, the server 112 requests to the WMS that the affinity value be released per block 10, and also returns the result to the application 104 per block 11.
Similarly,
The EMR is then divided 350 by a constant Memory_Unit that represents the amount of memory available per CPU for any query. This ensures that the degree of parallelism is not limited to an extent that query execution would suffer due to shortage of available memory on the CPUs executing the query. Similarly, the ECR is divided 352 by a constant Work_Unit that represents the amount of work acceptable to be assigned per CPU for any query not running at full system parallelism. This ensures that queries processing large amounts of data will run at a sufficient degree of parallelism.
The maximum value of EMR/Memory_unit and ECR/Work_unit is then selected 354 and that value is rounded up to the nearest 2M times the adaptive segment block size (ASBS), up to the total number of CPUs in the system (where M=0, 1, 2, 3, . . . ). The value of ASBS represents the smallest number of CPUs that can be assigned to a single query. This is a system configuration and can be set as low as 1 CPU. The rounded up value is then output as the maximum degree of parallelism (MDOP). This procedure results in different queries being optimized using various degrees of parallelism varying from the minimal ASBS for small queries, to a 2M multiple of ASBS for medium size queries, to the total number of CPUs in the system for very large queries.
The first (top) row with CPU subset size of 16 consists of a single CPU subset 402 with all the 16 CPUs. The second row with CPU subset size of 8 consists of two CPU subsets 402, each having 8 CPUs. The first subset has the even numbered CPUs, and the second subset has the odd numbered CPUs. Similarly, the third row with CPU subset size of 4 consists of four CPU subsets 402, each having 4 CPUs, the fourth row with CPU subset size of 2 consists of eight CPU subsets 402, each having 2 CPUs, and the fifth row with CPU subset size of 1 consists of sixteen CPU subsets 402, each having a single CPU.
In this example, the CPU subsets specified by affinity value=5 are shown. The CPU subsets shaded gray are those specified by affinity value=5. As shown, the affinity value specifies one CPU subset 402 for each subset size 404 (i.e. one subset in each row). Since the affinity number is 5, each specified subset includes CPU number 5. Hence, the CPU subset {5} is specified (shaded gray) for CPU subset size 1 (bottom row), the CPU subset {5, 13} is specified for CPU subset size 2, the CPU subset {1, 9, 5, 13} is specified for CPU subset size 4, the CPU subset {1, 9, 5, 13, 3, 11, 7, 15} is specified for CPU subset size 8, and the CPU subset {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15} is specified for CPU subset size 16. The set of CPU subsets defined by a given affinity value is called an affinity group.
First, the ESPs in a given ESP layer are distributed over the entire system. The distribution may be achieved by using an interleaved ordering of the CPUs for the CPU subsets. The distribution achieved by the interleaved ordering is illustrated by example in
Second, each ESP layer is placed on one of 2N distinct CPU subsets based on the affinity value returned by the WMS or some other component used for generating affinity values. One implementation of this first aspect is described further below in relation to
Finally, in a third optional aspect, each ESP layer of a query may be placed based on a different affinity value. One implementation of this third aspect is described further below in relation to
Per block 704, the offset used to start the placement is determined. This offset value is equal to the affinity value modulo (%) the skip number. The result of this modulo operation is a number between zero and (skip−1).
Per block 706, the subset of CPUs to use is given by i multiplied by the skip number plus the offset value, where i goes from zero to the number of ESPs in the ESP layer minus one.
Without the cyclical placement option enabled, then the placement of the ESP layers would be in accordance with A) where all ESP layers of the query are placed based on a single affinity value (in this case, affinity number 6). Hence, all four ESP layers would be placed on the CPU subset {2, 6, 10, 14}. Therefore, in this example, only one-quarter of the CPUs are used with non-cyclical placement.
On the other hand, with the cyclical placement option enabled, then the placement of the ESP layers would be in accordance with B) where the first ESP layer is placed according to the affinity number 6. However, the affinity number is incremented by one from 6 to 7 for the placement of the second ESP layer, and the affinity number is further incremented by one from 7 to 8 for placement of the third ESP layer. Thus, while the first ESP layer is placed on the CPU subset {2, 6, 10, 14}, the second ESP layer is placed on the CPU subset {3, 7, 11, 15}, and the third ESP layer is placed on the CPU subset {0, 4, 8, 12}. Therefore, in this example, three-quarters of the CPUs are used with cyclical placement. Advantageously, this cyclical placement provides better load balancing.
In accordance with an embodiment of the invention, the steps discussed above are implemented as processor-executable instructions stored on a computer-readable medium or stored in computer-readable memory. These processor-executable instructions may be run, for example, on a computer apparatus, such as depicted in
In the above description, numerous specific details are given to provide a thorough understanding of embodiments of the invention. However, the above description of illustrated embodiments of the invention is not intended to be exhaustive or to limit the invention to the precise forms disclosed. One skilled in the relevant art will recognize that the invention can be practiced without one or more of the specific details, or with other methods, components, etc. In other instances, well-known structures or operations are not shown or described in detail to avoid obscuring aspects of the invention. While specific embodiments of, and examples for, the invention are described herein for illustrative purposes, various equivalent modifications are possible within the scope of the invention, as those skilled in the relevant art will recognize.
These modifications can be made to the invention in light of the above detailed description. The terms used in the following claims should not be construed to limit the invention to the specific embodiments disclosed in the specification and the claims. Rather, the scope of the invention is to be determined by the following claims, which are to be construed in accordance with established doctrines of claim interpretation.
Number | Name | Date | Kind |
---|---|---|---|
5437032 | Wolf et al. | Jul 1995 | A |
5548770 | Bridges | Aug 1996 | A |
5574900 | Huang et al. | Nov 1996 | A |
5813005 | Tsuchida et al. | Sep 1998 | A |
5835755 | Stellwagen, Jr. | Nov 1998 | A |
5864840 | Leung et al. | Jan 1999 | A |
5943666 | Kleewein et al. | Aug 1999 | A |
6032143 | Leung et al. | Feb 2000 | A |
6272501 | Baumann | Aug 2001 | B1 |
7010521 | Hinshaw et al. | Mar 2006 | B2 |
7565657 | Leung et al. | Jul 2009 | B1 |
20030037048 | Kabra et al. | Feb 2003 | A1 |
20030163512 | Mikamo | Aug 2003 | A1 |
20030212668 | Hinshaw et al. | Nov 2003 | A1 |
20050050041 | Galindo-legaria et al. | Mar 2005 | A1 |
20050081210 | Day et al. | Apr 2005 | A1 |
20050108717 | Hong et al. | May 2005 | A1 |
20060047683 | Lakshminarayan et al. | Mar 2006 | A1 |
20060129542 | Hinshaw et al. | Jun 2006 | A1 |
20060218123 | Chowdhuri et al. | Sep 2006 | A1 |
20060230016 | Cunningham et al. | Oct 2006 | A1 |
20070124274 | Barsness et al. | May 2007 | A1 |
20080046895 | Dillenberger et al. | Feb 2008 | A1 |
20080276261 | Munshi et al. | Nov 2008 | A1 |
Number | Date | Country |
---|---|---|
10-198640 | Jul 1998 | JP |
2007-034414 | Feb 2007 | JP |
Entry |
---|
D. Sciuto, F. Salice, L. Pomante and W. Fornaciari, Metrics for design space exploration of heterogeneous multiprocessor embedded systems, Tenth International Symposium on Hardware/Software Codesign (CODES) (2002), pp. 55-60. |
International Searching Authority, The International Search Report and the Written Opinion, 10 pages. |
Supplementary European Search Report, Oct. 14, 2010, 6 pages, European Patent Office, Munich, Germany. |
Anastasios Gounaris et al., A novel approach to resource scheduling for parallel query processing on computational grids, Distributed and Parallel Databases, Kluwer Academic Publishers, May 25, 2006, vol. 19, pp. 87-106. |
Armstrong B et al., Complier-based tools for analyzing parallel programs, Parallel Computing, Elsevier Publishers, vol. 24, No. 3-4, May 1, 1998, pp. 401-420. Amsterdam, NL. |
International Searching Authority, The International Search Report and The Written Opinion, 10 pages, PCT/US2008/083353 Date Unknown. |
Number | Date | Country | |
---|---|---|---|
20090132488 A1 | May 2009 | US |