Methods for concurrently executing database operations
By determining the usage speed of free storage units for concurrent database operations in the database system, the maximum number of available storage units for the second database operation is calculated, and the conflict between free space release and batch loading is solved, and efficient database operation execution and storage resource optimization is achieved.
Patent Information
- Application Number
- CN202080065359.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-09-18
- Filing Date
- 2020-08-21
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2040-08-21
AI Technical Summary
In a database system, the process of freeing up free space can lead to conflicts with other concurrently running workloads, especially in operations such as batch loading that require a large number of new pages, which can lead to performance degradation and failure.
By determining the usage speed of the free storage units used by the first and second database operations within the time window, the maximum number of free storage units that the second database operation can be used in the time window is calculated, and the execution of the second database operation is limited according to this number, thereby ensuring that the first database operation can be performed on the storage units of the storage space without requesting additional storage units.
Effectively resolve the conflict between free space release and batch loading in concurrent database operations, prevent performance degradation and failures, optimize the execution of database operations, and ensure the availability of storage resources between different tenants.
Smart Images

Figure CN114450670B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital computer systems, and more particularly, to a method for performing concurrent database operations in a database system. Background Art
[0002] Tenants can allocate space in the file system that is shared with other tenants. This allocation may have an impact on tenants who cannot use the space, even if the space is no longer used by the first tenant. Therefore, a process of releasing free space may need to be executed. For example, if a tenant discards a table in a database of space, the allocated space must be released back to the file system. The system may not automatically release the allocated space, and certain commands / statements need to be executed to trigger it. However, the execution of the release process may cause conflicts with other concurrently running workloads that use the space. This becomes even more critical for large operations like bulk loading that require many new pages in a very short time window. Summary of the invention
[0003] Various embodiments provide a method, a computer system and a computer program product for performing concurrent database operations in a database system, as described by the subject matter of the independent claims. Advantageous embodiments are described in the dependent claims. If the embodiments of the invention are not mutually exclusive, they can be freely combined with each other.
[0004] In one aspect, the present invention relates to a method for executing concurrent database operations in a database system during a time window, the database operations being configured to use storage units of a storage space of the database system. The method comprises: determining a first usage rate of free storage units to be used by at least one first database operation and a second usage rate of free storage units to be used by a second database operation; using the first and second usage rates to determine a maximum number of free storage units to be used by the second database operation during the time window; executing the second database operation during the time window according to the maximum number; and executing the first database operation, wherein the execution of the first database operation during the time window is limited to the storage units of the storage space.
[0005] In another aspect, the present invention relates to a computer system for executing concurrent database operations in a database system during a time window, the database operations being configured to use storage units of a storage space of the database system. The computer system is configured to: determine a first usage rate of free storage units to be used by at least one first database operation and a second usage rate of free storage units to be used by a second database operation; determine a maximum number of free storage units to be used by the second database operation during the time window using the first and second usage rates; execute the second database operation during the time window based on the maximum number; and execute the first database operation, wherein the execution of the first database operation during the time window is limited to the storage units of the storage space.
[0006] In another aspect, the present invention relates to a computer program product, comprising a computer-readable storage medium having a computer-readable program code embodied therewith, the computer-readable program code being configured to implement all the steps of the method according to the aforementioned embodiments.
[0007] Concurrent database operations can be configured to use a corresponding number of free storage units of storage space. For example, a first database operation can be configured to use N1 free storage units during a time window, and a second database operation can be configured to use N2 free storage units during a time window. At least a portion of the N1 free storage units can be free pages created during the time window. Those created free pages can be referred to as intermediate free pages, which can be used by the first database operation during the time window. The first database operation may involve a delete operation that creates an intermediate free storage unit for use by other requests of the first database operation. If during the time window, the storage space includes less than N2+N1 free storage units, the first database operation may only be able to use less than the required N1 free storage units. The present subject can prevent this situation by setting the maximum number of free storage units that can be used by the second database operation. Therefore, the present subject can enable the effective use of available storage between different tenants of the database system. The present subject can optimize the execution of database operations that share storage resources.
[0008] Depending on the type of database operations in the storage space, the present subject matter can prevent severe fragmentation. For example, a first database operation may include a bulk load that inserts data into a storage space, and the size of the storage space may be reduced by a second database operation. Using the present subject matter, conflicts between space reclamation and bulk loads can be avoided. This can prevent performance degradation (e.g., it can prevent just-freed space from having to be reallocated for storage space) and can prevent failures of bulk loads. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In the following, embodiments of the invention are explained in more detail, by way of example only, with reference to the accompanying drawings, in which:
[0010] Figure 1 A diagram depicting a data processing system.
[0011] Figure 2 is a flowchart of a method for performing concurrent database operations in a database system according to an example of the present disclosure.
[0012] Figure 3 is a flow chart of a method for determining a maximum number of free storage units that can be used by a database operation running concurrently with another database operation.
[0013] Figure 4 is a flow chart of a method for determining a maximum number of free storage units that can be used by a database operation running concurrently with another database operation.
[0014] Figure 5 It represents a computerized system suitable for implementing one or more method steps as involved in the present disclosure. DETAILED DESCRIPTION
[0015] The description of various embodiments of the present invention is presented for the purpose of illustration and is not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications, or technical improvements existing in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
[0016] A database system may include one or more databases. A database in these databases includes storage space. That is, those storage spaces are allocated for databases. Storage space may be a storage location for actual data under a database object that may hold a database. Storage space is used to allocate storage space for data to be stored in a database. Storage space may be, for example, a collection of pages, such as a file. Storage space may be a table space, an index space, or a virtual memory. Storage units may be, for example, pages. Database operations may, for example, enable access to a database. Storage units may be associated with a state value indicating the state of the storage unit. Storage units may be configured to include data. The state of a storage unit indicates whether the storage unit is a free storage unit. A free storage unit is a storage unit that is not used by a database operation. A free storage unit may be an empty storage unit (e.g., it has never been used), or contain data that was written by a database operation in the past, but the data is no longer used, for example, the data has not been used for a period of time longer than a predefined maximum allowed period. For example, a storage unit may be configured to include records. Each record may be mapped to a corresponding disk block of a database system. A data record or record is a collection of related data items (such as a specific user's name, birthday, and category). A data record represents an entity, where an entity refers to a user, object, or concept whose information is stored in a data record.
[0017] The database operation may be initiated, for example, by a user's application, or may be a database operation initiated by a database system. The term "user" may refer to an entity that initiates, for example, a database operation for requesting the insertion of a data item, such as a person, a computer, or an application executed on a computer. The first database operation may be initiated, for example, by a user application. The second database operation may be initiated by a database system. The database operation may, for example, use at least one page of a storage space. Using a page may, for example, include modifying a page. Modifying a page includes inserting one or more records in a page and / or deleting one or more records from a page and / or changing one or more records in a page and / or changing the state of a page. The database system may include multiple storage spaces, wherein each storage space in the multiple storage spaces is allocated or assigned to corresponding one or more database operations. A database operation may use a storage unit of a storage space allocated to it, and if there is no storage unit in the storage space to be used by a database operation, the database operation may request the allocation of an additional storage unit. However, the request for such an additional storage unit may take a long time, and therefore may slow down the execution of the database operation.
[0018] As used herein, the terms "first" and "second" refer to labels for the nouns that follow them and do not imply any type of ordering (e.g., spatial, temporal, logical) unless explicitly defined. According to one embodiment, the first database operation may be started before the second database operation is started. This may be advantageous in the case of a database system that regularly runs maintenance database operations. For example, the second database operation may be a maintenance database operation that is regularly performed on the database system, for example, the second database operation may be used to reclaim free pages. Since it is performed regularly, the execution of the second database operation may occur simultaneously with the execution of other database operations during the maintenance cycle. Since the maintenance operation is performed more frequently than other database operations (such as the first database operation), it may be limited to a given time window because it will be run again later. Therefore, limiting regularly performed maintenance operations may be advantageous compared to limiting other database operations that may only occur once.
[0019] According to one embodiment, the second database operation may be started at the same time or before the first database operation is started. By starting earlier, the second database operation has the benefit of using the resources of the database system first. Therefore, by limiting the second database operation to a maximum number of free storage units during the time window, optimal resource sharing between the database operations may be achieved. Since the second database operation uses some resources before the first database operation is started, it may be limited during the time window so that the first database operation may have sufficient resources.
[0020] In one example, the method may be automatically performed in response to determining that a first database operation and a second database operation are or will be running concurrently during a time window. This may enable an autonomously operating database system. This may be particularly advantageous because space reclamation for a tablespace may run for a longer period of time (several minutes) and it is not known when a new bulk load will occur. By automatically performing the method, a bulk load may be considered whenever it occurs.
[0021] According to one embodiment, each storage unit is associated with a state value indicating whether the storage unit is allocated to a first database operation and a second database operation. The storage space includes storage units allocated for the first database operation and the second database operation, wherein the second database operation uses the storage unit including: changing the state value of the storage unit to indicate that the storage unit is not allocated to the first database operation. Once a database operation accessing a given database ends or completes, the storage units that were allocated to the database operation may no longer be allocated to the database operation and may be allocated (e.g., if they become free) for another database operation accessing the given database.
[0022] This embodiment can be advantageously and seamlessly integrated into existing systems for the following example reasons. In existing systems, database administrators execute maintenance commands at fixed intervals, for example, the time window is one of these intervals. A second database operation can be triggered by a maintenance command. The maintenance command can, for example, be executed automatically. This can cause the maintenance command to run concurrently with one or more other active workloads of the first database operation. For example, a bulk load can insert a lot of data into a table space, while the size of the table space will be reduced by the maintenance command. This embodiment can be used to avoid conflicts between space reclamation and bulk loading. For example, this can prevent space that has just been freed from being reallocated for table space, or can prevent the failure of bulk operations.
[0023] This embodiment can improve the use of free space. For example, if 10 tables, each with 1 terabyte (TB) of data, are added to the storage space through a first database operation, and 9 of the 10 tables are dropped, there is 9 TB of free space in the storage space, and this 9 TB of free space may not be used by the first database operation. The present subject matter can enable other files in the file system to access the free space by making the free space available using a second database operation.
[0024] According to one embodiment, the determination of the maximum number is performed so that the first database operation is executed on the storage unit without requesting the allocation of the storage unit used by the second database operation. For example, the second database operation may reallocate the necessary pages so that the first database operation can run on the pages of the storage space without requesting the reallocation of the pages.
[0025] According to one embodiment, the method further comprises: providing a fixed number of free storage cells of the storage space that can be used by the first database operation during the time window according to the first usage speed, calculating the first number as the difference between the fixed number and the total number of free storage cells of the storage space that can be used by the second database operation during the time window according to the second usage speed, and calculating the second number of free storage cells that can be used by the second database operation during the time window according to the second usage speed, wherein the determined number is the minimum number between the first number and the second number.
[0026] The fixed number of free pages may be an estimate of the free pages that may be used by the first database operation during the time window. These free pages may be referred to as intermediate free pages because they need to be used by the first database operation during the time window. Therefore, the second database operation may only reallocate permanent free pages. The first number may be an estimate of the number of permanent free pages during the time window.
[0027] This embodiment may be advantageous because it may be possible to implement an accurate and reliable method for running multiple database operations concurrently without conflict. Before a first database operation begins, multiple storage units are allocated to it. The first database operation may, for example, include multiple load requests and delete requests. During the execution of the first database operation, intermediate free pages may be created (e.g., by delete requests), but the first database operation requires these intermediate free pages during the time window. The fixed number of pages may include an estimate of those intermediate free pages created so that the second database operation can only use permanent free pages. For example, a typical workload in a day may involve 5000 load operations, each of which is compensated by an associated delete operation, and the overall space required remains relatively constant. In this case, the reclaim operation may only become effective when there are more delete requests than insert requests (and some pages will be permanently released).
[0028] According to one embodiment, the method further includes: providing a buffer including a fixed number of free storage cells, wherein the buffer is configured to include different numbers of storage cells. In one example, the buffer can be logically retained. The second database operation can be configured to use the buffer, for example, before starting the second database operation, to determine how many free pages it can use by subtracting the number of free pages of the buffer from the total number of free pages of the storage space. By providing a page buffer that is not released and is large enough to cover the usual fluctuations of insertion and deletion during the time window (involved by the first database operation), the zigzag behavior of the storage size can be avoided. For example, the content of the buffer can be changed for another iteration of the method, for example, when the method is repeated for another pair of first and second database operations running concurrently in another time window, the buffer size can be changed. This can enable the method to be performed systematically.
[0029] According to one embodiment, the method further includes: determining the sum speed as the sum of the first usage speed and the second usage speed; determining the fraction of the second usage speed in the sum speed; and multiplying the number of storage units in the storage space by the fraction, wherein the determined maximum number is the result of the multiplication. This embodiment can implement an accurate and reliable method for concurrently running multiple database operations without conflict.
[0030] According to one embodiment, the determination of the maximum number of free storage units is performed before the first database operation begins. This can achieve optimal execution of concurrent database operations. For example, compared to the case where the determination is performed during the time window, this embodiment can speed up the execution of the first database operation, because the second database operation may exceed the maximum value when the maximum value is determined. In addition, if an already free page is available in the storage space, it is faster to use this page than to allocate a new page at the file system level.
[0031] According to one embodiment, determining the maximum number of free storage units is performed during execution of the first database operation. This can save processing resources that would be required to perform the determination even though the first database operation has not started or has failed.
[0032] According to one embodiment, the determination of the first usage speed and the second usage speed is performed using monitoring data indicative of a processing history of database operations in the database system.Using data from the same database system in which the method is performed enables an accurate and reliable estimate of the speed.
[0033] According to one embodiment, the first usage speed is a maximum speed among the usage speeds determined according to the monitoring data, and the second usage speed is a minimum speed among the usage speeds determined according to the monitoring data.
[0034] The first database operation may include multiple insert and / or delete and / or update requests or tasks. The first usage rate may, for example, indicate how many new data pages can be written in a given time window. The first usage rate may, for example, be the maximum rate for all bulk load operations involved in the first database operation. Information for determining the first usage rate and the second usage rate may be available from dedicated performance measurements, or may be available by continuously monitoring the database system, collecting throughput, and calculating maximum or minimum values.
[0035] The second usage speed may be a minimum speed for reclaiming free pages, for example, how many pages are at least reclaimed in a given time window. The second usage speed may be calculated by determining how many pages in the storage space are free pages and can be reclaimed. The method can limit the number of pages to be reclaimed so that at least available free pages that can be filled by bulk loading are retained during the time required for space reclamation.
[0036] According to one embodiment, the storage space is allocated for first and second database operations. The first database operation is a database operation that stores data in the storage space, and the second database operation is a database operation that reallocates storage units of the storage space. This can make it possible to keep free pages as resources available for concurrent workloads and reclaim only portions that will not be used by the concurrent workload in a specific time frame.
[0037] According to one embodiment, the storage space is a table space, the storage unit is a page, the first database operation is a bulk load insert operation, and the second database operation is a page reclaim operation.
[0038] According to one embodiment, the database DB system is DB2 for Linux, UNIX and Windows, ie DB2 LUW.
[0039] These embodiments can achieve seamless integration of the present subject matter in an existing DB2 LUW system. DB2 LUW uses table spaces as containers for physical storage of tables. Table spaces are structured into pages. Pages are used for different tables, and some of these pages may have been used in the past, but the data on them is deleted (either a single row or the entire table is discarded), and these pages become free pages. To remedy this situation, DB2 LUW provides a maintenance command for reclaiming free pages. The command can be defined as follows: ALTER TABLESPACE<table_space_name> REDUCE <n>The command specifies the page number to be used to free up space. In this case, the command indicates how many pages the tablespace should be reduced by.
[0040] Figure 1 A diagram of data processing system 100 is depicted. Data processing system 100 includes client system 101 and database system 103. Client system 101 is connected to database system 103 via network 102. Network 102 may be implemented, for example, in a wired or wireless manner, for example using wireless protocols and technologies such as WiFi, WiMax, etc.
[0041] The client system 101 may include one or more client applications 105. Each client application 105 may be configured to access data in the database system 103. To this end, the client application 105 may be linked, for example, with a DB2 Universal Database client library that enables communication with a database system supporting a DB2 system. The DB2 Universal Database client library may provide the functionality required for the client application 105 to access the database system 103.
[0042] An application in application 105 may be configured to initiate a database action or operation. To this end, TCP / IP communication may be established, for example, between application 105 and an agent in agent 107 of database system 103. Agent 107 of database system 103 may be configured to control activities in database system 103. Specifically, agent 107 enables most of the data processing to be performed on behalf of application 105. If database system 103 has multiple processors or is part of a partitioned database, multiple subagents 109 may be allocated. Agent 107 distributes database requests to subagents 109. Subagents 109 execute requests to application 105.
[0043] The database system 103 may include one or more storage spaces 110 for one or more databases of the database system 103. The storage space 110 may be allocated or assigned disk space of a hard disk 111, such as Figure 1 Each disk space may contain pages that can be used to store table data.
[0044] Figure 2 The invention is a flow chart of a method for executing concurrent database operations in a database system during a time window. The database operation may use a storage unit of a storage space. Using the storage unit may include at least using an idle storage unit of the storage space, for example, a first database operation may continue to use a storage unit that has been used in a time window before the current time window. The storage space may be, for example, a table space of a database. The storage space is allocated or associated with at least one of the database operations. For example, the storage space may be allocated to a first database operation in the database operations.
[0045] Each of the database operations may be configured to use a specific number of free storage units per time unit. That is, each database operation may have a usage rate of free storage units. Using free storage units may, for example, include writing data to free storage units or reclaiming free storage units. Reclaiming free storage units may include reallocating free storage units so that they belong to another storage space, for example, a storage space allocated to another database operation.
[0046] The first database operation may, for example, include one or more load requests or tasks, for example, the first database operation may include N load requests, for example, N=5000. The load request may insert data into a free storage unit or overwrite data of a storage unit. The second database operation may be a reclaim database operation. The reclaim database operation may be configured to reallocate or reassign a free storage unit.
[0047] The second database operation may be performed periodically, for example, in the database system. For example, the second database operation may be configured to be performed at a predetermined time interval, for example, every Monday of the week, or every day from 10 a.m. to 11 a.m. The method may be performed during at least part of the time interval in the time interval. The time window may be a time interval in the time interval.
[0048] In step 201, a first usage rate of free storage units to be used by a first database operation may be determined. The first usage rate is the number of free storage units used by the first database operation during a given time unit. In step 201, the first usage rate may be estimated using historical data, the historical data including, for example, log records of database operations similar to the first database operation. Database operations may be similar if they include the same type of requests (e.g., insert requests) and / or are initiated by the same application and / or are executed in the same time period. In another example, the first usage rate may be user defined, for example, determination of the first usage rate may include receiving user input indicating the first usage rate.
[0049] The first database operation may include multiple bulk load requests that need to run concurrently. Since the speed of the sum of all concurrent bulk loads is limited by the maximum input / output operations per second (IOPS) enabled by the hardware of the database system, all loads together can only process a maximum number of storage units per time interval. The first usage speed may be defined as the maximum number of pages per time interval. That is, if multiple bulk loads run concurrently, they will compete for resources and the loading speed will decrease for both. If multiple loads achieve a higher combined loading speed, the combined value may be the first usage speed.
[0050] In step 203, a second usage rate of the free storage units to be used by the second database operation may be determined. The second usage rate indicates how many storage units are at least reclaimed in the time window.
[0051] The first and second usage rates may be used to determine in step 205 a maximum number of free storage units to be used by the second database operation during the time window. Figure 3 and Figure 4 An example method for determining a maximum number of free storage units to be used by a second database operation is provided.
[0052] In step 207, the second database operation may be performed during the time window according to the determined maximum number. That is, the second database operation may not use more than the determined maximum number of free storage units during the time window.
[0053] In step 209, the first database operation may be executed during the time window, wherein execution of the first database operation is limited to the storage cells of the storage space. Since the determined maximum number limits the second database operation to the predefined number of storage cells, this leaves enough storage cells to be used by the first database operation during the time window without having to request additional storage cells. That is, execution of the first database operation is limited to the storage cells of the storage space. This may prevent any potential intrusion into pages that may be used by concurrent operations (such as bulk loads).
[0054] The first database operation may start before the time window. That is, during the time window, the first database operation continues its execution. In another example, the first database operation may start execution at the beginning of the time window.
[0055] Figure 3 is a flow chart of a method for determining a maximum number of free storage units that can be used by a database operation running concurrently with another database operation.
[0056] In step 301, a fixed number of free storage cells of a storage space may be determined. The storage space may be, for example, a table space, and the storage cells may be pages. The fixed number of free storage cells of the storage space may be the number of storage cells that may be used by a first database operation during a time window using a first usage rate. To this end, a buffer may be used. The buffer may be reserved (e.g. logically) for the first database operation. Within the same time window required for a bulk load (of the first database operation) to fill the buffer, space reclamation performed by a second database operation may release excess free storage cells back to the file system. This ensures that space reclamation will not run longer than required for the bulk load, and assumes the worst case scenario where space reclamation is slow and bulk loading is as fast as possible. Therefore, as referenced Figure 2 As described, the first use speed is determined as the maximum speed, and the second use speed is determined as the minimum speed.
[0057] In step 303, the first number may be calculated as the difference between the fixed number and the total number of free storage units of the storage space. The first number is the number of storage units available for recycling. The first number may be defined as follows: total_num_reclaimable_pages=num_free_pages-num_pages_in_buffer, where num_pages_in_buffer is the fixed number of pages and num_free_pages is the total number of free storage units of the storage space.
[0058] In step 305, a second number of free storage units that can be used by the second database operation during the time window according to the second usage speed can be determined. The second number can be defined as follows: num_reclaimable_pages = load_time * reclaim_speed (in pages / second), where load_time is the time that the bulk load will (at least) need to fill the buffer, and can be defined as follows: load_time = num_pages_in_buffer / load_speed. load_speed is the first usage speed. load_time can be used as an upper bound for calculating how many pages (the second number) can be reclaimed (at most) in the time window.
[0059] In step 307, the maximum number of free pages that can be used (e.g., reclaimed) by the second database operation can be determined as the minimum of the first number and the second number. This can limit the number of reclaimable pages. The maximum number can be defined as follows: num_reclaimable_pages=min(num_reclaimable_pages, total_num_reclaimable_pages), where min() refers to a function that calculates the minimum of two numbers.
[0060] Figure 4 is a flow chart of a method for determining a maximum number of free storage units that can be used by a database operation running concurrently with another database operation.
[0061] Figure 4 The method does not use a buffer. Figure 4 The method can be used as a safety measure. Figure 4 The approach can be based on splitting the number of free pages between space reclamation and (potentially) bulk loading.
[0062] In step 401, the summed speed may be determined as the sum of the first use speed and the second use speed. The summed speed may be defined as follows: summed_speed = reclaim_speed + load_speed. The reclaim speed is the second use speed and the load speed is the first use speed. As an example, assuming that the minimum reclaim speed is 250 pages / second and the maximum load speed is 1250 pages / second, in this case, the total number of pages modified by batch loading or reclaiming is 1500 pages / second.
[0063] In step 403, the fraction of the second usage speed in the summed speed may be determined. In step 405, the total number of free storage units in the storage space may be multiplied by the fraction. This results in the number of pages that can be reclaimed and may be defined as follows: num_reclaimable_pages=num_free_pages*reclaim_speed / summed_speed. The fraction is defined as the ratio of the reclaim speed to the summed speed: reclaim_speed / summed_speed.
[0064] In step 407 , the maximum number of free pages (or the determined maximum number) that can be used by the second database operation may be provided as the result of the multiplication of step 405 , num_reclaimable_pages.
[0065] Figure 5 represents a general purpose computerized system suitable for implementing the method steps involved in the present disclosure.
[0066] It should be understood that the methods described herein are at least partially non-interactive and automated by a computerized system (such as a server or embedded system). However, in an exemplary embodiment, the methods described herein can be implemented in a (partial) interactive system. These methods can be further implemented in software 522 (including firmware 522), hardware (processor) 505, or a combination thereof. In an exemplary embodiment, the methods described herein are implemented as executable programs in software and are executed by a dedicated or general-purpose digital computer (such as a personal computer, workstation, minicomputer, or mainframe computer). Therefore, the most general system 101 includes a general-purpose computer 501.
[0067] In an exemplary embodiment, in terms of hardware architecture, Figure 5 As shown, computer 401 includes processor 505, memory (main memory) 510 coupled to memory controller 515, and one or more input and / or output (I / O) devices (or peripheral devices) 10, 545 communicatively coupled via local input / output controller 535. Input / output controller 535 can be but not limited to one or more buses or other wired or wireless connections, as known in the art. Input / output controller 535 can have additional elements (which are omitted for simplicity), such as controller, buffer (cache), driver, repeater and receiver, to achieve communication. Further, local interface can include address, control and / or data connection, so that appropriate communication can be performed between the above components. As described herein, I / O device 10, 545 can generally include any universal encryption card or smart card known in the art.
[0068] Processor 505 is a hardware device for executing software, particularly software stored in memory 510. Processor 505 can be any custom or commercially available processor, a central processing unit (CPU), a secondary processor among several processors associated with computer 501, a semiconductor-based microprocessor (in the form of a microchip or chipset), a macroprocessor, or generally any device for executing software instructions.
[0069] The memory 510 may include any one or combination of volatile storage elements (e.g., random access memory (RAM, such as DRAM, SRAM, SDRAM, etc.) and non-volatile storage elements (e.g., ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM)). Note that the memory 510 may have a distributed architecture in which various components are remote from each other but can be accessed by the processor 505.
[0070] The software in the memory 510 may include one or more separate programs, each of which includes an ordered list of executable instructions for implementing logical functions (particularly the functions involved in the embodiments of the present invention).
[0071] The software in memory 510 also typically includes a suitable operating system (OS) 511. The OS 511 essentially controls the execution of other computer programs.
[0072] The methods described herein may be in the form of a source program, an executable program (object code), a script, or any other entity including a set of instructions to be executed. When a source program is used, the program needs to be translated via a compiler, assembler, interpreter, etc. (which may or may not be included in the memory 510) in order to operate correctly in conjunction with the OS 511. In addition, the methods described may be written in an object-oriented programming language with data classes and method classes, or in a procedural programming language with routines, subroutines, and / or functions.
[0073] In an exemplary embodiment, a conventional keyboard 550 and mouse 555 may be coupled to the input / output controller 535. Other output devices such as I / O devices 545 may include input devices such as, but not limited to, printers, scanners, microphones, etc. Finally, the I / O devices 10, 545 may further include devices that communicate with both input and output, such as, but not limited to, network interface cards (NICs) or modulators / demodulators (for accessing other files, devices, systems, or networks), radio frequency (RF) or other transceivers, telephone interfaces, bridges, routers, etc. The I / O devices 10, 545 may be any common encryption card or smart card known in the art. The system 101 may also include a display controller 525 coupled to the display 530. In an exemplary embodiment, the system 101 may also include a network interface for coupling to a network 566. The network 566 may be an IP-based network for communication between the computer 501 and any external servers, clients, etc. via a broadband connection. The network 566 sends and receives data between the computer 501 and the external system 30, which may be involved in performing some or all of the steps of the method discussed herein. In an exemplary embodiment, the network 566 may be a managed IP network managed by a service provider. The network 566 may be implemented wirelessly, for example using wireless protocols and technologies such as WiFi, WiMax, etc. The network 566 may also be a packet-switched network, such as a local area network, a wide area network, a metropolitan area network, an Internet network, or other similar types of network environments. The network 566 may be a fixed wireless network, a wireless local area network (LAN), a wireless wide area network (WAN), a personal area network (PAN), a virtual private network (VPN), an intranet, or other suitable network system, and include devices for receiving and sending signals.
[0074] If the computer 501 is a PC, workstation, smart device, etc., the software in the memory 510 may also include a basic input and output system (BIOS) 522. The BIOS is a set of basic software routines that initialize and test the hardware at startup, start the OS 511, and support the transfer of data between hardware devices. The BIOS is stored in ROM so that the BIOS can be executed when the computer 501 is activated.
[0075] When the computer 501 is running, the processor 505 is configured to execute software stored in the memory 510, transfer data to and from the memory 510, and generally control the operation of the computer 501 according to the software. The methods and OS 511 described herein are read by the processor 505 in whole or in part (but typically the latter), possibly buffered within the processor 505, and then executed.
[0076] When the systems and methods described herein are implemented in software, Figure 5 As shown, these methods can be stored on any computer-readable medium, such as storage device 520, for use by or in conjunction with any computer-related system or method. Storage device 520 can include disk storage devices, such as HDD storage devices.
[0077] Various embodiments are specified in the following numbered clauses:
[0078] 1. A method for executing concurrent database operations in a database system during a time window, the database operations being configured to use storage units of a storage space of the database system, the method comprising: determining a first usage rate of free storage units to be used by at least one first database operation and a second usage rate of free storage units to be used by a second database operation, determining a maximum number of free storage units to be used by the second database operation during the time window using the first usage rate and the second usage rate, executing the second database operation during the time window according to the maximum number, executing the first database operation, and executing the first database operation during the time window being limited to the storage units of the storage space.
[0079] 2. According to the method described in clause 1, each storage unit in the storage unit is associated with a status value indicating whether the storage unit is allocated to the first database operation and the second database operation, the storage space includes storage units allocated for the first database operation and the second database operation, wherein the use of the storage unit by the second database operation includes changing the status value to indicate that the storage unit is not allocated.
[0080] 3. The method of clause 2, wherein the determining is performed such that the first database operation is performed on a storage unit without requesting allocation of a storage unit used by the second database operation.
[0081] 4. The method according to any one of the above clauses, further comprising:
[0082] providing a fixed number of free storage cells of the storage space that can be used by the first database operation during the time window according to the first usage speed,
[0083] calculating a first number as a difference between the fixed number and the total number of free storage units of the storage space,
[0084] A second number of free storage units usable by the second database operation during the time window according to the second usage rate is calculated, wherein the determined maximum number is a minimum number of the first number and the second number.
[0085] 5. The method of clause 4, further comprising: providing a buffer configured to include the fixed number of free memory cells, wherein the buffer is configured to include a different number of memory cells.
[0086] 6. The method according to clause 1, 2 or 3 also includes: determining the total speed as the sum of the first usage speed and the second usage speed; determining the fraction of the second usage speed in the total speed; multiplying the total number of free storage units in the storage space by the fraction, wherein the determined maximum number is the result of the multiplication.
[0087] 7. A method according to any of the preceding clauses, wherein execution of the first database operation is initiated before the second database operation is initiated.
[0088] 8. The method according to any of the preceding clauses 1 to 6, wherein the execution of the first database operation is started simultaneously with or after the start of the second database operation.
[0089] 9. The method of any of the preceding clauses, wherein determining the maximum number of free storage units is performed before the first database operation begins.
[0090] 10. The method according to any of the preceding clauses 1-8, wherein determining the maximum number of free storage units is performed during execution of the first database operation.
[0091] 11. A method according to any preceding clause, the determination of the first usage speed and the second usage speed being performed using monitoring data indicative of a processing history of database operations in the database system.
[0092] 12. The method of clause 11, wherein the first usage speed is a maximum speed among usage speeds determined from monitoring data, and the second usage speed is a minimum speed among usage speeds determined from monitoring data.
[0093] 13. According to the method described in any one of the preceding clauses, the storage space is allocated for the first database operation and the second database operation, the first database operation is a database operation of storing data in the storage space, and the second database operation is a database operation of reallocating storage units of the storage space.
[0094] 14. The method of any of the preceding clauses, the storage space being a tablespace and the storage unit being a page, wherein the first database operation is a bulk load insert operation and the second database operation is a page reclaim operation.
[0095] 15. The method according to clause 14, wherein the database DB system is DB2 for Linux, UNIX and Windows, namely DB2 LUW.
[0096] 16. The method of any preceding clause, automatically performed in response to determining that the first database operation and the second database operation are concurrent database operations during the time window.
[0097] Various aspects of the present invention are described herein with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to embodiments of the present invention. It will be understood that each frame of the flow chart and / or block diagram and the combination of frames in the flow chart and / or block diagram can be implemented by computer-readable program instructions.
[0098] The present invention may be a system, method and / or computer program product. The computer program product may include (one or more) computer-readable storage media having computer-readable program instructions thereon for causing a processor to perform various aspects of the present invention.
[0099] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, but not limited to, any suitable combination of electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or the aforementioned storage devices. A non-exhaustive list of more specific examples of computer readable storage medium includes the following: portable computer disk, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, such as a punch card or a convex structure in a groove with instructions recorded on it, and any suitable combination of the above devices. Computer readable storage medium as used herein should not be interpreted as a temporary signal itself, such as radio waves or other free propagating electromagnetic waves, electromagnetic waves propagated by waveguides or other transmission media (e.g., light pulses by optical fiber cables), or electrical signals transmitted by wires.
[0100] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to a corresponding computing / processing device, or downloaded to an external computer or external storage device via a network (e.g., the Internet, a local area network, a wide area network, and / or a wireless network). The network can include copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in a computer-readable storage medium in the corresponding computing / processing device.
[0101] The computer-readable program instructions for performing the operation of the present invention can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, configuration data of integrated circuits, or source code or object code written in any combination of one or more programming languages (including object-oriented programming languages, such as Smalltalk, C++, etc.) and process programming languages (such as "C" programming language or similar programming languages). The computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or executed completely on a remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network (including local area network (LAN) or wide area network (WAN)), or can be connected to an external computer (for example, using an Internet service provider through the Internet). In certain embodiments, the electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) can execute the computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit, so as to perform various aspects of the present invention.
[0102] Various aspects of the present invention are described herein with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to embodiments of the present invention. It will be understood that each frame of the flow chart and / or block diagram and the combination of frames in the flow chart and / or block diagram can be implemented by computer-readable program instructions.
[0103] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device create a device for implementing the functions / actions specified in one or more boxes of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, which can guide the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable storage medium having the instructions stored therein includes an article of manufacture, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes of the flowchart and / or block diagram.
[0104] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps will be performed on the computer, other programmable apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable apparatus, or other device implement the functions / actions specified in one or more boxes of the flowchart and / or block diagram.
[0105] Flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention.In this regard, each frame in the flow chart or block diagram can represent the module, segment or part of instruction, which includes one or more executable instructions for realizing the specified logical function.In some alternative embodiments, the function noted in the frame may not occur in the order noted in the figure.For example, two frames shown continuously can actually be performed substantially simultaneously, or these frames can sometimes be performed in reverse order, depending on the function involved.It will also be noted that the combination of the frames in each frame of the block diagram and / or flow chart illustration and the block diagram and / or flow chart illustration can be realized by a dedicated hardware-based system that performs a specified function or action or performs a combination of special hardware and computer instructions.< / n>
Claims
1. A method for executing concurrent database operations in a database system during a time window, the database operations being configured to use storage units of a storage space of the database system, the method comprising: determining a first usage speed of free storage units to be used by at least one first database operation and a second usage speed of free storage units to be used by a second database operation, wherein the determination of the first usage speed and the second usage speed is performed using monitoring data indicating a processing history of database operations in the database system, the first usage speed being a maximum speed among the usage speeds determined according to the monitoring data, and the second usage speed being a minimum speed among the usage speeds determined according to the monitoring data; determining a maximum number of free storage units to be used by the second database operation during the time window using the first usage rate and the second usage rate; performing the second database operation during the time window according to the maximum number; and The first database operation is performed, and the execution of the first database operation during the time window is restricted to the storage unit of the storage space.
2. The method according to claim 1, wherein: Each of the storage units is associated with a status value indicating whether the storage unit is allocated to the first database operation and the second database operation, the storage space includes storage units allocated for the first database operation and the second database operation, wherein use of the storage unit by the second database operation includes: changing the status value to indicate that the storage unit is not allocated.
3. The method according to claim 1 or 2, wherein: The determining is performed such that the first database operation is performed on a storage unit without requesting allocation of the storage unit used by the second database operation.
4. The method according to claim 1 or 2, further comprising: providing a fixed number of free storage cells of the storage space that can be used by the first database operation during the time window according to the first usage speed, calculating a first number as a difference between the fixed number and the total number of free storage units of the storage space, A second number of free storage units that can be used by the second database operation during the time window according to the second usage speed is calculated, wherein the determined maximum number is a minimum number of the first number and the second number.
5. The method according to claim 4, further comprising: A buffer configured to include the fixed number of free memory cells is provided, wherein the buffer is configured to include a different number of memory cells.
6. The method according to claim 1 or 2, further comprising: determining a total speed as the sum of the first use speed and the second use speed; determining a fraction of the second usage speed present in the total speed; The total number of free storage cells in the storage space is multiplied by the fraction, wherein the determined maximum number is a result of the multiplication.
7. The method according to claim 1 or 2, wherein: Execution of the first database operation is initiated before initiating the second database operation.
8. A method according to any one of the preceding claims, wherein: Execution of the first database operation is initiated simultaneously with or after the initiation of the second database operation.
9. The method according to claim 1 or 2, wherein: Determining the maximum number of free storage units is performed before the first database operation begins.
10. The method according to claim 1 or 2, wherein: Determining the maximum number of free storage units is performed during execution of the first database operation.
11. The method according to claim 1 or 2, wherein: The storage space is allocated for the first database operation and the second database operation, the first database operation is a database operation of storing data in the storage space, and the second database operation is a database operation of reallocating storage units of the storage space.
12. The method according to claim 1 or 2, wherein: The storage space is a table space and the storage unit is a page, wherein the first database operation is a bulk load insert operation and the second database operation is a page reclaim operation.
13. The method according to claim 1 or 2, wherein: The database system is DB2 for Linux, UNIX and Windows, namely DB2 LUW.
14. The method according to claim 1 or 2, wherein: In response to determining that the first database operation and the second database operation are concurrent database operations during the time window, the method is automatically performed.
15. A computer program product comprising machine executable instructions for execution by a processor, wherein: Execution of the machine executable instructions causes the processor to perform the method of any one of claims 1-14.
16. A computer system for executing concurrent database operations in a database system during a time window, the database operations being configured to use storage units of a storage space of the database system, the computer system being configured to: determining a first usage rate of free storage units to be used by at least one first database operation and a second usage rate of free storage units to be used by a second database operation, wherein: performing determination of the first usage speed and the second usage speed using monitoring data indicating a processing history of database operations in the database system, the first usage speed being a maximum speed among usage speeds determined according to the monitoring data, and the second usage speed being a minimum speed among usage speeds determined according to the monitoring data; determining a maximum number of free storage units to be used by the second database operation during the time window using the first usage rate and the second usage rate; performing the second database operation during the time window according to the maximum number; as well as The first database operation is performed, and the execution of the first database operation during the time window is restricted to the storage unit of the storage space.
17. The computer system of claim 16, which is remotely connected to the database system or is included in the database system.
Citation Information
Patent Citations
Relieving memory pressure in a host using database memory management
US20120124270A1