The present disclosure relates to database technologies. In particular, the present disclosure relates to a method and system for automatic management of dynamically allocated memory in a computing unit.
Computer systems may manage computer memory dynamically. Dynamic memory management refers to the process by which blocks of memory are allocated temporarily for a specific purpose and then deallocated when no longer needed for that purpose. Deallocated blocks are available for reallocation for another purpose. The memory that the processing unit configured in the computer system manages is referred to as a “heap”. When a program/application needs a block of memory to store data, the program/application sends a request to the processing unit. The processing unit allocates a block of memory in the heap to satisfy the request and sends a pointer to the program/application. The program/application can then access the block of memory through the pointer.
The computer memory stores data in one or more databases. The data is related to one or more establishments such as financial institutions, commercial establishments, government offices, educational institutions, data security centers, weather forecast centers, manufacturing industries. The database can be a relational database, network database, object oriented database and hierarchical database. Generally, a relational database is a collection of relations (frequently referred to as tables). Relational databases use a set of mathematical terms, which may use structured query language (SQL) database terminology. For example, a relation may be defined as a set of tuples that have the same attributes. A tuple usually represents an object and information about that object. A relation is usually described as a table, which is organized into rows and columns. Generally, all the data referenced by an attribute are in the same domain and conform to the same constraints. The relational model specifies that the tuples of a relation have no specific order and that the tuples, in turn, impose no order on the attributes. Programs/applications read and write the data from the one or more databases by specifying queries, which use operations to identify tuples, identify attributes, and to combine relations. Similarly, queries may identify tuples for updating or deleting. When a row is updated, a new version of the row is created and inserted into the table. The new version occupies additional space in the heap. The previous version is provided a pointer to the new version. The previous version is marked expired, but remains in the database until it is collected by a garbage collector. Garbage collection is the process of dynamic memory management that detects and recovers the memory that is no longer accessible by the program/application. Thus, they can be used for deallocation and subsequent reallocation thereby increasing performance of the database.
One of the methods of improving the performance of the database is using multi-version concurrency control (MVCC). The aim of MVCC is to avoid the problem of writers writing data into the one or more databases blocking readers who are accessing the data from the one or more databases and vice-versa, by making use of multiple versions of data. The problem of writers blocking readers can be avoided if readers can obtain access to a previous version of the data that is locked by writers for modification. The problem of readers blocking writers can be avoided by ensuring that readers do not obtain locks on the data. For this purpose, MVCC allows multiple versions of data to exist and guarantees that the data is viewed consistently within a transaction and prevents interference between the transactions, readers and writers thus improving data concurrency. However, the disadvantage arises that for each transaction's duration, the size of the accessed data increases with each new version that is created, so there is a corresponding detrimental effect on performance.
In SQL, a VACCUM command must be run to manage the unnecessary areas created in the one or more databases due to the existence of multiple versions of data i.e for performing the garbage collection operation. This frees up the areas for reuse in other operations. Running the VACCUM command on regular basis also prevents the database from becoming too large. Unfortunately, the VACCUM command can be difficult to run in systems that run constantly, with the result that a lot of unnecessary areas are created in databases that are repeatedly added to or updated. This can also lead to the database file size becoming unreasonably large.
The processing unit identifies that the received query is related to UPDATE operation. The query is to set the city of the supplier named as NVI from ‘A’ to ‘Santa Clara’. The processing unit performs the UPDATE operation and the data is updated in the ‘SUPPLIERS’ Table as shown below.
Normally, the data related to all the Tables of the database 1 are stored as data segments which are illustrated in
The limitation with the scenario illustrated in
Further, if the query received by the processing unit is ROLLBACK, the processing unit has to perform many undo records in order to complete the rollback/recovery. While replaying the UNDO for INSERT/DELETE is kind of complete reverse operation of actual operation, which might be a costly operation and time consuming. Therefore, with more number of operations in the same transaction, more number of UNDO and hence more time to do the rollback operation. Hence, the rollback performance also goes down.
Hence, there exists a need for a method and system for automatic management of dynamically allocated memory in a computing unit by which the performance of the garbage collector is improved and also the performance of rollback and recovery is improved.
The shortcomings of the prior art are overcome and additional advantages are provided through the present disclosure. Additional features and advantages are realized through the techniques of the present disclosure. Other embodiments and aspects of the disclosure are described in detail herein and are considered a part of the claimed disclosure.
The present disclosure provides a method for automatic management of dynamically allocated memory in a computing unit. The method comprises receiving one or more queries by a processing unit, wherein the processing unit is configured to perform an operation on one or more databases in response to the received one or more queries. Upon receiving the one or more queries the processing unit determines whether the received one or more queries are related to at least one of INSERT, DELETE and first type of UPDATE. If the received one or more queries are related to at least one INSERT, DELETE and first type of UPDATE then the processing unit creates a heap record for a predetermined set of data stored in the one or more databases. If the received one or more queries is related to a second type of UPDATE then the processing unit creates an UNDO record for the predetermined set of data stored in the one or more databases.
The present disclosure provides a system for automatic management of dynamically allocated memory in a computing unit. The system comprises a memory unit configured to store one or more databases and a processing unit communicatively coupled to the memory unit. The processing unit receives one or more queries and performs an operation on the one or more databases based on the received one or more queries. The processing unit creates a heap record for a predetermined set of data stored in the one or more databases upon identifying the received one or more queries to be at least one of INSERT, DELETE and a first type of UPDATE and creates an undo record for the predetermined set of data stored in the one or more databases upon identifying the received one or more queries to be a second type of UPDATE.
The present disclosure is related to a non-transitory computer readable medium including operations stored thereon that when processed by at least one processing unit cause a system to receive one or more queries and perform an operation on one or more databases, stored in a memory unit, in response to the received one or more queries. Upon receiving the one or more queries, a heap record is created for a predetermined set of data stored in the one or more databases upon determining the received one or more queries to be at least one of INSERT, DELETE and a first type of UPDATE and an undo record is created for the predetermined set of data stored in the one or more databases upon determining the received one or more queries to be a second type of UPDATE.
The present disclosure provides a computer program for automatic management of dynamically allocated memory in a computing unit. The compute program comprises a code segment for receiving one or more queries, code segment for performing an operation on one or more databases based on the received one or more queries, code segment for creating a heap record for a predetermined set of data stored in the one or more databases upon determining the received one or more queries to be at least one of INSERT, DELETE and a first type of UPDATE and a code segment for creating an undo record for the predetermined set of data stored in the one or more databases upon determining the received one or more queries to be a second type of update.
The foregoing summary is illustrative only and is not intended to be in any way limiting. In addition to the illustrative aspects and features described above, further aspects, and features will become apparent by reference to the drawings and the following detailed description.
The novel features and characteristic of the disclosure are set forth in the appended claims. The embodiments of the disclosure itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings. One or more embodiments are now described, by way of example only, with reference to the accompanying drawings.
The figures depict embodiments of the disclosure for purposes of illustration only. One skilled in the art will readily recognize from the following description that alternative embodiments of the structures and methods illustrated herein may be employed without departing from the principles of the disclosure described herein.
The foregoing has broadly outlined the features and technical advantages of the present disclosure in order that the detailed description of the disclosure that follows may be better understood. Additional features and advantages of the disclosure will be described hereinafter which form the subject of the claims of the disclosure. It should be appreciated by those skilled in the art that the conception and specific aspect disclosed may be readily utilized as a basis for modifying or designing other structures for carrying out the same purposes of the present disclosure. It should also be realized by those skilled in the art that such equivalent constructions do not depart from the spirit and scope of the disclosure as set forth in the appended claims. The novel features which are believed to be characteristic of the disclosure, both as to its organization and method of operation, together with further objects and advantages will be better understood from the following description when considered in connection with the accompanying figures. It is to be expressly understood, however, that each of the figures is provided for the purpose of illustration and description only and is not intended as a definition of the limits of the present disclosure.
The present disclosure is related to a method and system for automatic management of dynamically allocated memory in a computing unit. The processing unit receives one or more queries from the one or more client machines through the communication network. If the received one or more are related to at least one of INSERT, DELETE and first type of UPDATE, the processing unit creates a heap record and stores the heap record in the data segment of the one or more databases. If the received one or more queries are related to second type of UPDATE, the processing unit creates an undo record and stores the undo record in the undo segment of the one or more databases. For the second type of UPDATE the undo record is created because in the second type of UPDATE the updated data occupies more memory space in the data segment than the data before performing the UPDATE operation. Therefore, whenever the second type of UPDATE is received the undo record is created, wherein the new version of the data is stored in the data segment and the old version of the data is stored in the undo segment. Hence, whenever the garbage collector performs the garbage collection operation, it has less number of rows to be processed in the data segment thereby improving the performance of the garbage collector.
As used herein, the terms “INSERT” refers to adding rows to an existing Table, “UPDATE” refers to modifying set of existing Table rows, “DELETE” refers to removing existing rows from a Table, “first type of UPDATE” refers to modifying set of existing Table rows wherein the modified Table rows occupies memory space in the data segment which is same when compared to the memory space occupied by the Table rows before modification, “second type of UPDATE” refers to modifying set of existing Table rows wherein the modified Table rows occupies memory space in the data segment which is more when compared to the memory space occupied by the Table row before modification.
Henceforth, embodiments of the present disclosure are explained with the help of exemplary diagrams and one or more examples. However, such exemplary diagrams and examples are provided for the illustration purpose for better understanding of the present disclosure and should not be construed as limitation on scope of the present disclosure.
In an embodiment, the one or more users provide queries using the one or more client machines 101. The one or more client machines 101 send the one or more queries to the computing unit 105 through the communication network 103. Alternatively, the user of the computing unit 105 may provide one or more queries through the user interface. The processing unit 107 receives the one or more queries and performs an operation on predetermined set of data stored in the one or more databases 111. If the received one or more queries is related to INSERT operation, the processing unit 107 writes the data in the one or more databases 111. If the received query is related to DELETE operation, the processing unit 107 deletes the data from the one or more databases and if the received one or more queries is related to UPDATE operation, the processing unit 107 updates the data stored in the one or more databases 111.
In an embodiment, if the received one or more queries is at least one of INSERT, DELETE and first type of UPDATE alternatively referred as in-place update then the processing unit 107 creates a heap record for the predetermined set of data stored in the one or more databases 111. If the received query is a second type of UPDATE alternatively referred as out-place update then the processing unit 107 creates undo record for the predetermined set of data stored in the one or more databases 111. The heap record is stored in the data segment 113 of the one or more databases 111, as shown in
In an exemplary embodiment, the database 1111 stores information related to educational institution, the database 2111 stores information related to financial institution and the database n 111 stores the information related to social networking. The databases 1, 2 and n stores the data in the form of Tables i.e database 1111 stores information related to educational institution in a Table named as ‘SCHOOL’, the database 2111 stores information related to financial institution in a Table named as ‘FINANCE’ and the database n 111 stores information related to the social networking in a Table named as ‘NETWORK’. The Table ‘SCHOOL’ stores information related to the school such as student ID, student name and nationality of the student as shown below. The Table ‘FINANCE’ stores information related to such as supplier ID, supplier name and city of supplier as shown below and the Table ‘NETWORK’ stores information related to social networking such as user ID, user name and the number of posts made by each user as shown below.
The user using the client machine 1101 wishes to modify the data stored in the database 1111. The user sends a query as shown below in order to perform the INSERT operation on the Table ‘SCHOOL’.
The processing unit 107 identifies that the received query is related to INSERT operation. The processing unit 107 updates the ‘SCHOOL’ Table based on the received query. The updated ‘SCHOOL’ Table is as shown below.
When the processing unit 107 receives the INSERT query, it creates a heap record for the predetermined set of data stored in the database 1111 i.e the processing unit 107 inserts data into the ‘SCHOOL’ Table. The data inserted into the ‘SCHOOL’ Table is referred as new version of the data. The new version of the data is stored in the same data segment 113 of the database 1111 where the old version of the data is stored as shown in
In an embodiment, when the received query is a second type of UPDATE as shown below, the processing unit 107 creates undo record and the undo record is stored in the undo segment 115 of the database.
Upon receiving the query, the processing unit 107 performs the UPDATE operation on the data stored in the ‘FINANCE’ Table i.e the name of the supplier is changed from ‘BM’ to ‘HP’. The updated ‘FINANCE’ Table is as provided below.
The processing unit 107 detects that the memory space occupied by the data after performing the UPDATE operation, which is more than the memory space occupied by the data before performing the UPDATE operation i.e it identifies that the received query is second type of UPDATE. Therefore, the processing unit 107 creates the undo record in the undo segment 115 of the database 2111. The undo segment 115 stores the old version of the data. The new version of the data is stored in the data segment 113 of the database 2 as shown in the
In an embodiment, if there is a ROLLBACK operation in the received query the processing unit 107 returns the one or more databases 111 to the previous state at which the transaction started. Rollbacks are important for the database integrity, because through this operation the database can be restored to a clean copy even after erroneous operations are performed. They are crucial for recovering from database 111 server crashes. By rolling back, any transaction which was active at the time of the crash, the database is restored to a consistent state. Rollback is nothing but performing the UNDO operation. While performing the UNDO for INSERT/DELETE query is kind of complete reverse operation of actual operation, which might be a costly operation. Therefore, with more number of operations in the same transaction, more number of UNDO and hence more time to do the rollback operation. Hence, the rollback performance goes down. The present disclosure overcomes this problem by creating an undo record for the second type of UPDATE.
When the ROLLBACK operation has to be performed, it has to perform the UNDO of all the operations in a particular transaction. As an example consider ATM transaction. In the ATM transaction the bank stores the information related to the transaction made by each customer in a database in the form of a Table. For this purpose, the Table ‘ATM’ is created and the data related to the transaction are stored in the ‘ATM’ Table.
In the above query, there are two INSERT and UPDATE operations. For the INSERT operations, the processing unit 107 creates a heap record and stores the heap record in the data segment 113 of the database 111. The processing unit 107 identifies that the received UPDATE queries are second type of UPDATE operations and therefore creates an undo record and stores the undo record in the undo segment 115 of the database 111. When the ROLLBACK operation has to be performed, it has to perform less number of UNDO since for the second type of UPDATE undo record is created. Therefore, the ROLLBACK has to perform UNDO only for the INSERT DELETE operations. By this number of UNDO are reduces and thus the performance of the ROLLBACK is improved.
The described operations may be implemented as a method, system or article of manufacture using standard programming and/or engineering techniques to produce software, firmware, hardware, or any combination thereof The described operations may be implemented as code maintained in a “non-transitory computer readable medium”, where a processing unit may read and execute the code from the computer readable medium. The processing unit is at least one of a microprocessor and a processor capable of processing and executing the queries. A non-transitory computer readable medium may comprise media such as magnetic storage medium (e.g., hard disk drives, floppy disks, tape, etc.), optical storage (compact disc read-only memories (CD-ROMs), digital versatile discs (DVDs), optical disks, etc.), volatile and non-volatile memory devices (e.g., electrically erasable programmable read-only memories (EEPROMs), read-only memories (ROMs), programmable read-only memories (PROMs), random-access memories (RAMs), dynamic random-access memories (DRAMs), static random-access memories (SRAMs), flash memory, firmware, programmable logic, etc.), etc. The non-transitory computer-readable media comprise all computer-readable media except for a transitory. The code implementing the described operations may further be implemented in hardware logic (e.g., an integrated circuit chip, programmable gate array (PGA), application specific integrated circuit (ASIC), etc.).
Furthermore, the code implementing the described operations may be implemented in “transmission signals”, where transmission signals may propagate through space or through a transmission media, such as an optical fiber, copper wire, etc. The transmission signals in which the code or logic is encoded may further comprise a wireless signal, satellite transmission, radio waves, infrared signals, Bluetooth®, etc. The transmission signals in which the code or logic is encoded is capable of being transmitted by a transmitting station and received by a receiving station, where the code or logic encoded in the transmission signal may be decoded and stored in hardware or a non-transitory computer readable medium at the receiving and transmitting stations or devices. An “article of manufacture” comprises non-transitory computer readable medium, hardware logic, and/or transmission signals in which code may be implemented. A device in which the code implementing the described embodiments of operations is encoded may comprise a computer readable medium or hardware logic. Of course, those skilled in the art will recognize that many modifications may be made to this configuration without departing from the scope of the disclosure, and that the article of manufacture may comprise suitable information bearing medium known in the art.
The terms “an embodiment”, “embodiment”, “embodiments”, “the embodiment”, “the embodiments”, “one or more embodiments”, “some embodiments”, and “one embodiment” mean “one or more (but not all) embodiments of the disclosure(s)” unless expressly specified otherwise.
The terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless expressly specified otherwise.
The enumerated listing of items does not imply that any or all of the items are mutually exclusive, unless expressly specified otherwise.
The terms “a”, “an” and “the” mean “one or more”, unless expressly specified otherwise.
Devices that are in communication with each other need not be in continuous communication with each other, unless expressly specified otherwise. In addition, devices that are in communication with each other may communicate directly or indirectly through one or more intermediaries.
A description of an embodiment with several components in communication with each other does not imply that all such components are required. On the contrary a variety of optional components are described to illustrate the wide variety of possible embodiments of the disclosure.
Further, although process steps, method steps, algorithms or the like may be described in a sequential order, such processes, methods and algorithms may be configured to work in alternate orders. In other words, any sequence or order of steps that may be described does not necessarily indicate a requirement that the steps be performed in that order. The steps of processes described herein may be performed in any order practical. Further, some steps may be performed simultaneously.
When a single device or article is described herein, it will be readily apparent that more than one device/article (whether or not they cooperate) may be used in place of a single device/article. Similarly, where more than one device or article is described herein (whether or not they cooperate), it will be readily apparent that a single device/article may be used in place of the more than one device or article or a different number of devices/articles may be used instead of the shown number of devices or programs. The functionality and/or the features of a device may be alternatively embodied by one or more other devices which are not explicitly described as having such functionality/features. Thus, other embodiments of the disclosure need not include the device itself.
The illustrated operations of
The foregoing description of various embodiments of the disclosure has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the disclosure to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the disclosure be limited not by this detailed description, but rather by the claims appended hereto. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the disclosure. Since many embodiments of the disclosure can be made without departing from the spirit and scope of the disclosure, the disclosure resides in the claims hereinafter appended.
Additionally, advantages of present disclosure are illustrated herein.
Embodiment of the present disclosure provides a method to improve performance of garbage collector by processing less number of rows in the data segment.
Embodiment of the present disclosure provides a method wherein the garbage collector processes less number of heap records due to which less number of I/O operations are required to be performed.
Embodiment of the present disclosure improves performance of garbage collector because of processing less number of rows in the data segment.
In one embodiment, the method disclosed in the present disclosure enables to perform rollback operations quickly as it has to process less number of undo records.
Embodiment of the present disclosure provides faster recovery operation because of less undo records since UNDO will be written only for second type of UPDATE operation.
Finally, the language used in the specification has been principally selected for readability and instructional purposes, and it may not have been selected to delineate or circumscribe the inventive subject matter. It is therefore intended that the scope of the disclosure be limited not by this detailed description, but rather by any claims that issue on an application based here on. Accordingly, the disclosure of the embodiments of the disclosure is intended to be illustrative, but not limiting, of the scope of the disclosure, which is set forth in the following claims.
With respect to the use of substantially any plural and/or singular terms herein, those having skill in the art can translate from the plural to the singular and/or from the singular to the plural as is appropriate to the context and/or application. The various singular/plural permutations may be expressly set forth herein for sake of clarity.
In addition, where features or aspects of the disclosure are described in terms of Markush groups, those skilled in the art will recognize that the disclosure is also thereby described in terms of any individual member or subgroup of members of the Markush group.
While various aspects and embodiments have been disclosed herein, other aspects and embodiments will be apparent to those skilled in the art. The various aspects and embodiments disclosed herein are for purposes of illustration and are not intended to be limiting, with the true scope and spirit being indicated by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
IN4329/CHE/2013 | Sep 2013 | IN | national |
This application is a continuation of International Application No. PCT/CN2014/075668, filed on Apr. 18, 2014, which claims priority to Indian Patent Application No. IN4329/CHE/2013, filed on Sep. 24, 2013, all of which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2014/075668 | Apr 2014 | US |
Child | 15079309 | US |