METHOD AND COMPUTER SYSTEM FOR ASYNCHRONOUS MESSAGING
Field of the Invention
The present invention generally relates to electronic data processing, and more particularly, relates to methods, computer program products and systems for asynchronous messaging.
Background of the Invention
Software products that use distributed data in a distributed system often use asynchronous messaging for communication between various computers of the distributed system. Sometimes the same data is represented by multiple data sets on the various computers of the distributed system. Because of asynchronous messaging a user accessing a data set on one computer has no real time view on a further data set representing the same data but stored on another computer. To synchronize the various data sets, each time when a user changes the data a message is sent to the further users operating on the same data on further computers. The message includes information about the delta applied to the data (delta approach) . When the message is received by the computer of a further user the delta is applied to the respective data set . Once the messages about all changes that occurred in the distributed system are received by the computers of the respective users and applied to the respective data sets a state of equilibrium is reached and each user sees again the same consistent value of the data through the respective data sets. In case a message gets lost, the state of equilibrium cannot be reached.
Summary of the Invention
The present invention provides methods, computer program products and computer systems as described by the independent claims to allow a computer system that uses asynchronous messaging to reach a state of equilibrium with respect to multiple data sets representing the same data faster than when using the prior art delta approach, that is, already before all messages are received by the respective computers of the computer system. Further, even when messages get lost in the distributed system, the various data sets can still reach the state of equilibrium.
Instead of always using the delta of a modification for updating a status and/or the related data set, under certain conditions the present invention uses the totals value that results from the modification to update the status and/or related data set. Using the totals value can sometimes lead to a situation that one status learns about the state of a further status without having received all messages that relate to corresponding modifications of the further status. In this case the information about some of the modifications is implicitly included in the messages already received. Even if a message gets completely lost within the computer system, it does not prevent the computer system from reaching again a state of equilibrium in many cases . Usually the information of the lost message is implicitly included in some other message and can be considered in a status update that is triggered by this other message.
The aspects of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the appended claims. Also, the described combination of the features of the invention is not be understood as a limitation, and all the features can be combined in other constellations
without departing from the spirit of the invention. It is to be understood that both, the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as described.
Brief Description of the Drawings
FIG. 1 is a simplified block diagram of a computer system that can be used with an embodiment of the invention when asynchronous messaging is used for message exchange between multiple computers; FIG. 2A illustrates a simplified flowchart of a method that can be performed by an embodiment of a computer system according to the invention; FIG. 2B illustrates details of one of the steps of the method; FIG. 3 shows details of a first and second status over time in a specific example; and FIG. 4 shows details of a first, second and third status over time in a further example.
Detailed Description of the Invention
The same reference numbers are used throughout the drawings to refer to the same or like parts.
Definitions of terms, as used herein after:
AND, OR: logical operators
FIG. 1 is a simplified block diagram of a computer system that can be used with an embodiment of the invention when asynchronous messaging is used for message exchange between multiple computers (e.g., a first computer 901 and a second computer 902) of the computer system. A computer can be any computing device, such as a personal computer, a mobile computer or a cell phone. The first and second computer can communicate over a network 999, such as a local area network (LAN) , a wide area network (WAN) , the Internet or a wireless network. Users being able to modify data sets representing the same data are referred to as changers .
In the example of FIG. 1, a modifying changer Cm (for example, m=l) can apply a modification M to a data set 100 that is stored, for example, in the first computer 901. For example, the data set 100 stores the number of items on stock (scalar data) and five items are removed from stock by the modifying changer. In response to the modification, the first computer 901 modifies 420 a first individual status SI of the data set 100 accordingly. The first computer 901 provides 410 the first status SI to the modifying changer Cl.
In another example the data set can include a customer order (structured data) . In the customer order, the modification can correspond to changing an order position of the customer order. In the following description the invention is described by using a scalar data set example but those skilled in the art can apply the findings also to structured data sets or character/string data sets.
A further second changer C2 can be at a different location and use a different computer. In case the computer system is configured to use distributed data on multiple computers, a further data set 100' can be
stored on the second computer 902 representing the same data as the data set 100. In this case, the modification M that occurred on the first computer needs to be reflected in the further data set 100' on the second computer so that the second changer C2 can rely on the best possible up-to-dateness. For example, if the second changer wants to retrieve further items from stock, the number of stocked items that is shown to the second changer should be as accurate as possible. In an asynchronous messaging environment, in general, the second changer C2 is not able to see in real time modifications M that are applied to the data set 100 by changers using other computers than the second computer of the computer system. In the following description the term data set always refers to the data set that is stored on the corresponding changer's computer. Because each data set is representing the same data, the computer system tries to keep the various data sets as consistent as possible.
The second computer 902 provides 410 a second individual status S2 of the data set 100 to the second changer C2. The second status S2 is adjusted 440 when the second computer receives a message that includes a status, such as the first status, indicating that the data set has been modified by a modifying changer. After having modified 420 the first status SI, the first computer 901 of the modifying changer Cl sends 430 the message to each further changer (e.g., C2) by sending the message to the corresponding computers (e.g., second computer 902) of the computer system. The corresponding status of each further changer (e.g., second status S2) is adjusted 440 accordingly. The data set can then be corrected 450 accordingly.
Each changer in the computer system can become a modifying changer when applying modifications to the data set. Each individual status provides a current view of the data set to its corresponding changer, wherein the current view reflects the modifications indicated by the received messages. The following examples demonstrate that although messages being still under way were not used for updating a data set, yet, the impact of such messages may already be reflected in the current view to the corresponding changer.
FIG. 2A illustrates a simplified flowchart of a computer implemented method 400 that can be performed by an embodiment of a distributed system according to the invention.
The method 400 can be used for asynchronously exchanging messages between a plurality of changers Ci, i=l...n, where messages notify further changers about a modification M (cf. FIG. 1) applied by a modifying changer Cm, l<=m<=n, to a data set. Each data set 100, 100' represents the same data. The method includes the following steps .
Providing 410 an individual status Si, i=l...n, of the data set to each changer Ci, wherein the individual status Si includes information about a delta value of the modification M, a totals value as a result of the modification and a modification history of the data set. In case of structured data sets the totals value can correspond to the whole data structure whereas the delta value is a portion of the data structure.
Modifying 420 a first status Sm, l<=m<=n, of the modifying changer Cm in accordance with the modification M in response to the modification M of the data set .
Sending 430 a message from the modifying changer Cm to each further changer Ck, k=l... (m-1) , (m+l)...n, wherein the message comprises the first status Sm.
Adjusting 440 each further status Sk, k=l... (m- 1) , (m+l)...n, of each further changer Ck, k=l... (m-
1) , (m+l)...n, in response to receiving the message according to rules implemented by the following steps visualized in FIG. 2B:
Comparing 441 the modification history of the first status Sm with the modification history of the further status Sk.
Rule Rl: if the result of the comparing step 441 indicates that the first status Sm is younger than OR coeval with the further status Sk with respect to all changers Ci, then copying 443 the totals value of the first status Sm to the totals value of the further status Sk and updating 444 the modification history of the further status Sk with the modification history of the first status Sm. Rule R2 : if the result of the comparing step 441 indicates that the first status Sm is younger than the further status Sk with respect to at least one changer AND that the first status Sm is elder than the further status Sk with respect to at least another changer, then adding 445 the delta value of the first status Sm to the totals value of the further status Sk and partially updating 446 the modification history of the further status Sk with the modification history of the first status Sm with respect to changers having a modification history portion of the first status Sm that is younger than the corresponding history portion of the further status Sk. Note that adding 445 in a scalar data set scenario means to add one number to another number in the mathematical sense, whereas adding 445 in a structured data set or string data set
example can mean to merge the delta value with the totals value according to predefined merging rules.
Advantageously, the data set is then corrected 450 accordingly. In a first implementation the modification history includes a time stamp vector TSV having an individual timestamp TSVi, i=l...n for each changer Ci. The modifying step 420 changes the modifying timestamp TSVm, l<=m<=n, of the modifying changer Cm in the first status Sm by storing a representation of the time at which the modification M occurred. Preferably, the timestamp vector TSV is part of the data structure of the corresponding status . Those skilled in the art can use any strictly monotonically rising function over time for determining appropriate time representation values .
In a second implementation the modification history includes a changer counter vector CCV having an individual changer counter CCVi, i=l...n, for each changer Ci. The modifying step 420 changes the modifying changer counter CCVm, l<=m<=n, of the modifying changer Cm in the first status Sm by a changer counter increment .
The details of the adjusting step 440 as shown in FIG. 2B are now explained with respect to the second implementation. Those skilled in the art can apply the findings to the first implementation.
The result of the comparing step 441 is a changer counter difference vector CCDVi, i=l...n, for the further changer Ck that is calculated by subtracting the changer counter vector CCV of the further status Sk from the changer counter vector CCV of the first status Sm. Each vector coordinate of the changer counter difference vector CCDVi corresponds to the changer
counter difference between corresponding individual changer counters CCVi, i=l...n, of the first status Sm and the further status Sk.
The result of the comparing step 441 indicates that the first status Sm is younger than OR coeval with the further status Sk with respect to all changers Ci, if at least one changer counter difference vector coordinate CCDVj , l<=j<=n, has the sign of the changer counter increment AND (if the remaining changer counter difference vector coordinates CCDVp, p=l... (j -1) , (j+1) ...n, equal zero OR have the sign of the changer counter increment) .
The partially updating step 444 is then performed by copying the changer counter vector CCV of the first status Sm to the changer counter vector CCV of the further status Sk.
The result of the comparing step 441 indicates that the first status Sm is younger than the further status Sk with respect to at least one changer AND that the first status Sm is elder than the further status Sk with respect to at least an other changer, if at least one changer counter difference vector coordinate CCDVj , l<=j<=n, that corresponds to at least one changer Cj has the sign of the changer counter increment AND if at least one other changer counter difference vector coordinate CCDVq, l<=q<=n, qoj , that corresponds to the at least another changer Cq has the opposite sign of the changer counter increment .
The updating step 446 is then performed by copying the value of any changer counter of the first status Sm, where the corresponding changer counter difference vector coordinate CCDVi has the sign of the changer counter increment to the corresponding changer counter of the further status Sk.
FIG. 3 shows details of the first and a further second status (Sm, m=l; Sk, k=2) over time (to < t9) in a specific example including two changers. The first and second status (SI, S2) correspond to a first and second changer (Cl, C2) . Messages that are sent from one changer to another changer are illustrated by arrows between the corresponding status. Sending a message from a first changer to a second changer means sending the message from the corresponding first computer to the corresponding second computer.
In the example of FIG. 3 all messages are received in the order they are sent . Each status includes information about a delta value of the modification M in a delta portion DP, a totals value as a result of the modification M in a totals portion TP and a modification history of the data set. In the example, the modification history is implemented as a changer counter vector CCV that includes a changer counter for each changer (CCVI, CCV2) . In another implementation a time stamp vector can be used that includes the timestamp of the latest modification of each changer.
It is assumed that the data set stores the number of items available on stock with regards to a specific product or part. Each changer can enter goods movements for the data set (e.g., retrieving items from or adding items to the stock) . Any other example with a data set that is used by multiple changers can be used instead.
At time point to, the first status SI is in a state of equilibrium with the second status S2. The totals value (number of items on stock) equals 13 for SI and S2. The modification history indicates that no modification has been applied by the first and second changer as the corresponding changer counters CCVI and CCV2 have their initial values 0.
At tl, the second changer C2 becomes the modifying changer. The corresponding modification M indicates that two items are removed from stock (DP=-2) . Therefore, the totals value in the totals portion TP of S2 is reduced by two (TP=13-2=11) . The modification history is changed to reflect that the second changer C2 has changed the data set. In the example, CCV2 is incremented by 1 (any other increment can also be used) . A message that includes the second status S2 as of tl is sent to the further changers (e.g., the first changer Cl) . In the following the notation "Si/tk" will be used for status Si as of time point tk. That is, S2/tl=(-2,ll,0 l)
At t2, the first changer Cl becomes the modifying changer. The corresponding modification M indicates that seven items are added to the stock (DP=+7) . Therefore, the totals value in the totals portion TP of SI is increased by seven (TP=13+7=20) . The modification history is changed to reflect that the first changer Cl has changed the data set. In the example, the CCVI is incremented by 1. That is, Sl/t2= (+7, 20, 1, 0) . A message that includes Sl/t2 is sent to the further changers (e.g., the second changer C2) . Note that at t2 the totals values in the totals portions of SI and S2 are not in a state of equilibrium.
At t3, the message that includes Sl/t2 is received by the computer of the second changer. Comparing the modification history of Sl/t2 with S2/tl (current S2) indicates that Sl/t2 is younger than S2/tl with respect to the first changer Cl (because CCVl(Sl/t2) > CCVl(S2/tl) and the counter increment equals 1 in the example) AND that Sl/t2 is elder than S2/tl with respect to the second changer C2. In case of using time stamps instead of changer counters, the time stamps are compared accordingly. Under this condition (rule R2,
cf. FIG. 2B) the delta value of Sl/t2 is added to the totals value S2/tl. Further, the modification history of S2/t3 is partially updated with the modification history of Sl/t2 with respect to changers having a modification history portion of Sl/t2 that is younger than the corresponding history portion of S2/tl. That is, in the example, the value of CCVl(Sl/t2) is copied to CCVl(S2/t3). The result is S2/t3= (7, 18, 1, 1) . For any update U it is not important, whether the DP value of the receiving status is kept or overwritten with the DP value of the received status . For convenience of readability, the examples use overwriting.
At t4, the first changer Cl is still the modifying changer. The corresponding modification M indicates that three items are added to the stock (DP=+3) . Therefore, the totals value in the totals portion TP of SI is increased by three (TP=20+3=23) . The modification history is changed to reflect that the first changer Cl has changed the data set . CCVI is incremented by 1. That is, Sl/t4= (+7,20, 2, 0) . A further message that includes Sl/t4 is sent to the further changers.
At t5, the further message that includes Sl/t4 is received by the computer of the second changer. Comparing the modification history of Sl/t4 with S2/t3 (current S2) leads to the same update rule (rule R2) as at t3. The result is S2/t5= (7, 18, 1, 1) .
At t6, the message that includes S2/tl is received by the computer of the first changer. Comparing the modification history of S2/tl with Sl/t4 (current SI) indicates that S2/tl is younger than Sl/t4 with respect to the second changer C2 AND that S2/tl is elder than Sl/t4 with respect to the first changer Cl. Under this condition (rule R2) the delta value of S2/tl is added to the totals value of Sl/t4. Further, the modification history of Sl/t6 is partially updated with the
modification history of S2/tl with respect to the second changer S2. The result is Sl/t6= (-2,21, 2, 1) .
At t7, the second changer C2 becomes the modifying changer again. The corresponding modification M indicates that six items are removed from stock. Therefore, the totals value in the totals portion TP of S2 is reduced by six. The modification history is changed to reflect that the second changer C2 has changed the data set. That is, S2/t7= (-6, 15,2,2) . A message that includes S2/tl is sent to the further changers .
At t8, the first changer Cl becomes the modifying changer again. The corresponding modification M indicates that five items are added to the stock. The modification history is changed to reflect that the first changer Cl has changed the data set. That is, Sl/t8= (+5,26,3, 1) . A message that includes Sl/t8 is sent to the further changers.
At t9, the message that includes Sl/t8 is received by the computer of the second changer and substantially simultaneously the message that includes S2/t7 is received by the computer of the first changer. According to the previously explained update rules this results in Sl/t9= (-6, 20, 3, 2) and S2/t9= (+5, 20, 3 , 2) . A state of equilibrium has been reached again with regards to the first and second status. The state of equilibrium is reached, when the values of the totals portion and the changer counter vectors of multiple status (e.g., SI, S2) are equal.
FIG. 4 shows details of a first, second and third status (SI, S2, S3) over time in a specific example with three changers. The first, second and third status
(SI, S2, S3) correspond to a first, second and third changer (Cl, C2, C3) . In the example of FIG. 4 some
messages are received in an order that is different from the order they are sent. In the example, the modification history is implemented as a changer counter vector CCV that includes a changer counter for each changer (CCVI, CCV2, CCV3) . Time stamps can be used instead.
At time point t0', the first, second and third status SI, S2, S3 are in a state of equilibrium. In other words, the values of the totals portion and the changer counter vectors of each status are equal.
At tl', the second changer C2 becomes the modifying changer. The corresponding modification M indicates that two items are removed from stock (DP=- 2) . Therefore, the totals value in the totals portion TP of S2 is reduced by two (TP=13-2=11) . The modification history is changed to reflect that the second changer C2 has changed the data set. The result is S2/tl' = (-2, 11, 0,1,0) . A message that includes S2/tl' is sent to the further changers (e.g., the first changer Cl and the third changer C3) .
At t2 ' , the first changer Cl becomes the modifying changer. The corresponding modification M indicates that three items are added to the stock (DP=+3) . The modification history is changed to reflect that the first changer Cl has changed the data set. The result is, Sl/t2 '= (+3, 16, 1, 0, 0) . A message that includes Sl/t2 ' is sent to the further changers.
At t3 ' , the second changer C2 becomes the modifying changer again. The corresponding modification M indicates that seven items are removed from stock. The modification history is changed to reflect that the second changer C2 has changed the data set. The result is, S2/t3 ' = (-7,4, 0,2,0) . A message that includes S2/t3 ' is sent to the further changers.
At t4 ' , the message that includes S2/tl' is received by the computer of the first changer. Comparing the modification history of S2/tl' with Sl/t2 ' (current SI) leads to an update U of S2 according to rule R2 (cf . FIG. 2B) . The result is Sl/t4'=(-2,14, 1,1,0) .
At t5 ' , the message that includes Sl/t2 ' is received by the computer of the second changer. Comparing the modification history of Sl/t2 ' with S2/t3' (current S2) leads to an update U of S2 according to rule R2 (cf . FIG. 2B) . The result is
At t6 ' , the first changer Cl becomes the modifying changer again. The corresponding modification M indicates that three items are removed from stock. The modification history is changed to reflect that the first changer Cl has changed the data set. The result is Sl/t6 ' = (-3, 11,2,1, 0) . A message that includes Sl/t6 ' is sent to the further changers. At t7', the message that includes Sl/t6' is received by the computer of the second changer. Comparing the modification history of Sl/t6 ' with S2/t5' (current S2) leads to an update U of S2 according to rule R2 (cf . FIG. 2B) . The result is S2/t7'=(-3,4,2,2,0) .
At t8', the message that includes S2/t3' is received by the computer of the first changer. Comparing the modification history of Sl/t6' (current SI) with S2/t3' leads to an update U of SI according to rule R2. The result is Sl/t8 ' = (-7, 4, 2, 2, 0) .
Substantially simultaneously the message that includes Sl/t6 ' is received by the computer of the third changer. Comparing the modification history of Sl/t6' with S3/t0' (current S3) indicates that Sl/t6 ' is younger than S3/t0' with respect to the first and
second changers Cl, C2 and coeval with respect to the third changer C3. Therefore, rule Rl is applied to update U the third status S3. That is, the totals value of Sl/t6 ' is copied to the totals value of S3/t8' and the modification history of S3/t8' is updated with the modification history of Sl/t6 ' . The result of the update is S3/t8 '= (-3, 11,2, 1, 0) .
At t9', the message that includes S2/tl' is received by the computer of the third changer. Comparing the modification history of S2/tl' with S3/t8' (current S3) leads to an update U of S3 according to rule R2. The result is S3/t8'=(-7,4,2,2,0) . At this time SI, S2 and S3 already have reached a state of equilibrium although two messages including S2/tl' and Sl/t2' are still outstanding. The corresponding information was implicitly included in the messages already received by the computer of the third changer.
At tlO' and til' the computer of the third changer receives the outstanding messages. However, they are ignored and don't lead to any update according to rules Rl or R2 because none of the corresponding conditions with respect to the modification history is fulfilled.
The invention can be implemented in digital electronic circuitry, or in computer hardware, firmware, software, or in combinations of them. The invention can be implemented as a computer program product, i.e., a computer program tangibly embodied in an information carrier, e.g., in a machine-readable storage device or in a propagated signal, for execution by, or to control the operation of, data processing apparatus, e.g., a programmable processor, a computer, or multiple computers . A computer program can be written in any form of programming language, including
compiled or interpreted languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment . A computer program can be deployed to be executed on one computer or on multiple computers at one site or distributed across multiple sites and interconnected by a communication network.
Method steps of the invention can be performed by one or more programmable processors executing a computer program to perform functions of the invention by operating on input data and generating output . Method steps can also be performed by, and apparatus of the invention can be implemented as, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit) .
Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read-only memory or a random access memory or both. The essential elements of a computer are at least one processor for executing instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks . Information carriers suitable for embodying computer program instructions and data include all forms of non-volatile memory, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic
disks, e.g., internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The processor and the memory can be supplemented by, or incorporated in special purpose logic circuitry. To provide for interaction with a user, the invention can be implemented on a computer having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input.
The invention can be implemented in a computing system that includes a back-end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the invention, or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network ("LAN") and a wide area network ( "WAN" ) , e.g., the Internet .
The computing system can include clients and servers . A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and
server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.