An enterprise may utilize a cloud computing environment to let users perform tasks. For example, the enterprise might let various users execute an application via the cloud computing environment to process purchase orders, adjust human resources information, generate invoices, etc. The cloud computing environment may be associated with one or more databases, and the physical layout of such databases can substantially impact performance and memory consumption. As a result, an inappropriate physical layout can significantly degrade performance or increase the memory consumption and thereby increase the hardware costs of an organization operating the database (the increase of hardware costs may be a consequence of bad performance or increased memory consumption). Because the amount of provisioned Dynamic Random Access Memory (“DRAM”) dominates hardware costs, DataBase-as-a-Service (“DBaaS”) providers in particular must carefully consider the economical tradeoffs between memory consumption and performance. Finding an optimal physical layout, e.g., with respect to memory consumption or performance, is a complex and time-consuming process usually performed by database experts. As a result, academia and industry developed tools for automated physical database design. Typically, such automated approaches focus on static workloads. Note, however, that workloads will change over time. Whenever workload changes are not addressed timely the current physical layout may no longer be optimal, resulting in a significant degradation in performance or an increase in memory consumption. The question of how to find appropriate physical layouts for workloads that will change over time is largely open despite high practical relevance.
It would therefore be desirable to provide accurate and efficient workload predictions which can serve as an input to a physical database design advisor. As a consequence, the physical layout may be timely adapted to workload changes and therefore be optimized for the future workload, such that future high performance and/or low memory consumption is achieved.
According to some embodiments, methods and systems may be associated with a cloud computing environment. A workload prediction framework may receive observed workload information associated with a database in the cloud computing environment (e.g., a DBaaS). Based on the observed workload information, a Statement Arrival Rate (“SAR”) prediction may be generated. In addition, a host variable assignment prediction may be generated based on the observed workload information. The workload prediction framework may then use the SAR prediction and the host variable assignment prediction to automatically create a workload prediction for the database. A physical database design advisor (e.g., a table partitioning advisor) may receive the workload prediction and, responsive to the workload prediction, automatically generate a recommended physical layout for the database (e.g., using a cost model, the current physical layout, and an objective function). Note that the current physical layout may be considered in this decision as switching from one to another layout can also degrade performance or increase memory consumption.
Some embodiments comprise means for receiving, by a computer processor of a workload prediction framework, observed workload information associated with a database in the cloud computing environment; based on the observed workload information, means for generating a SAR prediction; based on the observed workload information, means for generating a host variable assignment prediction; means for automatically creating a workload prediction for the database using the SAR prediction and the host variable assignment prediction; and responsive to the workload prediction, means for automatically generating a recommended physical layout for the database by a physical database design advisor.
Some technical advantages of some embodiments disclosed herein are improved systems and methods to provide accurate and efficient workload predictions which can serve as an input to a physical database design advisor.
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of embodiments. However, it will be understood by those of ordinary skill in the art that the embodiments may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to obscure the embodiments.
One or more specific embodiments of the present invention will be described below. In an effort to provide a concise description of these embodiments, all features of an actual implementation may not be described in the specification. It should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another. Moreover, it should be appreciated that such a development effort might be complex and time consuming, but would nevertheless be a routine undertaking of design, fabrication, and manufacture for those of ordinary skill having the benefit of this disclosure.
Real-world applications are characterized by workloads where the arrival rate and parameterization of Structured Query Language (“SQL”) statements can change over time. Without continuous adjustments of the physical layout to reflect such workload drifts, memory consumption and performance can deteriorate significantly. Existing approaches for automated physical database design, particularly table partitioning advisors, fail to address workload drifts because the physical layouts they propose are based on the observed workload. Some embodiments described herein provide a framework for the continuous adaptation of physical layout under workload drifts. Some embodiments predict the future workload based on detected workload drifts in the arrival rate and in the parameterization of SQL statements. The predicted workload is then fed into a physical database design advisor. Using a real-world application, accurate predictions of the future workload and a substantial hardware cost reduction on a commercial cloud database can be achieved compared to existing approaches.
Consider a stream of parameterized SQL statements (SELECT, INSERT, UPDATE, DELETE, . . . ) as the workload, where each statement contains host variables that are assigned by parameter values at execution time. A workload drift is then characterized by a temporal change in the arrival rate of statements or in the parameter values assigned to the host variables. Whenever workload drifts are not addressed in a timely fashion, the current physical layout may no longer be optimal, which can lead to a significant increase in workload costs.
A straightforward method to deal with workload drifts is to repeatedly feed the observed workload into a physical database design advisor, e.g., at fixed intervals. Such an approach is inherently backward-looking as the suggested physical layout lags behind workload drifts and may already be suboptimal when data reorganization (e.g., table repartitioning) starts. By contrast, some embodiments described herein provide a forward-looking approach that determines the new physical layout using a prediction of the future workload. Typical workload predictors are only able to forecast a future arrival rate of statements. However, physical database design advisors, in particular table partitioning advisors, often rely on fine-granular workload statistics, e.g., the parameterization of SQL statements. As a result, some embodiments described herein predict the future parameter values assigned to the host variables (in addition to the arrival rate of statements).
As a real-world scenario for workload drift, consider historical test results that many software development projects store in a database to identify bugs or authorize patches. For instance, the SAP® HANA development project retains statistics on more than 30 billion test runs. The corresponding test result database groups related test cases (e.g., TPC-H benchmark queries) into test profiles. Therefore, the statement “SELECT status FROM test cases WHERE id_test_profile=:1” returns the status (e.g., running, successfully executed, or failed) of all test cases with the given test profile ID.
Using the backward-looking approach 110, a table partitioning advisor proposes layout Lobs 113 that groups frequently accessed records into hot partition P2 and all other records into cold partition P1. In contrast,
Thus, the goal of some embodiments may be to find a predicted workload from an observed workload , such that the predicted workload approximates the future workload . There may be several challenges, however, when trying to predict the future workload based on the observed workload . In real-world applications, various workload drift types (e.g., linear, exponential, reoccurring, static, and irregular) have been identified. Moreover, these drift types can also overlap. For an individual statement, the arrival rate as well as the assignments of parameter values to host variables can be impacted by different drift types. Therefore, a workload predictor must be able to handle multiple drift types (and at least some combinations thereof) at the arrival rate and assignment level.
Moreover, many real-world applications are characterized by a continuously drifting workload, thus necessitating regular readjustments of the physical layout. However, the data reorganization (e.g., table repartitioning) incurred by changing the physical layout can be prohibitively costly. Therefore, a change in the physical layout might only be advised when the expected benefits of workload cost reductions outweigh the cost of data reorganization.
To address these challenges, some embodiments described herein provide a system 200 that consists of two phases as illustrated in
As used herein, devices, including those associated with the system 300 and any other device described herein, may exchange information via any communication network which may be one or more of a Local Area Network (“LAN”), a Metropolitan Area Network (“MAN”), a Wide Area Network (“WAN”), a proprietary network, a Public Switched Telephone Network (“PSTN”), a Wireless Application Protocol (“WAP”) network, a Bluetooth network, a wireless LAN network, and/or an Internet Protocol (“IP”) network such as the Internet, an intranet, or an extranet. Note that any devices described herein may communicate via one or more such communication networks.
The workload prediction framework 310 and physical database design advisor 350 may store information into and/or retrieve information from various data stores (e.g., various predictions or recommendation), which may be locally stored or reside remote from the workload prediction framework 310 and/or physical database design advisor 350. Although a single workload prediction framework 310 and physical database design advisor 350 are shown in
An administrator may access the system 300 via a remote device (e.g., a Personal Computer (“PC”), tablet, or smartphone) to view information about and/or manage operational information in accordance with any of the embodiments described herein. In some cases, an interactive Graphical User Interface (“GUI”) display may let an operator or administrator define and/or adjust certain parameters via the remote device (e.g., to adjust prediction rules or logic, alter φlin and/or φexp, map elements to data sources, etc.) and/or provide or receive automatically generated recommendations, results, or alerts associated with the system 300.
At S410, a computer processor of a workload prediction framework may receive observed workload information associated with a database (e.g., a DBaaS), such as one implemented in a cloud computing environment. Based on the observed workload information, the system may generate a SAR prediction at S420. Based on the observed workload information, the system may also generate a host variable assignment prediction at S430. At S440, the system can then automatically create a workload prediction for the database using the SAR prediction and the host variable assignment prediction. Responsive to the workload prediction and a current physical layout, at S450 a physical database design advisor automatically generates a recommended physical layout for the database.
To discuss the problem of predicting a future workload based on an observed workload, notation as set forth in Table I will be utilized.
= {q1, . . . , qi, . . . , qn}
( , hij)
={q1, . . . , qi, . . . , qn} may be defined as a set of n∈ parameterized SQL statements (e.g., SELECT, INSERT, UPDATE, and DELETE statements). Each statement qi∈ contains a vector hi=[hi1, . . . , hij, . . . , him
(,hij):={(t,vij)|(t,qi,vi)∈,vij is assigned to hij}.
Let os, oe, fs, fe∈ be four timestamps, such that os<oe≤fs<fe. Define an observed workload as , such that ∀(t, qi, vi)∈: os≤t<oe, and a future workload as , such that ∀(t, qi, vi)∈: fs≤t<fe. Some embodiments described herein find a predicted workload from an observed workload , where ∀(t, qi, vi)∈: fs≤t<fe, such that the predicted workload approximates the future workload .
For each statement qi∈, the future workload is predicted in two independent stages. In stage I, SAR detection 521, SAR classification 522, and SAR prediction 523 are used to predict the statement arrival rate. In stage II, host variable assignment detection 531, host variable assignment classification 532, and host variable assignment prediction 533 are used to predict the future assignments of parameter values to host variables. The predicted workload can then be obtained by combining the results of both stages. The advisor 550 uses this information along with information about a current physical layout to propose the future physical layout Lfut with the smallest combined workload and data reorganization costs based on the predicted workload and the current physical layout Lcur. According to some embodiments, the workload prediction framework 510 and advisor 550 periodically repeat these steps to adopt the physical layout in small and cheap adjustments.
As before consists of a workload prediction framework 610 and a physical database design advisor 650. The workload prediction framework 610 predicts the future workload associated with SQL statements based on the observed workload . For each statement qi∈, the future workload is predicted based on a SAR prediction and a host variable assignment prediction. The SAR prediction utilizes SAR detection 621, SAR classification 622 (e.g., via classifier α), and SAR prediction 623 (e.g., via predictors α1 through α2). The future assignments of parameter values to host variables utilizes host variable assignment detection 631, host variable assignment classification 632 (e.g., via classifier β) and host variable assignment prediction 633 (e.g., via predictors β1 through β2). The predicted workload can then be obtained by combining the results of the SAR and host variable assignment predictions. The advisor 650 uses along with information about the current physical layout Lcur to propose the future physical layout Lfut with the smallest combined workload and data reorganization costs. According to some embodiments, the workload prediction framework 610 and advisor 650 periodically repeat these steps to adopt the physical layout.
Note that workloads can vary over time in various different ways. For example, a real-world application workload might drift in a linear, exponential, reoccurring, static, or irregular fashion.
A linear or exponential workload drift is characterized by a linearly or exponentially increasing (or decreasing) arrival rate of statements, respectively parameter values assigned to host variables. For example, the parameter values of the domain of id_test_profile might grow linearly over time (e.g., as shown by the observed workload 111 in
Since databases often interact with humans, workloads may follow reoccurring patterns. For example, to test a specific build, a test environment, called “install session,” might be created on a dedicated test server using the SQL statement “INSERT INTO install_sessions (id_make, id_server) VALUES (:1, :2)”.
A static workload is a workload where no temporal drift can be observed. For example, the dimension table test_case_info represents existing tests (e.g., their SQL string), and statement “SELECT id FROM test cases WHERE id_test_case_info=:1” returns all test case executions with the given test case ID from the fact table test_cases.
An irregular workload drift is characterized by an abrupt and unexpected change of the statement arrival rate or the parameter values. For example, occasional stress test campaigns, in addition to regular testing, can lead to an irregular drift of the statement arrival rate. Unlike other drift types, irregular workload drifts can neither be modeled nor predicted. Nonetheless, some embodiments described herein may handle irregular workload drifts.
Δ(os, oe) may be defined as a set of equidistant timestamps between the start and end timestamps os, oe∈:
Δ(os,oe):={os+λ·δ|λ∈,os≤os+λ·δ<oe}.
To calculate the observed statement arrival frequency, all statement instantiations in the observed workload that fall within interval [t, t+δ) may be aggregated for a timestamp t ∈Δ(os, oe). The observed statement arrival frequency F(t, , qi) at timestamp t∈Δ(os, oe) for statement qi∈ in the observed workload may be defined as:
F(t,,qi):=|{(t′,q′i,v′i)|q′i{circumflex over ( )}t≤t′<t+δ}|.
Finally, the observed statement arrival rate may be defined as a series of consecutive statement arrival frequencies between the start and end timestamps os, oe∈N in the observed workload . The observed statement arrival rate (observed SAR) for statement qi∈ in the observed workload maybe defined as:
SAR(,qi):={(t,F(t,,qi))|t∈Δ(os,oe)}.
Referring again to
SAR(,qi) is linear⇔|ρ(SAR(,qi))|≥φlin.
To detect exponential workload drifts, embodiments may take advantage of the fact that a function grows exponentially if its logarithm grows linearly. Therefore, the condition is satisfied if the Pearson correlation coefficient ρ between the series of discrete timestamps and the series of the logarithm of each statement arrival frequency is greater or equal than a threshold φexp∈[0, 1] (note that the logarithm is only applied on the series of statement arrival frequencies F(t, , qi) in SAR(,qi) and not on the series of discrete timestamps):
SAR(,qi) is exponential⇔|ρ(log(SAR(,qi)))|φexp.
To detect a reoccurring workload drift, embodiments may first compute the Discrete Fourier Transform (“DFT”), i.e., convert the observed SAR from the time domain into the frequency domain. Afterwards, the system may evaluate whether a sinusoid with an amplitude greater or equal than a threshold θ(, qi) is present in the DFT. To specify the threshold θ(, qi), embodiments may first determine the smallest and largest observed statement arrival frequencies lbi and ubi of statement qi in the observed workload. Given a fixed φcyc∈[0,1], the threshold θ(, qi) is obtained as φcyc times the largest possible amplitude range but at least φcyc times the smallest statement arrival frequency.
ub
i:=maxt∈Δ(o
lb
i:=mint∈Δ(o
θ(,qi):=φcyc·max(ubi−lbi,lbi)
SAR(,qi) is reoccurring⇔∃z∈DFT(SAR(,qi)):|z|≥θ(,qi).
In order to identify static workloads, embodiments may examine whether the observed SAR is stable, i.e., it fluctuates only within narrow limits around the mean statement arrival frequency μi. Given a fixed φstatic∈[0,1], the condition is satisfied if Root Mean Square Error (“RMSE”) between the observed statement arrival frequencies and ui is less than or equal to φstatic times μi:
Since irregular workload drifts are, by definition, abrupt and unexpected, a traditional condition might not be useful to handle these types of drifts. According to some embodiments, a workload is classified as irregular if none of the above conditions for linear, exponential, reoccurring, or static drifts are met. Note that embodiments described herein are extensible such that other conditions could be plugged in to detect an irregular drift.
To demonstrate how workload drifts can be detected using the above conditions,
Referring again to
If exactly one drift type is detected, the classifier 1200 decides that the observed SAR is the detected drift type. If two or more drift types are detected, the classifier distinguishes compatible and incompatible drift combinations. According to some embodiments, the combination of linear and reoccurring is considered compatible (e.g.,
Table II shows classification outcomes and the predicted statement arrival frequencies at future discrete timestamps t∈Δ(fs, fe) for the six SQL statements shown in
Referring again to
Referring again to
UNCERTAIN if os≤t<os+k·δ
REGULAR else if ∀{circumflex over (t)}∈[os,oe−k·δ)∃(t′,vij)∈(,hij):{circumflex over (t)}≤t′<{circumflex over (t)}+k·δ
FRESH else if (t′,vij)∈(,hij):t−k·δ≤t′<t
SUBSEQUENT else.
Assignments, where the same parameter value is assigned to the same host variable at least once every k·δ time units, are independent of the time and thus part of the static workload. Such assignments are classified as regular. For example, in
At S1320, the system predicts the future fresh assignments and models the distribution of subsequent and regular assignments. For fresh assignments, the system may extrapolate the series of fresh assignments in the observed workload into the future and thereby predict the series of future fresh assignments. For example,
The observed series of Fresh Assignments (observed “SFA”) of host variable hij in the observed workload may be defined as the set of all fresh assignments in (, hij):
SFA(,hij):={t,vij)|(t,vij)∈(,hij),(t,vij) is fresh}.
As before, the system may detect which drift types are present in the observed SFA and then use a classifier (such as the one in
The system may model the distribution of subsequent assignments of parameter values in relation to their corresponding fresh assignments. This model can then be used to predict future subsequent assignments in relation to their predicted fresh assignments. To do this, first formalize the time difference between a subsequent assignment and its corresponding fresh assignment as the temporal offset between the two. Let sub(, hij) be the set of subsequent assignments to host variable hij in the observed workload . The time difference τ(t, vij) between a subsequent assignment (t, vij)∈sub and its corresponding fresh assignment is defined as:
τ(t,vij)=min({t−t′|t′,vij)∈(,hij),(t′,vij) is fresh,t′<t}).
Note that for the same parameter value, more than one fresh assignment can exist. This may happen, for example, with a reoccurring drift. To handle such ambiguities, some embodiments only consider the temporal offset to the most recent corresponding fresh assignment.
Another special case is when no fresh assignment exists for a subsequent assignment because the fresh assignment occurred at the beginning of the observed workload and was classified as uncertain. For example, in
A probability mass function may be built that models the probability of time differences between a subsequent assignment and its corresponding fresh assignment. Some embodiments model the time difference in terms of time intervals I(λ)=[λ·δ, (λ+1)·δ), λ∈. Some embodiments use δ as the interval length only for the pragmatic reason that the observed workload has been discretized in steps of length 6. According to some embodiments, a probability mass function psub is defined as the probability that the time difference τ(t, vij) between a subsequent assignment of parameter value vij to host variable hij and its corresponding fresh assignment falls into interval I(λ):
Finally, some embodiments may model the distribution of regular assignments in terms of a probability mass function. Using such a model, the system can then predict future regular assignments. Let reg be the set of regular assignments to host variable hij in the observed workload . Define a probability mass function preg as the probability of a regular assignment of parameter value vij to host variable hij:
The prediction is based on the following two assumptions: first, regular assignments to a host variable in the observed workload will continue in the future workload; and second, regular assignments are uniformly distributed. To motivate both assumptions, consider
Table III contains an algorithm that can be used to compute a predicted workload . The algorithm expects as input for each SQL statement qi∈ the predicted statement arrival rate SAR(, qi), and for each host variable hij in statement qi the predicted series of fresh assignments SFA(hij) and the probability mass functions psub(hij, λ) and preg(hij,vij).
:= { } // initialize the predicted workload
The algorithm first initializes as an empty set (line 1). Next, the algorithm iterates over all SQL statements qi∈(line 2) and all future equidistant timestamps t∈Δ(fs, fe) (line 3). The system then derives the number of statement instantiations F(t, , qi) to be predicted in the current interval [t, t+δ) from the predicted SAR, where SAR(, qi) [t] denotes the statement arrival frequency at timestamp t (line 4). For each statement instantiation to predict, the algorithm draws a random timestamp trand uniformly from [t, t+δ) (lines 5 and 6) and allocates a vector vi with a capacity of mi parameter values (line 7). Finally, the system iterates over all host variables hij to predict their assignment by parameter values vij (lines 8 to 20) and adds the predicted statement instantiation (trand, qi, vi) to the predicted workload (line 21).
Some embodiments assume that the distribution of fresh, subsequent, and regular assignments in the observed and future workloads are identical. Therefore, to predict the future parameter value vij of a host variable hij at timestamp trand, the system may first draw an assignment category fresh, subsequent, or regular with the same probabilities as they occur in (,hij) (line 9). For example, the probability of generating a subsequent assignment is |sub(, hij)|/(|(,hij)|−unc|(, hij)|), where sub (resp. unc) denotes the set of subsequent (resp. uncertain) assignments to host variable hij in .
The prediction of parameter value vij of host variable hij at timestamp trand depends on which assignment category is drawn:
The second phase of the framework feeds the predicted workload into a physical database design advisor (e.g., a table partitioning advisor). According to some embodiments, a table partitioning advisor for column stores to minimize main memory costs in $ while meeting all performance guarantees assured in Service-Level Agreements (“SLAs”). Although $ is used herein as an example, note that embodiments may be associated with any other currency or representation of monetary costs. As the amount of provisioned DRAM dominates hardware costs, this is in particular crucial for DBaaS providers. The advisor may group frequently accessed data into hot column partitions that remain in main memory, and rarely accessed data into cold column partitions that can be moved to cheaper storage layers.
Given (i) the maximum execution time SLA(W) of a workload W in seconds as a performance SLA, (ii) the number of accesses f(C,W) by workload W to column partition C, and (iii) the π-second rule (which accounts for prices, capacities, and performance of recent DRAM and disk) that expresses the economical break-even point between storing data in DRAM versus performing disk IO on each access, a column partition C is classified as hot if it is accessed more frequently than every it-seconds:
The classification of a column partition C determines its cost. Cold-classified column partitions can be pruned during the evaluation of the selection predicate (e.g., as described with respect to
According to some embodiments, the physical layout is changed only if the expected benefits of workload cost savings outweigh the costs of data reorganization, a cost model may include table repartitioning costs. A straightforward approach would be to calculate repartitioning costs globally, i.e., at the level of the entire physical layout. However, if an enumeration algorithm operates at the level of column partitions, the system may compute the repartitioning costs per column partition. Further embodiments may model repartitioning costs in $ to be able to compare them to workload costs.
If a column partition C∈Lfut, enumerated in the future layout Lfut, already exists in the current layout Lcur, the repartitioning cost may be set to $0. Otherwise, C is created by splitting or merging partitions in Lcur. In this case, some assumptions might be made:
Based on these assumptions, the repartitioning costs will first be defined and then the system will combine the workload and repartitioning costs into the total cost in $ of a column partition C∈Lfut:
As a second modification, an objective function may be modified. Contrary to some systems, which minimize the workload costs workload of the observed workload , some embodiments propose the future layout Lfut that minimizes the combined workload and repartitioning costs total of the predicted workload P.
A natural question that arises during the optimization of this equation: At which timestamp in the future is a repartitioning beneficial? In general, repartitioning costs can be seen as a mortgage that needs to be amortized by the benefit in terms of workload costs in a future layout. The longer the duration of the predicted workload (i.e., fe−fs), the more likely the repartitioning costs are amortized. On the contrary, the longer the prediction, the less accurate the prediction becomes. To resolve this conflict, some embodiments calculate the duration of the predicted workload as a prediction confidence factor η∈ times the observation period ω∈(i.e., oe−os).
o
s:=current timestamp
o
e
:=o
s+ω
f
s
:=o
e
f
e
:=f
s+η·ω.
For the integration of the advisor into the prediction framework, assume a fixed observation period ω∈ and a fixed prediction confidence factor η∈ as prerequisites. Also initialize the start timestamp of the observed workload os as the current timestamp and the layout Lcur as the current layout. The system can then start the first iteration of the framework by computing the end timestamp of the observed workload oe as os+ω and waiting until that time. Using the algorithm of Table III, the system next calculates the predicted workload between start timestamp fs set to oe and end timestamp fe set to fs+ω based on the observed workload between timestamps os and oe. Afterwards, the predicted workload and the current layout Lcur can be fed into the physical database design advisor and the system may switch to the proposed future layout Lfut. Note that the current layout could also be considered as the best alternative. Finally, we increment os by η·ω and start the next iteration of the framework.
During testing, a workload during a regular workday between 08:00 and 20:00 was used. During this period, 401, 280, 169 SQL statements were executed. An observation period co was set to 360 minutes and the prediction confidence factor ij was set to 1.0. Further, a discretization interval δ of 5 minutes was used and the parameters for detecting linear and exponential drifts φlin, and φexp were set to 0.8 each. To detect reoccurring drifts and static workloads, set φcyc and φstatic to 0.1 each. Both parameters represent a maximal allowed fluctuation (and fluctuations smaller than 10% may be imperceptible). Finally, Rrate was set to 133 MB/sec and Rovrhd to 0.16 seconds using an q-error approximation.
The backward-looking approach used by most existing work was used as a baseline, where the observed workload instead of the predicted workload is fed into an advisor. To demonstrate the potential of embodiments described herein, a best-case analysis was performed where the actual future workload is fed into the system. For all approaches, the layout is only changed if the expected benefits of workload cost savings outweigh the costs of table repartitioning.
A memory costs and performance experiment analyzed how the partitioning layouts proposed by embodiments described herein and a backward-looking approach alter the relation between memory costs and workload performance. As hardware costs are dominated by DRAM costs, one may focus on the memory consumption. It was observed that embodiments described herein always outperform a backward-looking approach in terms of performance. For example, with enough available memory (i.e., high memory costs), the proposed framework can improve execution time by 1.4 compared to a backward-looking approach. The main reason for the observed performance improvements and memory cost savings is a sharper separation of frequently and rarely accessed data into hot and cold partitions as compared to the backward-looking approach. This avoids polluting the buffer cache with cold data, allows for more aggressive partition pruning, and speeds up delta merges.
A second experiment evaluated how accurately embodiments predict the future workload. For this, predictions of both the statement arrival rate and the assignment of parameter values to host variables were considered. As a measure how well the observed and predicted statement arrival rate, respectively observed and predicted assignments, match the future statement arrival rate, respectively future assignments, one may use the coefficient of determination R2∈(−∞, 1]. An R2 score of 1 indicates a perfect prediction, while especially negative values, which are unbounded, represent inaccurate predictions.
For the ten most expensive statements in the SQL plan cache, the R2 score for assignments of the predicted workload have a substantially higher R2 score compared to the observed workload. In addition, the R2 score of the assignments of the predicted workload is frequently close to 1.
A third experiment analyzed the impact of the observation period co and the prediction confidence factor η on the prediction accuracy. The R2 score for statement 176 for co between 60 and 570 minutes were calculated for η between 0.1 and 8.0. In general, it was observed that longer observation periods lead to higher R2 scores. Further, the longer the predicted period, i.e., the larger η is, the less accurate predictions become. The poor accuracy resulting from η larger than 1 is expected as it is no longer possible to detect reoccurring drifts with a period longer than the observation period. The choice of ω set to 360 minutes and η set to 1.0 leads both to accurate predictions and to an amortization of the repartitioning costs due to the long prediction period.
A fourth experiment evaluated how precisely the modified version of advisor estimates table repartitioning costs. For this purpose, 363 random partitioning layouts for different SQL database tables were generated and then randomly split and merged existing partitions in those layouts. For each considered table repartitioning, Rrate was set to 133 MB/sec and Rovrhd was set to 0.16 sec as repartitioning costs were measured. There was a strong correlation between the estimated and actual repartitioning costs and the maximum q-error was 2.27.
A fifth and final experiment analyzed the time required by the framework to predict the future workload for observation periods co between 60 and 360 minutes and η was set to 1.0. The required prediction time ranges between only 1.2% and 3.2% of the observation period. Since the advisor also has a low optimization time, one can conclude that that framework is suitable for practical usage.
Note that the embodiments described herein may be implemented using any number of different hardware configurations. For example,
The processor 1910 also communicates with a storage device 1930. The storage device 1930 may comprise any appropriate information storage device, including combinations of magnetic storage devices (e.g., a hard disk drive), optical storage devices, mobile telephones, and/or semiconductor memory devices. The storage device 1930 stores a program 1912 and/or workload prediction framework engine 1914 for controlling the processor 1910. The processor 1910 performs instructions of the programs 1912, 1914, and thereby operates in accordance with any of the embodiments described herein. For example, the processor 1910 may be associated with a cloud computing environment and receive observed workload information. Based on the observed workload information, a SAR prediction may be generated by the processor 1910. In addition, a host variable assignment prediction may be generated by the processor 1910 based on the observed workload information. The processor 1910 may then use the SAR prediction and the host variable assignment prediction to automatically create a workload prediction for the database. A physical database design advisor (e.g., a table partitioning advisor) may receive the workload prediction and, responsive to the workload prediction, automatically generate a recommended physical layout for the database (e.g., using a cost model, the current physical layout, and an objective function).
The programs 1912, 1914 may be stored in a compressed, uncompiled and/or encrypted format. The programs 1912, 1914 may furthermore include other program elements, such as an operating system, clipboard application, a database management system, and/or device drivers used by the processor 1910 to interface with peripheral devices.
As used herein, information may be “received” by or “transmitted” to, for example: (i) the platform 1900 from another device; or (ii) a software application or module within the platform 1900 from another software application, module, or any other source.
In some embodiments (such as the one shown in
Referring to
The database identifier 2002 might be a unique alphanumeric label that is associated with an SQL database to be analyzed and/or optimized. The observed workload identifier 2004 may be a file associated with a substantial number of historic statements. The SAR prediction data 2006 and host variable assignment prediction data 2008 may be automatically generates by any of the embodiments described herein (e.g., based on the observed workload). The workload prediction 2010 may be created by combining the SAR prediction data 2006 and host variable assignment prediction data 2008. The recommended physical layout for a database may be generated by an advisor based on the workload prediction and the current physical layout (e.g., an advisor associated with table partitioning, data compression, buffer pool size, another advisor that is based on access counters of a workload, etc.).
Thus, embodiments may provide accurate and efficient workload predictions which can serve as an input to a physical database design advisor (e.g., in a cloud computing environment). The following illustrates various additional embodiments of the invention. These do not constitute a definition of all possible embodiments, and those skilled in the art will understand that the present invention is applicable to many other embodiments. Further, although the following embodiments are briefly described for clarity, those skilled in the art will understand how to make any changes, if necessary, to the above-described apparatus and methods to accommodate these and other embodiments and applications.
Although specific hardware and data configurations have been described herein, note that any number of other configurations may be provided in accordance with some embodiments of the present invention (e.g., some of the information associated with the databases described herein may be combined or stored in external systems). Moreover, although some embodiments are focused on particular types of statements and advisors, etc., any of the embodiments described herein could be applied to other types of statements and advisors. Moreover, the displays shown herein are provided only as examples, and any other type of user interface could be implemented. For example,
The present invention has been described in terms of several embodiments solely for the purpose of illustration. Persons skilled in the art will recognize from this description that the invention is not limited to the embodiments described but may be practiced with modifications and alterations limited only by the spirit and scope of the appended claims.
Number | Date | Country | |
---|---|---|---|
Parent | 17705728 | Mar 2022 | US |
Child | 18462513 | US |