An accumulated data updating method and device, electronic equipment and storage medium

By differentiating event types into priority indicators and employing idempotency and database consistency mechanisms, the accuracy and consistency issues of interactive event data in online live streaming platforms have been resolved, ensuring system performance and data integrity.

CN117033401BActive Publication Date: 2026-07-28BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2023-08-21
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

When processing interactive event data, online live streaming platforms are limited by network stability and data throughput, making it difficult to guarantee the accuracy and consistency of the data. In particular, statistical anomalies in paid interactive event data cause trouble for both broadcasters and viewers.

Method used

By categorizing data according to event type, minor indicator data is allowed to be repeatedly accumulated, while major indicator data is temporarily stored in a queue and processed periodically. By utilizing idempotency mechanisms and the atomicity consistency mechanism of the database, data accuracy and consistency are ensured.

Benefits of technology

While ensuring system performance, the accuracy and consistency of key indicator data were achieved, and the data loss problem caused by network jitter was solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117033401B_ABST
    Figure CN117033401B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a cumulative data updating method and device, electronic equipment and storage medium. The method comprises: obtaining an event message based on a trigger event; determining the data category according to the event message; generating first data cumulative information according to the event message in response to the first data category; updating the event message staging queue according to the event message in response to the second data category, and writing into the database; periodically obtaining the event message staging data within a preset time period, reading the corresponding event message, and generating second data cumulative information; and updating the cumulative data of the corresponding event type according to the first data cumulative information and the second data cumulative information. Through the method, the accuracy and consistency of the heavy index data accumulation can be ensured while ensuring the system performance, and the problem of data loss caused by network jitter is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a method, apparatus, electronic device, and storage medium for updating cumulative data. Background Technology

[0002] With the rapid development of the video industry, live streaming has become a popular form of entertainment. To enhance interaction between streamers and viewers, live streaming platforms typically offer various interactive communication methods. These include liking posts, posting comments, sending gifts, and participating in ranking competitions. To allow both streamers and viewers to more intuitively experience real-time interactions, live streaming platforms often provide statistical analysis and display of these interactive events.

[0003] However, due to the massive data traffic generated by live streaming platforms, the accuracy and consistency of accumulated data for related interactive events cannot be guaranteed due to limitations in network stability and data throughput. In particular, for paid interactive events such as gift-giving and ranking battles, statistical anomalies in related interactive event data frequently cause confusion for both streamers and viewers, becoming a pressing issue that needs to be addressed in the online live streaming industry. Summary of the Invention

[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for updating cumulative data. The method differentiates events of different data categories based on the data category to which the event type belongs, thereby ensuring the accuracy and consistency of statistical data for important events.

[0005] According to a first aspect of the present disclosure, a cumulative data update method is provided, comprising: acquiring an event message based on a triggering event; the event message including at least: an event identifier, an event type, and an event time; determining a data category according to the event message; the data category including at least a first data category and a second data category; generating first data cumulative information according to the first event message in response to a first event message belonging to the first data category; the first data cumulative information corresponding to the event type of the first event message; updating an event message temporary storage queue according to the second event message in response to a second event message belonging to the second data category, and writing the second event message into a database; periodically acquiring event message temporary storage data within a preset time period from the event message temporary storage queue; reading the second event message from the database according to the event message temporary storage data, and generating second data cumulative information; the second data cumulative information corresponding to the event type of the second event message; and updating the cumulative data of the corresponding event type according to the first data cumulative information and the second data cumulative information.

[0006] In some exemplary embodiments of this disclosure, generating first data accumulation information based on the first event message includes: configuring a first idempotency identifier for the first event message; performing a marking operation on the first event message based on the first idempotency identifier; in response to the successful marking operation, incrementing the cumulative data of the event type corresponding to the first event message once to generate the first data accumulation information; and in response to the failed marking operation, modifying the first idempotency identifier and re-marking the first event message based on the modified first idempotency identifier.

[0007] In some exemplary embodiments of this disclosure, the step of modifying the first idempotency identifier and re-marking the first event message based on the modified first idempotency identifier includes: determining whether the first idempotency identifier has reached a modification count threshold; in response to the first idempotency identifier not reaching the modification count threshold, modifying the first idempotency identifier and re-marking the first event message based on the modified first idempotency identifier; and in response to the first idempotency identifier reaching the modification count threshold, abandoning the marking operation on the first event message.

[0008] In some exemplary embodiments of this disclosure, updating the event message temporary storage queue according to the second event message and writing the second event message into the database includes: configuring a second idempotent flag for the second event message; performing a marking operation on the second event message according to the second idempotent flag; updating the event message temporary storage queue according to the second event message and writing the second event message into the database in response to the successful marking operation; and repeating the above steps in response to the failed marking operation until the marking operation of the second event message is successful.

[0009] In some exemplary embodiments of this disclosure, the event message temporary storage queue uses a key-value pair composed of the event identifier and the event time of the second event message as the event message temporary storage data.

[0010] In some exemplary embodiments of this disclosure, the periodic acquisition of event message temporary data within a preset time period from the event message temporary storage queue; reading the second event message from the database based on the event message temporary storage data, and generating second data accumulation information includes: periodically acquiring the event message temporary data within a preset time period from the event message temporary storage queue; the event time corresponding to the event message temporary storage data is located within the preset time period; reading the second event message from the database based on the event message temporary storage data; generating the second data accumulation information based on the second event message; the second data accumulation information is used to represent the cumulative number of times the corresponding event type is generated within the preset time period; in response to successful generation of the second data accumulation information, deleting the event message temporary data from the event message temporary storage queue; in response to failure to generate the second data accumulation information, adding the current preset time period to the next preset time period.

[0011] In some exemplary embodiments of this disclosure, determining the data category to which the event message belongs based on the event message includes: determining the data category to which the event message belongs based on a pre-defined correspondence between the event type and the data category.

[0012] According to a second aspect of the present disclosure, a cumulative data update apparatus is provided, comprising: an event message acquisition module configured to acquire an event message based on a triggering event; the event message including at least: an event identifier, an event type, and an event time; a data category determination module configured to determine a data category to which the event message belongs; the data category including at least a first data category and a second data category; a first data category processing module configured to generate first data accumulation information based on the first event message in response to the first event message belonging to the first data category; the first data accumulation information corresponding to the event type of the first event message; and a second data category processing module. The first event message is configured to update the event message temporary storage queue and write the second event message to the database in response to the second event message belonging to the second data category. The second event message is configured to periodically retrieve event message temporary storage data within a preset time period from the event message temporary storage queue; read the second event message from the database based on the event message temporary storage data; and generate second data accumulation information; the second data accumulation information corresponds to the event type of the second event message. The third event message is configured to update the cumulative data of the corresponding event type based on the first data accumulation information and the second data accumulation information.

[0013] According to a third aspect of the present disclosure, an electronic device is provided, characterized in that it includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the executable instructions to implement any of the cumulative data update methods described in the present disclosure.

[0014] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided such that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform any of the cumulative data update methods described in the present disclosure.

[0015] The cumulative data update method provided in this disclosure performs differentiated cumulative processing on event messages for different triggering events based on the event type. For event messages containing minor metrics, repeated accumulation is allowed while ensuring system performance. For event messages containing major metrics, they are first temporarily stored in an event message queue and then accumulated periodically. This method ensures both system performance and the accuracy and consistency of accumulated major metrics, resolving the data loss problem caused by network jitter.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0018] Figure 1 A schematic diagram of an exemplary system architecture to which the methods of embodiments of this disclosure can be applied is shown.

[0019] Figure 2 This is a flowchart illustrating a cumulative data update method according to an exemplary embodiment.

[0020] Figure 3 This is a flowchart illustrating a first data category processing method as shown in an example.

[0021] Figure 4 This is a flowchart illustrating a second data category processing method as shown in an example.

[0022] Figure 5 This is a flowchart illustrating a timed accumulation method.

[0023] Figure 6 This is a block diagram illustrating an accumulated data update apparatus according to an exemplary embodiment.

[0024] Figure 7 This is a schematic diagram illustrating the structure of an electronic device suitable for implementing exemplary embodiments of the present disclosure, according to an exemplary embodiment. Detailed Implementation

[0025] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.

[0026] The features, structures, or characteristics described in this disclosure can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more specific details omitted, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0027] The accompanying drawings are merely illustrative of this disclosure, and the same reference numerals in the drawings denote the same or similar parts, thus omitting repeated descriptions of them. Some block diagrams shown in the drawings do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in at least one hardware module or integrated circuit, or in different network and / or processor devices and / or microcontroller devices.

[0028] The flowchart shown in the accompanying drawings is merely illustrative and does not necessarily include all content and steps, nor does it require execution in the described order. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0029] In this specification, the terms “a,” “an,” “the,” “the,” and “at least one” are used to indicate the presence of at least one element / component / etc.; the terms “comprising,” “including,” and “having” are used to indicate an open-ended inclusion and to mean that there may be other elements / components / etc. in addition to the listed elements / components / etc.; the terms “first,” “second,” and “third,” etc., are used only as markings and are not a limitation on the number of objects.

[0030] Figure 1 A schematic diagram of an exemplary system architecture to which the methods of embodiments of this disclosure can be applied is shown.

[0031] like Figure 1 As shown, the system architecture may include server 101, network 102, terminal device 103, terminal device 104, and terminal device 105. Network 102 serves as the medium for providing a communication link between terminal device 103, terminal device 104, or terminal device 105 and server 101. Network 102 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0032] Server 101 can be a server that provides various services, such as a back-end management server that supports the devices operated by users using terminal devices 103, 104, or 105. The back-end management server can analyze and process received requests and other data, and feed back the processing results to terminal devices 103, 104, or 105.

[0033] Terminal devices 103, 104, and 105 can be smartphones, tablets, laptops, desktop computers, smart speakers, wearable smart devices, virtual reality devices, augmented reality devices, etc., but are not limited to these.

[0034] It should be understood that Figure 1 The number of terminal devices 103, 104, 105, network 102, and server 101 in the diagram is merely illustrative. Server 101 can be a single physical server, a server cluster consisting of multiple servers, or a cloud server. Depending on actual needs, it can have any number of terminal devices, networks, and servers.

[0035] The steps of the method in the exemplary embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings and examples.

[0036] Figure 2 This is a flowchart illustrating a cumulative data update method according to an exemplary embodiment. Figure 2 The method provided in the embodiments can be executed by any electronic device, such as those described above. Figure 1 Terminal devices in or Figure 1 The server in, or Figure 1 The terminal devices and servers in the process are executed together, but this disclosure does not limit this.

[0037] In step S210, an event message based on the triggering event is obtained; the event message includes at least: event identifier, event type, and event time.

[0038] In this embodiment of the disclosure, various triggering events occur in a live streaming scenario, such as liking, commenting, sending gifts, and participating in ranking competitions. These triggering events are generally initiated by viewers during the interaction between the streamer and the audience. Furthermore, a large number of similar triggering events exist during a live stream, requiring cumulative data statistics. Due to the excessive traffic generated by these triggering events, traffic filtering is generally required before converting them into corresponding event messages for writing into the database for subsequent statistical processing.

[0039] In this embodiment of the disclosure, the event message includes at least: an event identifier, an event type, and an event time. The event identifier is a unique identifier representing the triggered event. The event type indicates the type of the triggered event, such as liking, posting a comment, sending a gift, or participating in a ranking competition. The event time indicates the trigger time of the triggered event.

[0040] In an exemplary embodiment, the event message may further include: a user identifier and a live stream identifier. The user identifier is used to represent the identifier information of the viewer who triggered the event. The live stream identifier is used to represent the live stream information to which the event is triggered.

[0041] In step S220, the data category to which the event belongs is determined based on the event message; the data category includes at least a first data category and a second data category.

[0042] In the context of live streaming, among various triggering events, non-paid triggering events such as liking and commenting generally do not affect user experience if there are discrepancies in the accumulated data. However, for paid triggering events such as gifting and PK ranking, the accuracy and consistency of the relevant accumulated data are particularly important because they involve user assets.

[0043] In this embodiment of the disclosure, based on the characteristics of the aforementioned live streaming scenario, we determine the data category according to the event type information in the event message. The data category includes at least a first data category and a second data category. The first data category corresponds to non-paid trigger events such as likes and comments, belonging to light-indicator data, allowing for repeated accumulation of this type of data. The second data category corresponds to paid trigger events such as gift-giving and ranking competitions, belonging to heavy-indicator data, ensuring the accuracy and consistency of this type of data. Based on this, we subsequently implement differentiated data processing procedures according to the data category to which the event message belongs, ensuring the accuracy and consistency of heavy-indicator data while maintaining overall data processing efficiency.

[0044] It should be noted that with the development of the online live streaming industry and the needs of live streaming scenarios, the types of triggering events involved are not limited to the aforementioned likes, comments, gifts, and PK rankings, but may also include other forms of triggering event types. Any differentiated methods adopted by developers for accumulating relevant data based on different triggering event types should be considered within the scope of protection of this disclosure.

[0045] In this embodiment, the relationship between the event type and the data category is determined based on a pre-defined correspondence. Depending on the business scenario, this correspondence can be flexibly configured, allowing for free switching of the cumulative data statistics method used for triggering different event types.

[0046] In step S230, in response to the first event message belonging to the first data category, first data accumulation information is generated based on the first event message; the first data accumulation information corresponds to the event type of the first event message.

[0047] In this embodiment of the disclosure, for a first data category belonging to the light indicator category, the corresponding first data accumulation information is accumulated according to the event type in the event message to generate accumulated first data accumulation information. This first data accumulation information corresponds to the event type.

[0048] In an exemplary embodiment, 20 like event messages and 5 comment event messages are acquired within a certain time period. Both the like event messages and comment event messages belong to the first data category. According to step S230, the cumulative first data information corresponding to the like event type is incremented by 20, and the cumulative first data information corresponding to the comment event type is incremented by 5. For example, if the original cumulative data corresponding to the like event type is 23450, and the original cumulative data corresponding to the comment event type is 650, after the above accumulation, the cumulative data corresponding to the like event type is 23470, and the cumulative data corresponding to the comment event type is 655.

[0049] In step S240, in response to the second event message belonging to the second data category, the event message temporary storage queue is updated according to the second event message, and the second event message is written to the database.

[0050] In this embodiment of the disclosure, for the second data category belonging to the heavy indicator data, to ensure the accuracy and consistency of the cumulative data for this data category, the event message is not directly accumulated. Instead, the event message temporary storage queue is updated according to the second event message, and the second event message is written to the database.

[0051] This event message temporary storage queue is a temporary storage queue for event messages of the second data category. In this queue, event messages are temporarily stored as event message temporary data. In an exemplary embodiment, key-value pairs based on the event identifier and event time of the second event message are used as the event message temporary data. A key-value pair is a data structure that stores a correspondence between a key and a value. In this embodiment, key-value pairs with the event identifier as the key and the event time as the value can be used as event message temporary data and temporarily stored in the event message temporary storage queue. Specifically, this event message temporary storage queue can be implemented using an ordered set (Zset) in a Redis (Remote Dictionary Server) database.

[0052] This database is used to store the complete data message of the second event message. Specifically, a MySQL database can be used to implement this database function to store the complete data message of the second event message. Since MySQL is a relational database management system, it provides its own business guarantee mechanisms for the atomicity and consistency of events, ensuring the integrity and consistency of related event messages.

[0053] In step S250, event message temporary data within a preset time period is periodically retrieved from the event message temporary storage queue; based on the event message temporary storage data, the second event message in the database is read, and second data accumulation information is generated; the second data accumulation information corresponds to the event type of the second event message.

[0054] Since the event messages are not directly accumulated in step S240, but are first updated in the event message temporary queue and simultaneously written to the database, a scheduled task is designed in step S250 to perform periodic processing on the relevant data.

[0055] In this embodiment of the disclosure, event message temporary storage data within a preset time period is periodically retrieved from the event message temporary storage queue. This preset time period is determined based on the event time corresponding to the event message temporary storage data. Based on the retrieved event message temporary storage data, the corresponding second event message is read from the database. Specifically, the corresponding second event message can be retrieved from the database based on the event identifier information in the event message temporary storage data. Second data accumulation information is generated based on the read second event message. Similar to the aforementioned first data accumulation information, this second data accumulation information corresponds to the event type of the second event message, and will not be repeated here.

[0056] Because the database itself provides a business assurance mechanism, the integrity and consistency of the second event messages stored in the database are ensured. Therefore, by processing the event messages of the second data category through steps S240 and S250, the accuracy and consistency of the cumulative data for events triggered by key indicators can be ensured.

[0057] In step S260, the cumulative data for the corresponding event type is updated based on the first cumulative data information and the second cumulative data information.

[0058] In this embodiment of the disclosure, based on the first data accumulation information and the second data accumulation information obtained through the aforementioned different processing mechanisms, the cumulative data of the corresponding event type is updated, and the obtained cumulative data of each event type is displayed on the front end.

[0059] The cumulative data update method provided in this disclosure performs differentiated cumulative processing on event messages for different triggering events based on the event type. For event messages containing minor metrics, repeated accumulation is allowed while ensuring system performance. For event messages containing major metrics, they are first temporarily stored in an event message queue and then accumulated periodically. This method ensures both system performance and the accuracy and consistency of accumulated major metrics, resolving the data loss problem caused by network jitter.

[0060] Figure 3 This is a flowchart illustrating a first data category processing method as shown in the example. (For example...) Figure 3 As shown, the aforementioned step S230 may also include the following steps.

[0061] In step S310, a first idempotent flag is configured for the first event message.

[0062] In this embodiment of the disclosure, a first idempotency identifier is configured for each first event message. Idempotency ensures the consistency of the results of one or more requests initiated by the user for the same operation, without causing side effects due to multiple operation requests. This idempotency mechanism is widely used in scenarios such as e-commerce shopping, financial systems, and invoice systems.

[0063] In the exemplary embodiment, we configure a unique idempotency identifier key for each first event message based on the Redis database for use in idempotency verification.

[0064] In step S320, the first event message is marked according to the first idempotent flag.

[0065] In this embodiment of the disclosure, a marking operation is performed on the corresponding first event message based on a first idempotent identifier. This marking operation can determine whether the first event message contains a recurring triggering event.

[0066] In this exemplary embodiment, we implement the marking operation based on the `setNx` command in the Redis database. The `setNx` command is used to perform the marking operation according to the previously configured idempotency flag key. If no duplicate key exists, the marking is returned as successful. If a duplicate key exists, the marking is returned as unsuccessful. This method achieves idempotency verification.

[0067] In step S330, in response to the successful marking operation, the cumulative data of the event type corresponding to the first event message is incremented once to generate the first data accumulation information.

[0068] In this embodiment of the disclosure, if the marking operation is successful, it means that no accumulation operation was performed on the first event message before. Therefore, the cumulative data of the event type corresponding to the first event message is accumulated once to generate the first data accumulation information.

[0069] In step S340, in response to the failure of the marking operation, the first idempotent flag is modified, and the first event message is re-marked based on the modified first idempotent flag.

[0070] In this embodiment of the disclosure, if the marking operation fails, it indicates that the first event message may have undergone an accumulation operation previously or the accumulation operation failed. As mentioned above, since the first event message belongs to the first data category, namely, lightweight indicator data, we prioritize system performance for lightweight indicator data and allow for duplicate accumulation. Therefore, in response to the marking operation failure, the first idempotent flag is modified, and the marking operation in step S320 is re-performed based on the modified first idempotent flag until the marking operation successfully completes the accumulation operation on the first event message.

[0071] In an exemplary embodiment, the first idempotent flag of the first event message is set to idempotent_key. When the marking operation fails, the first idempotent flag is modified to idempotent_key_consumeTimes, where consumeTimes is an offset based on the number of times the first idempotent flag has been modified.

[0072] Through the above method, we modify the first idempotency flag, allowing for repeated accumulation while ensuring overall system performance. However, we do not allow unlimited repeated accumulation. Therefore, based on step S340 above, we further set a modification count threshold to limit the number of times the first idempotency flag can be modified. Specifically, this may include the following steps.

[0073] In step S341, it is determined whether the first idempotent flag has reached the modification count threshold.

[0074] In step S342, in response to the first idempotency flag not reaching the modification threshold, the first idempotency flag is modified, and the first event message is re-marked based on the modified first idempotency flag;

[0075] In step S343, in response to the first idempotent flag reaching the modification count threshold, the marking operation on the first event message is abandoned.

[0076] In this embodiment of the disclosure, the first idempotent flag can be modified within the allowed modification count threshold, and repeated accumulation operations are allowed. However, when the modification count exceeds the modification count threshold, the marking operation on the first event message is abandoned, that is, the accumulation of the first event message is abandoned.

[0077] In this embodiment, an implementation scheme is provided for the cumulative statistics of lightweight indicator data through an idempotent mechanism. This method allows for repeated accumulation of lightweight indicator data, thereby ensuring overall system performance. Simultaneously, by setting a threshold for the number of modifications, the number of times event messages are repeatedly accumulated is limited, ensuring that the final cumulative data does not have significant deviations.

[0078] Figure 4 This is a flowchart illustrating a second data category processing method as shown in the example. For example... Figure 4 As shown, the aforementioned step S240 may also include the following steps.

[0079] In step S410, a second idempotent flag is configured for the second event message.

[0080] In this embodiment of the disclosure, a second idempotency identifier is configured for each second event message. Here, the second idempotency identifier is similar to the first idempotency identifier in the aforementioned step S310, and will not be described again here.

[0081] In step S420, the second event message is marked according to the second idempotency identifier.

[0082] In this embodiment of the disclosure, a marking operation is performed on the corresponding second event message based on the second idempotency identifier. This marking operation determines whether the second event message contains a recurring triggering event. The relevant marking operation is similar to the aforementioned step S320 and will not be described again here.

[0083] In step S430, in response to the successful marking operation, the event message temporary queue is updated according to the second event message, and the second event message is written to the database.

[0084] In this embodiment of the disclosure, in response to the successful marking operation, the event message temporary storage queue is updated according to the second event message, and the second event message is written to the database.

[0085] For this event message temporary storage queue, key-value pairs consisting of the event identifier and event time of the second event message are used as the temporary data for the event message. In this embodiment, key-value pairs consisting of the event identifier as the key and the event time as the value can be used as the temporary data for the event message and temporarily stored in the event message temporary storage queue. Specifically, this event message temporary storage queue can be implemented using an ordered set (Zset) in a Redis database.

[0086] This database is used to store the complete data message of the second event message. Specifically, a MySQL database can be used to implement this database function to store the complete data message of the second event message. Since MySQL is a relational database management system, it provides its own business guarantee mechanisms for the atomicity and consistency of events, ensuring the integrity and consistency of related event messages.

[0087] In an exemplary embodiment, the update event message temporary queue operation and the database writing can be performed idempotently based on a unified marking operation, or they can be performed separately using independent marking operations. Regardless of the idempotency verification method used, both should be considered within the scope of protection of this disclosure.

[0088] In step S440, in response to the failure of the marking operation, the above steps are repeated until the marking operation of the second event message is successful.

[0089] In this embodiment of the disclosure, in response to the failure of the marking operation, the above steps S420 and S430 are repeated until the marking operation of the second event message is successful.

[0090] In this embodiment, the second event message belongs to the second data category, namely, heavy indicator data. Unlike light indicator data, heavy indicator data cannot be repeatedly accumulated; the accuracy and consistency of the accumulated data must be ensured. Therefore, in the second data category processing method of this embodiment, the idempotency flag is not modified; instead, a strict idempotency verification process is adopted. Moreover, after the marking operation is successful, the event message is not directly accumulated; instead, it is first updated in the event message temporary storage queue and simultaneously written to the database. Since the database itself provides a business guarantee mechanism for the atomicity and consistency of events, the integrity and consistency of the relevant event messages are ensured.

[0091] Figure 5 This is a flowchart illustrating a timed accumulation method. For example... Figure 5 As shown, the aforementioned step S250 may further include the following steps.

[0092] In step S510, the event message temporary storage data within a preset time period is periodically retrieved from the event message temporary storage queue; the event time corresponding to the event message temporary storage data is located within the preset time period.

[0093] In this embodiment of the disclosure, event message temporary storage data within a preset time period is periodically retrieved from the event message temporary storage queue. This preset time period is determined based on the event time corresponding to the event message temporary storage data. When the event time corresponding to the event message temporary storage data falls within the preset time period, the event message temporary storage data is retrieved.

[0094] In an exemplary embodiment, the time period is synchronized with a preset time period. For example, if the time period is set to 2 seconds, meaning that timed cumulative data aggregation is performed every 2 seconds, then the preset time period is the 2-second time window before data aggregation.

[0095] In an exemplary embodiment, the time period is not synchronized with the preset time period. For example, the time period is set to 2 seconds, meaning that timed cumulative data aggregation is performed every 2 seconds. The preset time period is the window from the deadline of the last successful data aggregation to the current time.

[0096] In an exemplary embodiment, the acquired event message temporary data includes: an event identifier and an event time. In addition, the event message temporary data may also include: a user identifier and a live stream identifier. The user identifier represents the identifier information of the viewer who triggered the event. The live stream identifier represents the live stream information to which the triggered event belongs.

[0097] In step S520, the second event message is read from the database based on the event message temporary storage data.

[0098] In this embodiment of the disclosure, the event message temporary storage data only includes identification information related to the event message and does not include the complete data message of the event message. Therefore, it is necessary to read the complete data message of the corresponding second event message from the database based on the event message temporary storage data.

[0099] In an exemplary embodiment, the event message temporary storage queue is implemented using a sorted set (Zset) in a Redis database. A MySQL database is used to implement the database function, storing the complete data message of the second event message. Based on the event message temporary storage data obtained in step S510, the Redis database reads the corresponding complete data message from the MySQL database according to the relevant data.

[0100] In step S530, the second data accumulation information is generated based on the second event message; the second data accumulation information is used to represent the cumulative number of times the corresponding event type is within the preset time period.

[0101] In this embodiment of the disclosure, based on the complete data message of the second event message within a preset time period read from the database, the data within the preset time period is aggregated and calculated to obtain the cumulative number of event messages corresponding to each event type, and the corresponding second data cumulative information is generated.

[0102] In the exemplary embodiment, after the aggregation calculations described above, a total of 10 gift-giving event messages and 8 PK ranking event messages are recorded within the preset time period in the event message temporary storage queue. Therefore, the second data accumulation information corresponding to the gift-giving event type is 10, and the second data accumulation information corresponding to the PK ranking event type is 8.

[0103] In an exemplary embodiment, aggregation calculations can also be performed based on user identifiers in the event messages. For example, within a preset time period in the event message temporary storage queue, a total of 2 event messages for user 1 and 3 event messages for user 2 are recorded. Based on the user identifiers corresponding to the event messages, 10 complete event messages for user 1 (including 8 historical records and 2 new records) and 8 complete event messages for user 2 (including 5 historical records and 3 new records) are retrieved from the database. Based on the complete data messages for user 1 and user 2 retrieved from the database, corresponding second data accumulation information is generated.

[0104] In step S540, in response to the successful generation of the second data accumulation information, the event message temporary data is deleted from the event message temporary queue.

[0105] In this embodiment of the disclosure, in response to the successful generation of the second data accumulation information, it indicates that the corresponding event message has been counted in the cumulative data. Therefore, the corresponding event message temporary data is deleted from the event message temporary storage queue to ensure that related event messages are not counted repeatedly.

[0106] In step S550, in response to the failure to generate the second data accumulation information, the current preset time period is added to the next preset time period.

[0107] In this embodiment of the disclosure, if the generation of the second data accumulation information fails, it indicates that the corresponding event message has not been included in the cumulative data. Therefore, the current preset time period is added to the next preset time period so that the event messages that were not counted this time can be counted in the next aggregation calculation, ensuring the accuracy and consistency of the cumulative data.

[0108] In an exemplary embodiment, the time period is set to 2 seconds, and the current preset time period is a 2-second time window before data aggregation. In response to the failure to generate the second data accumulation information, the current preset time period is added to the next preset time period, i.e., the next preset time period is adjusted to a 4-second time window before data aggregation.

[0109] In this embodiment, event messages containing key metrics are not directly accumulated. Instead, an idempotent mechanism is used to temporarily store the event messages in an event message queue, while simultaneously storing them in the database. The database's built-in business guarantee mechanism ensures the integrity and consistency of the relevant event messages. Then, the event messages temporarily stored in the event message queue are periodically aggregated and accumulated to ensure the accuracy and consistency of the accumulated key metrics data, thus resolving the data loss issue caused by network jitter.

[0110] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.

[0111] Figure 6 This is a block diagram illustrating an accumulated data update apparatus according to an exemplary embodiment. (Refer to...) Figure 6 The device 600 may include: an event message acquisition module 610, a data category determination module 620, a first data category processing module 630, a second data category processing module 640, a timed accumulation module 650, and an accumulated data update module 660.

[0112] The event message acquisition module 610 is configured to acquire event messages based on a triggered event; the event message includes at least: an event identifier, an event type, and an event time;

[0113] The data category determination module 620 is configured to determine the data category to which the event message belongs; the data category includes at least a first data category and a second data category;

[0114] The first data category processing module 630 is configured to generate first data accumulation information based on the first event message in response to the first event message belonging to the first data category; the first data accumulation information corresponds to the event type of the first event message.

[0115] The second data category processing module 640 is configured to update the event message temporary storage queue according to the second event message and write the second event message into the database in response to the second event message belonging to the second data category;

[0116] The timed accumulation module 650 is configured to periodically retrieve event message temporary data within a preset time period from the event message temporary storage queue; based on the event message temporary storage data, read the second event message from the database and generate second data accumulation information; the second data accumulation information corresponds to the event type of the second event message;

[0117] The cumulative data update module 660 is configured to update the cumulative data of the corresponding event type based on the first cumulative data information and the second cumulative data information.

[0118] In some exemplary embodiments of this disclosure, the first data category processing module 630 is configured to configure a first idempotency identifier for the first event message; perform a marking operation on the first event message according to the first idempotency identifier; in response to the successful marking operation, increment the cumulative data of the event type corresponding to the first event message once to generate the first data accumulation information; in response to the failed marking operation, modify the first idempotency identifier, and re-mark the first event message based on the modified first idempotency identifier.

[0119] In some exemplary embodiments of this disclosure, the first data category processing module 630 is configured to modify the first idempotency identifier and re-mark the first event message based on the modified first idempotency identifier, including: determining whether the first idempotency identifier has reached a modification count threshold; in response to the first idempotency identifier not reaching the modification count threshold, modifying the first idempotency identifier and re-marking the first event message based on the modified first idempotency identifier; and in response to the first idempotency identifier reaching the modification count threshold, abandoning the marking operation on the first event message.

[0120] In some exemplary embodiments of this disclosure, the second data category processing module 640 is configured to configure a second idempotency identifier for the second event message; perform a marking operation on the second event message according to the second idempotency identifier; in response to the successful marking operation, update the event message temporary storage queue according to the second event message and write the second event message into the database; in response to the failed marking operation, repeat the above steps until the marking operation of the second event message is successful.

[0121] In some exemplary embodiments of this disclosure, the second data category processing module 640 is configured as the event message temporary storage queue, and the key-value pair formed by the event identifier and the event time of the second event message is used as the event message temporary storage data.

[0122] In some exemplary embodiments of this disclosure, the timing accumulation module 650 is configured to periodically retrieve event message temporary data within a preset time period from the event message temporary storage queue; the event time corresponding to the event message temporary storage data is located within the preset time period; based on the event message temporary storage data, read the second event message from the database; based on the second event message, generate second data accumulation information; the second data accumulation information is used to represent the cumulative number of times the corresponding event type is generated within the preset time period; in response to successful generation of the second data accumulation information, delete the event message temporary data from the event message temporary storage queue; in response to failure to generate the second data accumulation information, add the current preset time period to the next preset time period.

[0123] In some exemplary embodiments of this disclosure, the data category determination module 620 is configured to determine the data category to which the event message belongs based on a pre-defined correspondence between the event type and the data category.

[0124] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0125] The following reference Figure 7 To describe an electronic device 700 according to such an embodiment of the present disclosure. Figure 7 The electronic device 700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0126] like Figure 7As shown, the electronic device 700 is manifested in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including storage unit 720 and processing unit 710), and a display unit 740.

[0127] The storage unit stores program code, which can be executed by the processing unit 710 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 710 can perform actions such as... Figure 2 The steps shown.

[0128] For example, electronic devices can achieve such Figure 2 The steps shown.

[0129] Storage unit 720 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 721 and / or cache memory 722, and may further include a read-only memory (ROM) 723.

[0130] The storage unit 720 may also include a program / utility 724 having a set (at least one) of program modules 725, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0131] Bus 730 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0132] Electronic device 700 can also communicate with one or more external devices 770 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 750. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 760. As shown, network adapter 760 communicates with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0133] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0134] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions that can be executed by a processor of the device to perform the described method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0135] In an exemplary embodiment, a computer program product is also provided, including a computer program / instructions that, when executed by a processor, implement the methods described above.

[0136] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0137] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A cumulative data update method, characterized in that, include: Retrieve event messages based on the triggered event; The event message shall include at least: event identifier, event type, and event time; Based on the event message, the data category to which it belongs is determined; the data category includes at least a first data category and a second data category; In response to the first event message belonging to a first data category, first data accumulation information is generated based on the first event message; the first data accumulation information corresponds to the event type of the first event message. In response to the second event message belonging to the second data category, the event message temporary storage queue is updated according to the second event message, and the second event message is written to the database; Periodically retrieve event message temporary data within a preset time period from the event message temporary storage queue; based on the event message temporary storage data, read the second event message from the database and generate second data accumulation information; the second data accumulation information corresponds to the event type of the second event message; Based on the first and second data accumulation information, the cumulative data for the corresponding event types is updated; The step of generating the first data accumulation information based on the first event message includes: Configure a first idempotent flag for the first event message; The first event message is marked according to the first idempotent identifier; In response to the successful marking operation, the cumulative data of the event type corresponding to the first event message is incremented once to generate the first data accumulation information; In response to the failure of the marking operation, the first idempotent flag is modified, and the first event message is re-marked based on the modified first idempotent flag; The step of modifying the first idempotency identifier and re-marking the first event message based on the modified first idempotency identifier includes: Determine whether the first idempotent flag has reached the modification threshold; In response to the first idempotency flag not reaching the modification threshold, the first idempotency flag is modified, and the first event message is re-marked based on the modified first idempotency flag; In response to the first idempotent flag reaching the modification count threshold, the marking operation on the first event message is abandoned.

2. The method according to claim 1, characterized in that, The step of updating the event message temporary storage queue according to the second event message and writing the second event message into the database includes: Configure a second idempotent flag for the second event message; The second event message is marked according to the second idempotency identifier; In response to the successful marking operation, the event message queue is updated according to the second event message, and the second event message is written to the database; If the marking operation fails, repeat the above steps until the marking operation of the second event message succeeds.

3. The method according to claim 1, characterized in that, include: The event message temporary storage queue uses key-value pairs formed by the event identifier and event time of the second event message as the event message temporary storage data.

4. The method according to claim 1, characterized in that, The periodic timer retrieves event message temporary data within a preset time period from the event message temporary storage queue; Based on the event message temporary data, the second event message is read from the database, and second data accumulation information is generated, including: Periodically retrieve event message temporary data within a preset time period from the event message temporary storage queue; the event time corresponding to the event message temporary storage data is located within the preset time period. Based on the event message temporary data, read the second event message from the database; Based on the second event message, the second data accumulation information is generated; the second data accumulation information is used to represent the cumulative number of times the corresponding event type is within the preset time period; Upon successful generation of the second data accumulation information, the event message temporary data is deleted from the event message temporary queue. In response to the failure to generate the second data accumulation information, the current preset time period is added to the next preset time period.

5. The method according to claim 1, characterized in that, The step of determining the data category based on the event message includes: The data category to which the event message belongs is determined based on the pre-defined correspondence between the event type and the data category.

6. A cumulative data update device, characterized in that, include: The event message acquisition module is configured to acquire event messages based on the triggered event; The event message shall include at least: event identifier, event type, and event time; The data category determination module is configured to determine the data category to which the event message belongs; the data category includes at least a first data category and a second data category; The first data category processing module is configured to generate first data accumulation information based on the first event message in response to the first event message belonging to the first data category; the first data accumulation information corresponds to the event type of the first event message. The second data category processing module is configured to update the event message temporary storage queue according to the second event message and write the second event message into the database in response to the second event message belonging to the second data category; The timed accumulation module is configured to periodically retrieve event message temporary data within a preset time period from the event message temporary storage queue; based on the event message temporary storage data, read the second event message from the database and generate second data accumulation information; the second data accumulation information corresponds to the event type of the second event message; The cumulative data update module is configured to update the cumulative data of the corresponding event type based on the first cumulative data information and the second cumulative data information; The first data category processing module is further configured to configure a first idempotency identifier for the first event message; perform a marking operation on the first event message according to the first idempotency identifier; in response to the successful marking operation, increment the cumulative data of the event type corresponding to the first event message once to generate the first data accumulation information; in response to the failed marking operation, modify the first idempotency identifier, and re-mark the first event message based on the modified first idempotency identifier. The first data category processing module is further configured to determine whether the first idempotency identifier has reached the modification count threshold; in response to the first idempotency identifier not reaching the modification count threshold, modify the first idempotency identifier and re-mark the first event message based on the modified first idempotency identifier; in response to the first idempotency identifier reaching the modification count threshold, abandon the marking operation on the first event message.

7. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the executable instructions to implement the cumulative data update method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the cumulative data update method as described in any one of claims 1 to 5.