In database systems, many performance optimizations involve tracking the oldest times at which currently active read and write transactions first accessed an object within the database. In datasharing environments, the oldest update time and oldest read time within the entire system are commonly tracked by taking the oldest read and oldest write times of all currently active transactions in each system, and then taking the oldest value from each system to derive the oldest times of access across all datasharing members. The oldest update time and oldest read time may result being excessively ‘stale’ for the majority of active objects in the datasharing environment. For example, a single long running transaction within any member of the system can set the oldest update time and oldest read time to the time when that transaction first accessed any object, while the majority of objects' first access times are far more recent.
According to one embodiment of the present invention, in a method for optimizing approximation of an earliest access time of objects in a datasharing environment, the method maintains a global exception list for the objects that are accessed by transactions that commit infrequently within the datasharing environment. The global exception list comprises at least one time value representing the earliest access time for each object that commits infrequently in the global exception list, and an object identifier associated with the object. The method references the global exception list to determine whether the object identifier associated with the object is in the global exception list. The global exception list is referenced to optimize usage of the datasharing environment's system resources. If the object identifier is in the global exception list, the method uses the time value associated with the object identifier to determine the earliest access time for the object associated with the object identifier. If the object identifier is not in the global exception list, the method approximates the earliest access time of the object by selecting the most recent access time value from the time values in the global exception list, where approximation of the earliest access time of the object is optimized by excluding less recent time values when selecting the most recent access time. This provides more recent access times for objects that commit frequently within the datasharing environment. The method makes the global exception list available to members of the datasharing environment.
System and computer program products corresponding to the above-summarized methods are also described and claimed herein.
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
The system may use these values to determine for example, whether to acquire a lock, or whether to reclaim the space for an object. The majority of transactions commit frequently. A long running transaction, however, may set the oldest update time and/or the oldest read time far earlier than most of the other currently running transactions that commit far more frequently. To balance a few long running transactions against the majority of transactions that commit frequently, the method maintains a global exception list of those transactions that commit infrequently to separate out those transactions from the transactions that commit frequently. The difference between transactions that commit frequently and transactions that commit infrequently is dependent upon workloads and how the data is being accessed. In a datasharing environment, there may be many transactions (i.e., read and write transactions) running concurrently. If a currently active transaction is old enough that it begins degrading the performance of other transactions against other objects in the system, then it is beneficial to the datasharing environment to add the objects that the transaction is accessing to the global exception list, so that the transaction no longer impacts the performance of the transactions against other objects. This approach provides the benefits of providing a more recent access time for each object with lower tracking expenses. A datasharing environment may have thousands of objects, only a small number of which would be considered to be “stale”. Maintaining a small (relative to the number of total objects) list of objects that are committing infrequently, that can be searched quickly, provides the datasharing environment with an efficient method of balancing the long running transactions with the transactions that commit frequently. In an example embodiment, if the number of objects in the global exception list is large, optimizations such as hashed lookups or hash filters may be used to reduce the overhead of examining the exception lists.
At 201, the method references the global exception list to determine whether an object identifier associated with an object is in the global exception list. The global exception list is referenced to optimize usage of the datasharing environment's system resources. The system resources may include acquiring locks, reclaiming space, etc. Acquiring and releasing locks require high system overhead, and lock avoidance techniques are often used. Referencing the global exception list to determine whether a more recent last access time may be used for a particular object enables the system to avoid unnecessary locks.
At 202, if the object identifier is in the global exception list, the method uses at least one time value associated with the object identifier to determine the earliest access time for the object associated with the object identifier. If the object is on the exception list, the method uses, for example, the update time and/or read time associated with that object when determining the earliest access time for that object. In other words, if the object is determined to be a “stale” object (i.e., tracked on the global exception list), the method uses the earliest access time associated with that object obtained from the global exception list.
At 203, if the object identifier is not in the global exception list, the method approximates the earliest access time of the object by selecting the most recent access time value from the global exception list, where the approximation of the earliest access time of the object is optimized by excluding less recent time values when selecting the most recent access time. This provides more recent access times for objects that are accessed by transactions that commit frequently within the datasharing environment. In an example embodiment, the method maintains a list of objects that are accessed by transactions that commit infrequently. The method determines that the earliest update time (for an object not tracked on the global exception list) is the most recent of those update times listed in the global exception list. In other words, if an object is not listed in the global exception list (i.e., not considered to be in the group of “stale” objects), the method approximates the earliest update time for that object by taking the most recent of update times listed in the global exception list. This approximated earliest update time is closer to the actual earliest update time for that object than if the method were to use the earliest update time for all the objects in the system.
At 204, the method makes the global exception list available to members of the datasharing environment. In an example embodiment, the global exception list is maintained in a global structure that is accessible by all members. The global exception list may have serialization to ensure that reads and writes to it are consistent. In another example embodiment, the method may retrieve the current global exception list and store it in a member's memory.
In an example embodiment, when the method maintains the global exception list for the objects that are accessed by transactions that commit infrequently within the datasharing environment, the method creates the global exception list from exception lists created by members of the datasharing environment. In an example embodiment, one or more members create individual member created exception lists from objects that are accessed by transactions that commit infrequently within each respective member. If the same objects occur in multiple member created exception lists, the oldest of those values is used in the global exception list. In
In an example embodiment, when the method maintains the global exception list for the objects that are accessed by transactions that commit infrequently within the datasharing environment, the method reads at least one member created exception list at periodic intervals. The member created exception list is compiled, by a member, from objects that are accessed by transactions that commit infrequently within that member. In an example embodiment, at least some of the members create their exception lists at periodic intervals based on a timer. The frequency of member created exception lists (and which members produce an updated exception list) may be tuned to balance system overhead and currency of the access times in the member created exception lists. As noted above, the global exception list may be maintained in a global structure that is accessible by all members. The method may determine that a global exception list does not exist, or the global exception list that exists is too old. The method then reads at least one member created exception list into the global structure. The method may read the member created exception list at periodic intervals. In another example embodiment, the frequency of updating the global exception list may be tuned to optimize earliest access times and/or overhead of the datasharing environment. The method may also create the global exception list from the earliest access times (i.e., the “oldest values”) in one or more of the member created exception lists. In other words, the earliest access times in the member created exception lists may be sorted to determine the objects that are accessed by transactions that commit infrequently within the datasharing environment. The method may also tune the number of objects in the global exception list to optimize approximation of the earliest access time of objects not tracked on the global exception list. In other words, the number of objects in the global exception list can be adjusted to ensure that the most recent of the earliest access times in the global exception list provide relatively recent access times for those objects not tracked on the global exception list (i.e., those objects that are accessed by transactions that commit frequently).
When the method maintains the global exception list for the objects that are accessed by transactions that commit infrequently within the datasharing environment, the method determines that the time value is comprised of at least one of an oldest update time of a currently active transaction, and an oldest read time of a currently active transaction. In an example embodiment, as illustrated in
In an example embodiment, when the method references the global exception list to determine whether the object identifier associated with the object is listed in the global exception list, the method optimizes lock avoidance by referencing the global exception list. The global exception list is referenced to determine whether a more recent access time may be used for the object than the earliest access time provided by the datasharing environment. The earliest access time is associated with a stale (i.e., long running) object. Using the more recent access time may allow the system to avoid an otherwise unnecessary lock.
The descriptions of the various embodiments of the present invention has been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. 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 terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.