The present invention relates to Workflow Management Systems (WfMSs) and Human Task Management Systems (HTMSs), and more particularly to providing results for queries to workflow and task data.
Workflow Management Systems (WfMSs) and Human Task Management Systems (HTMSs) support the integration of human beings into business processes. Humans interact with these systems in different ways. The most common way a user accesses work items or human tasks managed by such a system is by retrieving his or her task lists and selecting (or checking out) the tasks he or she is planning to work with at a given point in time. As tasks are often assigned to more than one person, it is important that the system keeps track of who works on which task, and particularly, which tasks are waiting for someone to start working on them.
Most implementations of these systems use database technology to internally represent these tasks. Database management systems (DBMS) store extensive amounts of organized information for access by users of the systems. In a database system environment, the system responds to specific queries from the user as to which data from the database to examine, retrieve and/or present. Typically, the Workflow Management Systems (WfMSs) and Human Task Management Systems (HTMSs) run queries on behalf of a user in a particular syntax of a particular database language that is used by the system, such as the Structured Query Language (SQL) format.
Database queries are triggered by users and executed by the database system to retrieve task lists. Transactional database operations are used to “check out” a task for exclusive use by a user, and later to “check in” the same task after work on it has been finished.
Modern systems use a normalized database schema in order to keep costs low for create, retrieve, update, and delete operations (CRUD operations) of a database. In large systems with many thousands of users and hundreds of thousands of active tasks, the time to retrieve a list of tasks from the system may become an issue when using the standard database query approach. As a consequence, the costs in the database to carry out task list queries become huge, since complex database processing is required to present the entirety of data to users. In large applications, the time to retrieve even a short task list may be many seconds.
One way to mitigate this problem is to cache task lists on the client. The disadvantage of this approach is the amount of memory required on the client for caching the data, the complex programming model for the client which has to manage the cache, and the relative lack of timeliness of the data. Another way is to cache task lists on the Workflow Management Systems (WfMSs) or Human Task Management Systems (HTMSs), usually running on a middle tier application server. However, here the memory consumption problem is even more severe, as task lists are different for each user and therefore have to be cached for each user individually. Maintaining cache content is difficult and complicates the implementation of the Workflow Management Systems (WfMSs) and the Human Task Management Systems (HTMSs). WfMSs and HTMSs that run on a cluster are even more severely impacted, as the more members of the cluster are present, the more processing must be performed in order to keep cache contents consistent across the various cluster members.
Accordingly, what is needed is the ability to utilize advanced database technologies together with an intelligent data access mechanism to cache task lists on a database server and allow reduced time in retrieving tasks. The present invention addresses such a need.
The invention of the present application relates to providing results for task list queries to Workflow Management Systems (WfMSs) and Human Task Management Systems (HTMSs). In one aspect of the invention, a method for providing the result of a task list query to a human task database includes caching data from the database in a plurality of materialized views, each materialized view including data resulting from a query based on a request for a list of tasks from the database. For subsequent task list queries it is determined if the new request applies to the data in a particular one of the materialized views. After receiving the new request and before executing the new query, it is determined whether the particular materialized views includes data that requires updating from more recent data in the database. When updating is required, the particular materialized view is updated with more recent data from the database. The new query is executed against the data in the particular materialized view instead of executing the new query against the data stored in tables in the database.
The present invention allows a programming model neutral approach to utilize advanced database technologies together with an intelligent data access mechanism to speed up task list retrieval by caching task lists on the database server. The invention uses multiple materialized views to buffer task list data and thereby optimize database query performance and minimize load on the database server. Intelligent task list query rewriting can be used to further improve the presented approach. Using the invention, the average time to retrieve a task list can be reduced significantly.
The present invention relates to Workflow Management Systems (WfMSs) and Human Task Management Systems (HTMSs), and more particularly to providing results for task list queries to these systems. The following description is presented to enable one of ordinary skill in the art to make and use the invention and is provided in the context of a patent application and its requirements. Various modifications to the preferred embodiment and the generic principles and features described herein will be readily apparent to those skilled in the art. Thus, the present invention is not intended to be limited to the embodiment shown but is to be accorded the widest scope consistent with the principles and features described herein.
The present invention is mainly described in terms of particular systems provided in particular implementations. However, one of ordinary skill in the art will readily recognize that this method and system will operate effectively in other implementations. For example, the system implementations usable with the present invention can take a number of different forms. The present invention will also be described in the context of particular methods having certain steps. However, the method and system operate effectively for other methods having different and/or additional steps not inconsistent with the present invention.
The invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment containing both hardware and software elements. A software embodiment can include but is not limited to firmware, resident software, microcode, etc. Furthermore, the invention can take the form of program instructions or code stored by a computer-readable medium for use by or in connection with a computer or any instruction execution system. The medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk (e.g., CD-ROM, DVD, etc.).
To more particularly describe the features of the present invention, please refer to
This disclosure describes a programming model neutral approach to utilize advanced database technologies together with an intelligent data access mechanism to cache task lists on the database server. In some embodiments, the invention combines the use of materialized views or materialized query tables with intelligent task list query rewriting and multiple-view buffering to optimize database query performance and to minimize load on the database server. Applying this solution, the average time to retrieve a task list can be reduced significantly. For example, the task list retrieval time can be reduced from many seconds in a prior implementation to a few milliseconds using the present invention.
The described embodiment combines the use of multiple technologies and mechanisms. Materialized views are used to cache the result of complex and expensive task queries. Task queries are parsed, analyzed for match with a materialized view, and rewritten to use a materialized table view, if applicable. A mechanism is established to refresh the materialized views in a customizable way. Background queries are used to refresh materialized view content in the background, minimizing response time for all task list retrieval operations.
Using Materialized Views for Task List Queries
Views can generally be considered as a declarative abstraction to a structured data set. A view is a virtual or logical table dynamically composed of the result set of a query, computed from data in the database. A view is not part of the physical storage of the database data (base tables). Changing the data in the database from which the view is derived alters the data shown in the view. Views also can join multiple data sources into a single virtual table, and thus offer simplified access to multiple underlying database tables, for example. The view implementation processes requests by translating a query into sub-queries for the referenced data source and combining the results effectively. A view definition typically contains additional filter criteria that further restrict the represented data set.
Materialized views differ from standard views in that the data represented by a view definition is physically stored (“materialized”), thereby avoiding the potential high cost of data retrieval and combination of the referenced data sources. Requests against a materialized view no longer access the underlying data (base tables) but can be efficiently processed against the physically stored (“materialized”) data. If the underlying data (from which the materialized view was composed) changes, the present invention provides update mechanisms that asynchronously (e.g. timer based) or synchronously update the materialized views. This ensures that changes to data are reflected in the materialized representation as well.
In a typical Human Workflow or Human Task application scenario, a client 12 issues a request to a WFMS or HTMS for retrieving a list of tasks. This is shown as “getTaskList( . . . )” in
The WFMS or HTMS offers an API that allows clients to retrieve their task list. The WFMS/HTMS 14 uses the data in the request from the client 12 and the knowledge about who has issued the request to generate a query on tables 18 in the human task database 16. Depending on the requested information, the generated query may include a large number of database tables. The query is issued against the database system and the list of tasks with the selected properties is retrieved and returned to the client.
One or more clients 102 can be any suitable computer system, electronic device, or program that can issue requests to the other components of the system, via a communication link such as a bus, network link, or wireless link. The management system 104 and human task database 106 can be implemented on the same computer system or different systems, e.g., different servers connected via a network or other communication link. The computer systems include standard components, such as processors (CPUs), storage devices (hard disk, magnetic tape, optical disk, etc.), I/O components, etc.
A client 102 sends a request 108 for a task list to the management system 104, shown as “getTaskList( . . . )”. The management system 104 offers an API that allows clients to specify the retrieval of their task lists. Before generating the query for the database 106, the management system 104 analyzes the request of the client 102 in a step 120. A mapping definition is used to find a suitable materialized view that can be used to return the desired query results. Mapping definitions (mappings) to materialized views describe which requests can be routed to a materialized view returning the same result as a comparable query to the underlying base tables. There is a strong relationship between the mappings to a materialized view and the definition of that materialized view. Ordering criterion, selection predicates and selection criterion are taken into account to make sure that the expected query result set for the request is a subset of the data contained in the materialized view, and thus the materialized view is applicable.
If no suitable materialized view for the request is found in step 120, then the procedure continues to step 122, where the query is generated and executed as if no materialized views were defined. For example, task data 110 from the database 106 is retrieved and regular views and tables used to provide the query results. If a suitable materialized view is found in step 120, then in step 124 the query is generated in a way such that a materialized view 130 stored in database 106 (or other storage) is involved, instead of the regular database tables and views 110.
Queries against materialized views 130 are less expensive in terms of processing and time than queries against the original tables or views. For example, materialized views contain all or part of the data of a view, therefore less calculation is needed to retrieve the data from the underlying tables. Populating a materialized view with data based on a query A is similarly expensive as issuing query A against the original tables. Additional costs may be involved as the result is made persistent.
The management system 104 takes care of refreshing the materialized views 130. Two specific materialized views 134 and 136 are created for each materialized view definition. The management system 104 manages the materialized views so that one of the materialized views 134 or 136 always includes current data and can be used to service requests from clients, while the other materialized view 134 or 136 is updated in the background. The materialized view 134 or 136 with the “X” mark shown in
The method starts at 202, and in step 204, a request is issued from the client for retrieving a task list, i.e., a task list retrieval operation is issued. In step 206, the system checks if a matching materialized view 130 exists, which can be used to run the task list query against. The check is performed by analyzing the query parameters and by matching them with criteria defined when creating the materialized view definition. If no matching materialized view is found, then in step 208 a standard query is provided which uses regular views and/or tables, and in step 210 the query is executed. The method is then complete at 212.
If a matching materialized view has been found in step 206 by analyzing the query and comparing it with the materialized view mapping definitions as explained above, then this materialized view is used. In step 214, the currency of the data in the materialized view table is checked. To avoid periodic updates even in situations where a materialized view is not used, updates are triggered by incoming task list queries in the present invention. In an alternate embodiment of the invention, the updates can be performed using a daemon running in the background of the system that refreshes the materialized view content periodically in the background. While this imay be easier to implement, it produces an undesirable base load on the system, even when there are no incoming client requests. It also offers less control than the other mechanism described herein.
Before executing a query on a materialized view the system checks if an update of the materialized view table has to be triggered. This is done using predetermined configuration parameters for each materialized view table, which for example can be set by the system administrator based on the business knowledge of the system and on data gathered during the operation of the system. An example for such a configuration parameter is a maximum age of the data (max_age) in the materialized view table. Other parameters can include the maximum number of changes performed on the database tables used when retrieving the data for a particular materialized view.
Task systems with very many concurrent users and a short work time per task need more frequent refreshes than systems with fewer users or longer task processing times. The system provides a max_age configuration parameter and utilizes it to decide if updates for a materialized view are required, based on the age of the data in the materialized view tables. The system decides against updating when the age of the data is less than or equal to the max_age configuration parameter, and decides to update if the age of the data is greater than the max_age configuration parameter. If no updates are required, then the method continues to step 216 to create a query using the materialized views. In step 210, the created query is then executed to provide the task lists requested by the client. The process is thus complete at 212.
If an update is required in step 214, e.g. because the data in the table is too old, then in step 218 the system determines if the data in both views 134 and 136 (tables) of the materialized view 130 is outdated or not appropriate to be used by applying the same decision as in 214. If just one table contains outdated data, then in step 220 an update of the outdated materialized view table is triggered in the background (this is considered the background materialized view table), and the data in the other (foreground) materialized view table is used for the query. This is called a non-blocking update, as the query can be executed immediately and data can be returned without having the client or user wait for all materialized view tables to be refreshed. The method then continues to step 224, described below.
If the data in both the foreground materialized view table and the background materialized view table are outdated, or no data exists in the materialized view tables, then the query cannot be executed before updates are made. The client must wait until current data becomes available. In this case the method proceeds from step 218 to step 222, in which a blocking update is performed, which is an update where the user has to wait for the materialized view table to be refreshed. For example, the background table can be updated with the current data from the database, as explained above. In an alternate embodiment, the foreground table also can be updated in step 222.
A blocking update is required, for example, when the first user issues a query at the beginning of the work day when there have not yet been any materialized views previously created. The blocking update may be required also for the first query that uses a particular materialized view. In such cases a blocking update of the materialized view table is performed before the client query is run.
After a successful update (blocking or non-blocking) is carried out in step 220 or 222, step 224 is performed in which the foreground and background tables of the materialized view are switched. This ensures that after the updates, queries that are performed access the most current data.
The query is created using the materialized views in step 216, and in step 210 the query is executed using data in the materialized view and the result is returned to the requester (client 102). In the case of a non-blocking update of step 220, steps 216 and 210 can be performed immediately, without waiting for the background table to be updated in step 220 and switched in step 224. In the case of a blocking update of step 222, steps 216 and 210 are performed after the update and switch are complete. The process is then complete at 212.
As indicated in
Applying Incremental Update Functionality to Materialized Views
The implication of the approach described above is that data in the materialized views does not reflect changes that have been made to the underlying tables after the materialized view results have been stored. Strictly speaking, data in the materialized views may not always be consistent with the data in the base tables. This can be mitigated if changes to the base tables are tracked in a modification list, and these changes are then considered when the materialized view is queried (“Change Tracking”). Consideration of tracked changes produces additional load on the database server, therefore change tracking should only be applied to changes that are of most interest (“Scoping”).
The procedure for performing Change Tracking is as follows. If the management system 104 makes changes to table rows that are queried by materialized views, an entry (key) with a timestamp is added to a modification list. The row(s) of interest are contained in the set of the rows in the materialized view that are identified by this key. This implies that all changes to the data used by the management system 104 are managed solely through the management system. Furthermore, each row in the materialized view must contain the keys of the rows that influence the contents of this particular row.
If a query is routed to a materialized view with modification list, the query is rewritten. Let Q_MV be the query that is executed against the materialized view in case that no modification list is used, and Q_OT be the original query that is executed against the base tables if there were no materialized views defined. Also let A be the condition that the key of a tracked change is contained in a row of the materialized view; let R(query, c) be the result of the query where all results satisfy the condition c; and let D(R(query, c)) be the unique result of the result R(query, c). Uniqueness occurs when no 2 elements of the query contain the same contents.
The query is rewritten to:
D*=D(R(Q—MV, not A)+R(Q—OT, A)).
Thus, rewritten query D* includes a query against the (foreground) materialized view, and a query only against the original data in the database tables that satisfies A (i.e., having a row with a tracked change). The result of D* is the same result as D=D(Q_OT). The differences between D* and D are as follows. D might return a result with non-unique elements; typical task list queries do not show duplicate results (duplicate rows), so this is not considered to be a restriction which occurs in real-life scenarios. In addition, the costs for calculating D* are less than the costs of calculating D, if A applies to few elements only.
Costs for queries against materialized views are lower than the costs for queries against the base tables (original query). If the modifications are tracked in a modification list, the costs increase with the number of changes that are tracked.
The procedure for performing Scoping is as follows. Additional processing cost optimizations (and therefore response time optimizations) can be achieved taking into account what is of interest for the user (or system) which issues the query. That is, the number of changes that have to be taken into account can be reduced by applying a combination of the following restrictions to the considered entries in the modification list.
First is property-based scoping, in which only those keys in the modification list that have a certain property are considered. For example, only newly created objects in the modification list can be considered. Second is context-based scoping, in which only those keys in the modification list that match a property of the query context are considered. The context is established when executing the query. For example, only those keys in the modification list can be considered that have been created on behalf of actions of the particular user or client which executes the query.
Cost-Based and Response-Time-Based Optimization for Materialized Views with Modification List
Costs for queries against materialized views with modification list can be optimized to achieve two different goals: 1) shorten query response times for best user experience, and 2) lower CPU utilization. The first goal is achieved by refreshing the materialized view often, such that few tracked changes exist, and the query response time is as fast as possible as a consequence. The second goal is achieved by solving a simple optimization task: minimize the sum of the costs that are generated by queries against the materialized view with modification list.
In some embodiments, the time to refresh the materialized views can be determined as follows. The next refresh should take place once the newly calculated average of the costs is greater than the current calculated average of the costs, that is:
(Csum+Cr+Cq)/(qCount+1)>(Csum+Cr)/qCount.
In this equation, Cr is the costs for refreshing the materialized view, Cq is the costs of the last query that has been executed against the materialized view with modification list, Csum is the costs of all queries since start of the last refresh of the materialized view, qCount is the number of queries since the last refresh of the materialized view, and Cavg is the average cost per query (Cavg=Csum).
Although the present invention has been described in accordance with the embodiments shown, one of ordinary skill in the art will readily recognize that there could be variations to the embodiments and those variations would be within the spirit and scope of the present invention. Accordingly, many modifications may be made by one of ordinary skill in the art without departing from the spirit and scope of the appended claims.
Number | Name | Date | Kind |
---|---|---|---|
6339769 | Cochrane et al. | Jan 2002 | B1 |
6546402 | Beyer et al. | Apr 2003 | B1 |
6950823 | Amiri et al. | Sep 2005 | B2 |
7065527 | McCartney et al. | Jun 2006 | B2 |
7092951 | Luo et al. | Aug 2006 | B1 |
7111020 | Gupta et al. | Sep 2006 | B1 |
7167853 | Zaharioudakis et al. | Jan 2007 | B2 |
20020116457 | Eshleman et al. | Aug 2002 | A1 |
20060219772 | Bernstein et al. | Oct 2006 | A1 |
20070226203 | Adya et al. | Sep 2007 | A1 |
20090024569 | Langer | Jan 2009 | A1 |
Number | Date | Country | |
---|---|---|---|
20090037489 A1 | Feb 2009 | US |