# Patent

## Title
Sorting transactions in a memory object store

## Abstract

Methods and systems for rating and committing events in an event processing system are provided. Events can be rated at a rating system according to information that is stored locally on the rating system. Rated events can be stored in a database system with these rated events being utilized to, among other things, restore information that is stored locally on the rating system.

## Background
This application is a divisional application of U.S. application Ser. No. 10/394,409, filed Mar. 21, 2003, now U.S. Pat. No. 8,099,393, issued Jan. 17, 2012 and which claims priority to provisional application 60/366,827, filed Mar. 22, 2002. The entire contents of U.S. application Ser. No. 10/394,409 and U.S. Provisional Application No. 60/366,827 are incorporated herein by reference for all purposes.


BACKGROUND OF THE INVENTION
The present invention relates to event processing systems. More specifically, the invention relates to event processing systems that process events, such as for billing, in real time.
With the dramatic increase in the number of on-line and wireless transactions (or events), accounting techniques have also had to evolve in order to keep pace with the consumer market place. In general, event processing systems receive events, rate the events according to a particular rating scheme and generate the appropriate billing information for the consumers. Although these steps are common to most all event processing systems, there are a variety of event processing systems currently in use.
An event processing system can operate as a batch system. FIG. 1 shows an event processing system that processes events 101 in batches. A rating engine 103 rates events 101 according to information received from a database 105. Database 105 can include, for example, customer information 107, accounts receivable (A/R) 109 and events 111.
Typically, batch systems rate events at non-peak hours of the day or week. As an example, a batch system could be configured to rate events at midnight each day. At midnight, all customer information 107 and A/R 109 may be sent to rating engine 103. Rating engine 103 then processes all the events and sends the appropriate changes to database 105 including events 111 that occurred.
Batch event processing systems are suitable in many applications. However, the systems include a number of disadvantages such as the data is inaccurate between and during batch processing. Although some current batch systems have increased the frequency that they perform event processing (e.g., every two hours; also called near real time systems), there is still time between when the event occurs and when the event is processed where data (e.g., account balances) may be in accurate. This can make these systems unsuitable for pre-paid environments or any environment where the right to perform a transaction is based on an accurate analysis of the balance of an account.
Typically, batch event processing systems (or near real time systems) cannot process an event transactionally as a unit. Accordingly, these systems are not applicable where simultaneous events could occur that will compete to consume the same account resources (i.e., impact the same account balance).
Transactional real time event processing systems process events as they occur in real time. FIG. 2 shows a real time event processing system that processes events in real time. When an event 201 is received by a rating engine 203, information needed to rate event 201 is obtained from a database 205. The information in database 205 for rating an event can include customer information 207 and A/R 209 as shown.
Once rating engine 203 receives the information from database 205 for rating event 201, rating engine 203 rates event 201 and sends the appropriate changes to the information stored in the database 205 for updating. Database 205 can also store event 211. In this manner, events can be processed transactionally as units. If simultaneous events occur that are competing for the same resource, the events can be processed serially by locking access to the resource.
Although transactional real time event processing systems can provide significant advantages over batch processing systems, it would still be desirable to have improved systems that more efficiently process the events. Additionally, it will be beneficial if the improved techniques still maintained high availability and reliability for the information.
SUMMARY OF THE INVENTION
The invention provides systems and methods for more efficiently processing events, storing information and restoring information. In general, events can be processed in real time by storing information that is needed to rate the event locally, such as in the memory of the rating system. As the information for rating the event is available locally, it is not necessary to receive the information from a remote database. The rated event can be subsequently stored on a database, which can result in more efficient storing and restoring of the information. Several embodiments of the invention are described below.
In one embodiment, the invention provides a method of rating events in a real time transaction processing system. An event is received at a rating system and the event is rated at the rating system according to information stored locally on the rating system. The rated event can then be stored on a database system. In some embodiments, rated events are classified into multiple classes with different priorities for storage.
In another embodiment, the invention provides a method of storing events in a transaction processing system. Events are grouped for more efficient storage on a database system. Priorities of the events are analyzed and the events are stored in groups on the database system taking into account the priorities of the events. Typically, the priorities of the events include times by which events will be stored on the database system.
In another embodiment, the invention provides a method of restoring information in a transaction processing system. Information that was previously stored on a database system is retrieved. Additionally, rated events that were stored on the database system are retrieved. The rated events are applied to the previously stored information in order to restore information stored on the database system.
In another embodiment, the invention provides a method of committing events in a transaction processing system. One or more transaction threads process events utilizing read-only data from a shared memory of an in-memory database. The one or more transaction threads send information regarding a processed event to a commit engine. The commit engine updates the shared memory according to the processed event. Additionally, the commit engine can log the processed event to a storage device.
In another embodiment, the invention provides a method of committing events in a transaction processing system. Events to be committed are received where each event has a deadline specifying an amount of time that can elapse before the event should be committed. The event with the shortest deadline is selected and one or more events that can be committed with the selected event are identified. The selected event and the one or more events are committed to a storage device. In some embodiments, the events to be committed are sorted according to deadlines.
Other features and advantages of the invention will become readily apparent upon review of the following description in association with the accompanying drawings, where the same or similar structures are designated with the same reference numerals.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows an event processing system that processes events in batches (e.g., a batch processing system).
FIG. 2 shows an event processing system that processes events in real time.
FIG. 3 shows a network of multiple computer systems and devices.
FIG. 4 illustrates and example of a computer system that can be utilized in association with embodiments of the invention.
FIG. 5 illustrates a system block diagram of the computer system of FIG. 4.
FIG. 6 shows an example of a real time event processing system according to one embodiment of the invention.
FIG. 7 shows a flow chart of a process of rating events that utilizes information stored locally on the rating system.
FIG. 8 shows a flow chart of a process of storing events on a database system that includes taking into account priorities of the events.
FIG. 9 shows a flow chart of a process of restoring information that utilizes previously stored information and rated events.
FIG. 10 shows a transactional real time event processing system including shared memory of an in-memory database.
FIG. 11 shows a flow chart of a process of committing events where transaction threads have read-only access to shared memory.
FIG. 12 shows a flow chart of a process of committing events where events have associated deadlines for committing.



DETAILED DESCRIPTION OF EMBODIMENTS
Embodiments of the invention are described below with reference to preferred embodiments that rate the events in real time. However, many aspects of the invention can be advantageously applied to other event processing systems and are therefore not limited to the system, or application that is described herein. Accordingly, the description of the embodiments is for purposed of illustration and not limitation.
FIG. 3 shows an example of a network. A network 301 provides communication between and among multiple computer systems 303. Additionally, network 301 can receive information from devices such as a cellular (wireless) phone 305 and a conventional telephone 307.
In event processing systems, it should be understood that the rating and database systems are not necessarily on the same computer system 303. Furthermore, FIG. 3 illustrates that events can be received from numerous devices including a computer system 303 (such as for on-line Internet usage), cellular phone 305 (such as for wireless minutes) and telephone 307 (such as for telephones utilizing the Internet or voice over IP).
FIG. 4 illustrates an example of a computer system that can be used in association with embodiments of the invention. FIG. 4 shows a computer system 303 that includes a display 403, screen 405, cabinet 407, keyboard 409, and mouse 411. Mouse 411 can have one or more buttons for interacting with a graphical user interface. Cabinet 407 houses CD-ROM and DRIVE 413, system memory, and a hard drive (see FIG. 5), which can be utilized to store and retrieve software programs incorporating computer code that implement the invention, data for use with the invention, and the like. Although CD-ROM 415 is shown as an exemplary computer readable storage medium, other computer readable storage media including floppy disk, tape, flash memory, system, memory, and hard drives can be utilized.
FIG. 5 shows a system block diagram of computer system 303. As in FIG. 4, computer system 303 includes display 403, keyboard 409 and mouse 411. Computer system 303 further includes subsystems such as a central processor 451, system memory 453, fixed storage, 455 (e.g., hard drive) removable storage 457 (e.g., CD-ROM drive), display adapter 459, sound card 461, speakers 463, and network interface 465. Other computer systems suitable for use with the invention can include additional or fewer subsystems. For example, another computer system could include more than one processor 451 (i.e., a multi-processor system) or a cache memory.
The system bus architecture of computer system 303 is represented by arrows 467. However, these arrows are illustrative of any connection scheme serving to link the subsystems. For example, a local bus could the utilized to connect processor 451 to memory 453 and display adapter 459. Computer system 303 shown in FIG. 5 is but an example of a computer system suitable for use with the invention. Other computer architectures having different configurations of subsystems can also be utilized.
As the name implies, event processing systems process events. Events are typically generated when transactions are completed. For example, if a service provider is tracking the usage of a cellular telephone then an event can be generated when the call is complete. The event information can include data such as the duration of the call, the time of day, local/long distance, customer, and the like. Although events are typically generated when a transaction is complete, interim events can also be generated.
FIG. 6 shows a real time event processing system according to one embodiment of the invention. An event 501 is rated by a rating engine 503. Rating engine 503 receives information for rating event 501 from a memory 505. Memory 505 is local storage for rating engine 503 and can include any storage media including memory, hard disks and the like.
Memory 505 is shown to store customer information 507 and A/R 509. When rating engine 503 receives event 501, the rating engine retrieves the information that is necessary to rate event 501 from memory 505. Accordingly, rating engine 503 can rate event 501 without requiring retrieval of information from a remote database.
After rating event 501, information is sent to a database 511 that stores customer information 513, A/R 515 and rated events 517. Database 511 receives changes to the information stored on the database as a result of event 501. Additionally, database 511 acts as the permanent storage for the information and stores rated events 517, which can be utilized to restore information in memory 505 as will be discussed below. Typically, the information is stored in a relational database where related tables store the information.
With the embodiment shown in FIG. 6, rated events are stored on the database system. A rated event includes information that has been generated when the event was rated. In some embodiments, the rated events include information that has changed in the database as a result of the event. Thus, it is not necessary for database 511 to store all the specifics of the event, which can result in a significant savings in terms of the amount of information stored and the time it takes to store the information.
As an example, assume that the service provider described above that tracks cellular phone usage utilizing a complex formula for determining the cost of a call that includes the duration, time of day, local/long distance, location of the call, and the like. In some embodiments, this information need not be stored as the rated event can include the amount in which the customers balance has been increased by the event instead of all the information for rating the event. As will be described in more detail below, the rated events can also be utilized to restore information and it is not necessary to maintain a redo log.
Memory 505 can store the most up-to-date information so that this information is accurate at all times. Database 511 can be updated with changes to the information periodically with rated events 517 acting as a log for changes to the database.
Now that an exemplary system has been described, it may be beneficial to describe a method of rating events according to one embodiment of the invention. As with all the flow charts shown herein, steps may be added, deleted, combined, and reordered without departing from the spirit and scope of the invention. FIG. 7 shows a flow chart of a process of rating events that utilizes information stored locally on the rating engine or system.
At a step 601, an event is received. As described above, the event can be the result of any number of different transactions that need to be rated. Additionally, some events are interim events that may be generated before a transaction is complete. The event is rated according to information stored locally at a step 603. Thus, the event is rated without necessitating retrieval of information from a remote database system.
At a step 605, the rated event is stored in a database. The rated event can include, among other things, changes to the information on the database that have occurred as a result of rating the event. Thus, the rated event includes information that was not included in the event.
With the embodiment shown in FIG. 7, events can be more efficiently rated and stored. For example, the information for rating the event does not need to be retrieved from a remote database and events can be more efficiently stored because information from the rating process can be utilized.
In some embodiments, events or rated events are classified into multiple classes with different priorities for storage. As an example, the different priorities can include times by which events will be stored on the database system. Thus, a service provider can provide different levels of service (quality of service or QoS) to different customers. One customer may require that the information be stored within a few milliseconds, whereas another customer may find it acceptable to have the information stored within hundreds of milliseconds.
When the database system is storing events or rated events, the database system can take into account the priorities of the events when storing them on the database system. FIG. 8 shows a flow chart of a process of storing events that takes into account the priorities of the events.
At a step 701, events are grouped for more efficient storage on the database. Grouping events for more efficient storage on the database can include analyzing a curve of the hard drive storage efficiency, the hard drive latency, the size of the events, and/or any other information. As an example, it can be clearly seen that it may be more efficient to group two events if the events will be stored near the same physical location on the hard drive.
The priorities of the events are analyzed at a step 703. The priorities of the events can include times by which events will be stored on the database system. Therefore, although it may be efficient to group some events together, the grouping could result in a storage time that is outside the priority of one or more of the events. Additionally, the sequence of storing the events can be affected by their priorities such that events with a higher priority may be stored before earlier events with lower priorities.
At a step 705, the events are stored in groups on the database system taking into account the priorities of the events. By giving the events different priorities, the service provider is able to offer different levels of service to its customers while still maintaining the efficiency of the database system.
The rated events that are stored on the database system can also be utilized to restore information that is stored locally on the rating system. FIG. 9 shows a flow chart of a process of restoring information to a rating system utilizing previously stored information from a database and rated events on the database. An example of when this process could be utilized is when the computer system implementing the rating system crashes and the rating system needs to be brought back on-line.
At a step 801, information previously stored on the database is retrieved. Depending on the implementation, the information stored on the database may be almost up to date or it may be stale. In order to bring the information up-to-date, the rating system also retrieves rated events that are stored on the database system at a step 803. The rated events include information specifying how the information that is stored on the database has changed as a result of events that where subsequently received.
The rated events are applied to the information from the database at a step 805. By applying the rated events to the previously stored information, the information stored in the database is restored to its current state. Thus, by retrieving the information previously stored on the database and the rated events on the database, the rating system is able to restore the current information. Not only is the process efficient, it does not require the storage of a redo log that tracks each change to the database.
It may be beneficial to describe an example of restoring information according to the flow chart shown in FIG. 9. Going back to the example where a service provider is providing cellular time to customers, the rated events can result in, among other things, changes to a customer's balance.
If it is desired to restore the information on the rating system, the previously stored balance for the customer may be retrieved from the database system. Additionally, any subsequent rated events that effected this customer's information may be retrieved. The rated events that are retrieved are then applied to the information, where they may update the balance to the current amount.
The above has described rating of events, the invention can also provides innovative techniques of committing processed events. FIG. 10 shows a transactional real time event processing system. An application 901 interacts with transaction threads (or processes, contexts, objects, etc.) 903. For example, application can be a business billing application that interacts with transaction threads 903 through application programming interface (API) calls.
Each transaction thread 903 is executing computer code to process an event and can include a rating engine as described above. Transaction threads 903 have read-only access to a shared memory 905 of an in-memory database. When initializing shared memory, conventional operating systems allow the read/write privileges that are granted to be specified.
Shared memory 905 can store, among other things, customer information and A/R (e.g., information for determining if a transaction is allowed, rating transactions and balances). By giving transaction threads 903 read-only access to shared memory 905, “dirty” reads can be avoided where data can be read from shared memory before it has been committed. This will be described in more detail in the following paragraphs.
As transaction threads 903 have read-only access to shared memory 903, the transaction threads store changes that are made to the shared memory in scratch pad (local) memory 907. When a transaction thread is ready to commit a processed event, information is sent to a commit engine 909.
Commit engine 909 updates the shared memory according to the processed event and can log the processed event to a storage device 911. The log on storage device 911 can serve for failure or disaster recovery.
Since transaction threads 903 do not have write access to shared memory 905, the transaction threads do not have access to any updates to the shared memory until after the update has been committed through commit engine 909. This remedies the dirty read problem of many conventional systems.
Additionally, transaction threads 903 can provide APIs for application 901 to access shared memory 905. This can be especially beneficial if application 901, transaction threads 903 and shared memory 905 are in the same address space (see dashed lines). By being in the same address space, application 901 can access data in shared memory 905 directly, without requiring a copy of the data being made and sent.
FIG. 11 shows a flow chart of a process of committing events where transaction threads have read-only access to shared memory. At a step 1001, one or more transaction threads process events utilizing read-only data from a shared memory of an in-memory database. The processing can include rating an event.
At a step 1003, the one or more transaction threads send information regarding a processed event to a commit engine. For example, a transaction thread can send the processed event and data from scratch pad memory 907.
The commit engine updates the shared memory according to the processed event at a step 1005. Additionally, the commit engine can store a log of the event in a storage device. In some embodiments, the processed event and local memory are logged on a storage device. Updates to the shared memory of the in-memory database are then made according to the processed event. Lastly, events are extracted from the log and stored in another database.
The way in which events are committed can have a large impact on the efficiency of the system. FIG. 12 shows a flow chart of a process of committing events where events have associated deadlines for committing. The deadlines specify an amount of time that can elapse before the event should be committed. The event can be committed at any time before the deadline, but the deadline should or must not be missed.
At a step 1101, events to be committed are received where each event has a deadline. Some events may need to be committed relatively fast (e.g., milliseconds) and others may have longer deadlines. Events that do not have an associated deadline can still be committed in timely manner as will be described below.
An event with the shortest deadline is selected at a step 1103. The commit engine may be continually committing events. Thus, if there are no events with deadlines waiting to be committed, an event without a deadline can be selected (e.g., longest waiting to be committed). In some embodiments, the events are sorted by deadlines in order to facilitate selecting the event with the shortest deadline.
At a step 1105, one or more events are identified that can be committed with the selected event. Although the commit engine could commit one event at a time, it can be more efficient to commit multiple events at a time. The efficiency of committing multiple events can be analyzed to determine how many additional events to commit with the selected event. For example, any one or more of factors such as the speed of the storage device, size of the events, maximum size for committing, maximum delay time for committing, preprocessing overhead time for the commit, postprocessing overhead time for the commit, or the like.
At a step 1107, the selected event and the one or more events identified at step 1105 are committed. As an example, assume that the events are sorted and the event with the shortest deadline is selected. The commit engine could determine that the next five events (with or without deadlines) could be efficiently committed with the selected event (e.g., disk drives can often perform additional writes much more efficiently than sequential single writes). In other words, committing these six events would be more efficient than committing just the selected event and still allow deadlines on existing and future events to be met. Accordingly, the six events would be committed together.
As can be seen, the invention allows for very efficient ratings and committing of events while also maintaining the integrity of the information. Additionally, the storage and retrieval of the information can also be improved utilizing embodiments of the invention.
While the above has described specific embodiments of the invention, various alternatives and modifications can be made to the embodiments described above. However, these alternatives and modifications are not outside the scope of the invention which is defined by the following claims along with their fair scope of equivalents.

## Claims

1. A method comprising:
receiving, by a computer system, a plurality of events to be committed to a database resident on a storage device, each event related to a completed communication session from an event processing system involving a user and having a deadline for committing the event to the database, the deadline based on a quality of service defined for the user and specifying therein an amount of time that can elapse before the event should be committed to the database;
selecting, by the computer system, an event in the plurality of events with a shortest deadline;
identifying, by the computer system, one or more events in the plurality of events that can be committed to the database with the selected event, wherein the deadlines for the selected event and on the one or more events differ from each other and wherein identifying the one or more events comprises analyzing the efficiency of committing the one or more events with the selected event and while still meeting deadlines for the plurality of events that are not the selected event of the one or more identified events; and
committing, by the computer system, the selected event and the one or more events to the database together at the same time.

2. The method of claim 1 further comprising sorting the plurality of events according to their respective deadlines prior to the selecting.

3. The method of claim 1 wherein the selected event and the one or more events are committed prior to expiration of their respective deadlines.

4. The method of claim 1 wherein the analyzing comprises analyzing one or more of: a speed of the storage device, a size of the one or more events, a maximum size for committing, a maximum delay time for committing, a preprocessing overhead time for the commit, or a postprocessing overhead time for the commit.

5. A non-transitory computer readable medium having stored thereon program code which, when executed by a computer system, causes the computer system to:
receive a plurality of events to be committed to a database resident on a storage device, each event related to a completed communication session from an event processing system involving a user and having a deadline before the event should be committed to the database, the deadline based on a quality of service defined for the user and specifying therein an amount of time that can elapse before the event should be committed to the database;
select an event in the plurality of events with a shortest deadline;
identify one or more events in the plurality of events that can be committed to the database with the selected event, wherein the deadlines for the selected event and on the one or more events differ from each other and wherein identifying the one or more events comprises analyzing the efficiency of committing the one or more events with the selected event and while still meeting deadlines for the plurality of events that are not the selected event of the one or more identified events; and
commit the selected event and the one or more events to the database together at the same time.

6. The non-transitory computer readable medium of claim 5 wherein the program code further comprises code that causes the computer system to sort the plurality of events according to their respective deadlines prior to the selecting.

7. The non-transitory computer readable medium of claim 5 wherein the selected event and the one or more events are committed prior to expiration of their respective deadlines.

8. The non-transitory computer readable medium of claim 5 wherein the analyzing comprises analyzing one or more of: a speed of the storage device, a size of the one or more events, a maximum size for committing, a maximum delay time for committing, a preprocessing overhead time for the commit, or a postprocessing overhead time for the commit.

9. A system comprising:
a processor; and
a memory coupled with the processor and having stored therein a sequence of instructions which, when executed by the processor, causes the processor to:
receive a plurality of events to be committed to a database resident on a storage device, each event related to a completed communication session from an event processing system involving a user and having a deadline before the event should be committed to the database, the deadline based on a quality of service defined for the user and specifying therein an amount of time that can elapse before the event should be committed to the database;
select an event in the plurality of events with a shortest deadline;
identify one or more events in the plurality of events that can be committed to the database with the selected event, wherein the deadlines for the selected event and on the one or more events differ from each other and wherein identifying the one or more events comprises analyzing the efficiency of committing the one or more events with the selected event and while still meeting deadlines for the plurality of events that are not the selected event of the one or more identified events; and
commit the selected event and the one or more events to the database together at the same time.

10. The system of claim 9 wherein the processor is further configured to sort the plurality of events according to their respective deadlines prior to the selecting.

11. The system of claim 9 wherein the selected event and the one or more events are committed prior to expiration of their respective deadlines.

12. The system of claim 9 wherein the analyzing comprises analyzing one or more of: a speed of the storage device, a size of the one or more events, a maximum size for committing, a maximum delay time for committing, a preprocessing overhead time for the commit, or a postprocessing overhead time for the commit.