Dynamic aggregation value updating method and system, electronic equipment and medium
By adaptively adjusting the push cycle of dynamically aggregated values, the contradiction between update timeliness and resource consumption is resolved, achieving a balance between resource efficiency and user experience in scenarios of different scales.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHUHAI CHENGMI TECH CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies face a contradiction between timely updates and system resource consumption when updating dynamically aggregated values. In particular, the computational and bandwidth overhead is huge in large-scale and frequently changing scenarios, while in small-scale and sparsely changing scenarios, the update delay leads to poor user experience.
The server generates an estimate based on the event size and dynamically aggregated values, and adaptively adjusts the push cycle to be proportional to the square root of the estimate. The push frequency is reduced when the event size is large and increased when the event size is small, so as to achieve a unified optimization of resource efficiency and real-time display.
It enables automatic adjustment of update frequency under different scale scenarios, which not only ensures the timeliness of information but also saves system resources, improving user experience and system efficiency.
Smart Images

Figure CN122053369A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of data processing and network communication, and in particular to a method, system, electronic device, and medium for updating dynamically aggregated numerical values. Background Technology
[0002] In modern web applications, displaying dynamically changing aggregated data to clients in real time is a common requirement. These data could include the number of viewers for a live stream, real-time inventory on an e-commerce platform, likes or shares on social media, the number of editors of an online collaborative document, the real-time number of financial transactions, or the number of online devices in a specific area within the Internet of Things (IoT). Timely and accurate display of these data is crucial for enhancing user experience, creating a conducive learning environment, and even serving as a basis for business decisions.
[0003] Currently, mainstream technical solutions for implementing this function face an inherent contradiction: the timeliness of updates versus the consumption of system resources. For example, in existing technologies, the server broadcasts the latest values to all clients at fixed time intervals (e.g., every 5 seconds). For large-scale and frequently changing "hot" scenarios (such as live broadcasts of top-tier sports events with tens of millions of viewers), high-frequency pushes will generate huge overhead in server computing, storage, and network bandwidth. On the other hand, for smaller-scale and sparsely changing "niche" scenarios, the fixed long period will lead to update delays and poor user experience. Summary of the Invention
[0004] This invention aims to at least solve one of the technical problems existing in the prior art. To this end, this invention proposes a system that can balance the timeliness of system updates with the consumption of system resources.
[0005] A method for updating dynamically aggregated values according to a first aspect embodiment of the present invention includes: Based on the obtained event scale and dynamic aggregated values, the server continuously generates and updates the estimated value of the dynamic aggregated values; The dynamic push cycle is determined based on the estimated value, wherein the dynamic push cycle is adaptively adjusted as the estimated value changes and is proportional to the square root of the estimated value; According to the dynamic push period, the estimated value is periodically pushed from the server to the client.
[0006] The embodiments of the present invention have at least the following beneficial effects: The dynamic aggregated value update method provided by the embodiments of the present invention continuously maintains the estimated value of the dynamically aggregated value on the server side, and calculates an adaptive dynamic push cycle based on the square root relationship of the estimated value, and then pushes the data to the client according to this cycle. By establishing a nonlinear adaptive relationship between the update frequency and the numerical scale, this method can automatically reduce the push frequency when the scale is large to significantly save system computing and bandwidth resources, and increase the push frequency when the scale is small to ensure the timeliness of information updates, thus achieving a unified optimization of resource efficiency and display real-time performance.
[0007] According to some embodiments of the present invention, the step of the server continuously generating and updating the estimated value of the dynamic aggregated value based on the obtained event scale and dynamic aggregated value includes: If the number of events triggered by the server in real time meets the cold start condition, then the estimated value pushed by the server in the past is used as the current estimated value. If the number of events triggered by the server in real time meets the warm start threshold, the estimated value is determined based on the persistent snapshot of the server. If the number of events triggered by the server in real time meets the hot start threshold, the estimated value is determined based on the dynamic aggregated value or real-time snapshot obtained by the server in real time.
[0008] According to some embodiments of the present invention, when the number of events triggered in real time by the server meets the warm start threshold, the step of determining the estimated value of the dynamic aggregated value obtained by the server further includes: When determining the estimated value based on the persistent snapshot, the estimated value is positively adjusted based on a preset ratio.
[0009] According to some embodiments of the present invention, the step of determining the dynamic push period based on the estimated value includes: The dynamic push period is determined based on the square root of the estimated value and the rate of change of the estimated value, wherein the rate of change is obtained based on an exponentially weighted moving average algorithm.
[0010] According to some embodiments of the present invention, the step of periodically pushing the estimated value from the server to the client according to the dynamic push period includes: When the cumulative number of events processed by the server reaches a preset integer multiple of the dynamic push period, the server pushes the estimated value to the client.
[0011] According to some embodiments of the present invention, the step of the server periodically pushing the estimated value to the client according to the dynamic push period further includes: When the ratio of the previously pushed estimated value by the server to the real-time generated estimated value is greater than a preset ratio, the server pushes the estimated value to the client. Alternatively, when the cumulative time during which the server has not pushed the estimated value reaches a preset time threshold, the server pushes the estimated value to the client.
[0012] According to some embodiments of the present invention, the step of periodically pushing the estimated value from the server to the client according to the dynamic push period further includes: The server controls the process of pushing the estimated value through an atomic script. The operation key of the atomic script stores the estimated value, the rate of change, the event counter, and the status data set of the last published state. The operation key is routed to the same service shard based on the resource identifier and hash label, thereby realizing atomic operations without concurrency contention.
[0013] A dynamic aggregation value update system according to a second aspect embodiment of the present invention includes a server and a client; The server can continuously generate and update the estimated value of the dynamic aggregated value based on the obtained event scale and dynamic aggregated value; The server can also determine a dynamic push period based on the estimated value, wherein the dynamic push period is adaptively adjusted as the estimated value changes and is proportional to the square root of the estimated value; The server can also periodically push the estimated value from the server to the client according to the dynamic push period.
[0014] An electronic device according to a third aspect of the present invention includes a memory and a processor, the memory being used to store at least one program, and the processor being used to load the at least one program to execute the dynamic aggregate value update method described in the above-described aspect embodiments.
[0015] A computer-readable storage medium according to a fourth aspect of the present invention includes a memory and a processor, the memory being configured to store at least one program, and the processor being configured to load the at least one program to perform the dynamic aggregate value update method described in the above-described aspect embodiments.
[0016] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0017] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart of the dynamic aggregation value update method according to an embodiment of the present invention; Figure 2 This is a structural diagram of the dynamic aggregation value update system according to an embodiment of the present invention; Figure 3 This is a structural diagram of an electronic device provided in another embodiment of the present invention. Detailed Implementation
[0018] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0019] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," "exceeding," etc. are understood to exclude the stated number, and "above," "below," "within," etc. are understood to include the stated number. If "first," "second," etc. are used in the description, they are only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the order of the indicated technical features.
[0020] The concepts involved in this invention are explained below: Poisson process: an idealized mathematical model that describes the occurrence of random events over time. It requires that the occurrence of events satisfy three core conditions: the events are independent of each other, the average rate of occurrence is constant in any equal time intervals, and it is almost impossible for multiple events to occur simultaneously in a very short time. Redis: An in-memory key-value store database that supports data persistence and provides various data structures (such as strings, hashes, lists, etc.). It is often used in high-concurrency, low-latency scenarios such as caching, session storage, and real-time data processing. Dynamic aggregated values refer to the values obtained by the server after processing the count of a triggered event in different scenarios (for example, the number of online users in a live stream is obtained by calculating the number of users entering / leaving, rather than accumulating the entry / exit actions of each user). The method for updating dynamic aggregated values in this embodiment of the invention refers to the server pushing the value to the client. If the push is too frequent, it will consume too many system resources; if the push is not timely enough, it will also result in the information not being available to the users who need it. Each event is an atomic behavior, and the impact of each triggered event on the dynamic aggregated value can be an increase or a decrease. For example, the number of online users in a live stream (users entering / leaving the live stream is an event, and the number of online users in the live stream increases by 1 / -1 after triggering), the real-time inventory in a warehouse (goods entering / leaving the warehouse is an event, and the real-time inventory in the warehouse increases by n / -n after triggering), and the number of object transactions in financial transactions (the number of object transactions increases by n / -n after triggering the buy / sell of a certain object). In different application scenarios, the dynamic aggregated values and their rate of change vary greatly. For example, the number of online viewers in a top-tier live broadcast room can reach tens of millions, and the number of events triggered per second can reach tens of thousands; while a newly established live broadcast room may only have dozens of online viewers and no events will be triggered for a long time. Obviously, the same method for updating dynamic aggregated values cannot be used for these two very different application scenarios.
[0021] Please refer to Figures 1-2 , Figure 1 This is a flowchart of a method for updating dynamically aggregated values according to an embodiment of the present invention. This embodiment discloses a method for updating dynamically aggregated values, which includes, but is not limited to, the following steps: Step S100: Based on the obtained event scale and dynamic aggregate value, the server continuously generates and updates the estimated value of the dynamic aggregate value. It should be noted that in step S100, the server first determines the current estimated value N of the dynamic aggregated value corresponding to the client providing the service based on the event scale in the current application scenario, and then calculates the dynamic push period m based on the estimated value N. The application scenarios of the above embodiments include live streaming rooms, warehouse scheduling systems, etc., where the estimated value N represents the total amount that needs to be displayed, such as the number of online users and inventory. The effect of this step is to establish an update rhythm for the dynamic aggregated value that matches the current application scale, resulting in a shorter update period and faster response when the estimated value is large, and a longer update period and lower load when the estimated value is small, thus injecting adaptive control capabilities at the beginning of the process. It is understood that the estimated value N is not entirely equal to the real-time dynamic aggregated value of the client providing the application service, and the method of obtaining the estimated value N differs in different application scenarios.
[0022] Step S200: Determine the dynamic push cycle based on the estimated value, wherein the dynamic push cycle is adaptively adjusted as the estimated value changes and is proportional to the square root of the estimated value.
[0023] It should be noted that the dynamic push period m in this embodiment of the invention is proportional to the square root of the estimated value N, that is, m∝ The relationship is as follows. In practical application scenarios, the event triggering process corresponding to the client can be regarded as a Poisson process, which satisfies that the standard deviation of the total number of events occurring within the observation time is equal to the square root of its mean. This embodiment of the invention uses this principle to set the estimated value of the dynamically aggregated numerical value, theoretically ensuring that the relative error can be controlled within a reasonable range when estimating the total number through periodic sampling.
[0024] Step S300: Periodically push the estimated value from the server to the client according to the dynamic push cycle.
[0025] It should be noted that the periodic push in step S300 is not based on a fixed time interval, but rather on an event-driven cycle defined by the dynamic push cycle. That is, when the estimated value N obtained by the server changes, the cycle in which the server pushes the estimated value to the client also changes. This mechanism transforms the "cycle" from a fixed time dimension to an event dimension directly related to numerical changes, allowing the push frequency to adaptively follow the scale and trend of the numerical value itself. This dynamically decouples the update load from the numerical activity at the system level, achieving update suppression under high load and update guarantee under low activity.
[0026] Furthermore, step S100 in the above-described embodiments also includes, but is not limited to, the following steps: Step S110: If the number of events triggered by the server in real time meets the cold start condition, then the estimated value of the server's historical push is used as the current estimated value. Step S120: If the number of events triggered by the server in real time meets the warm start threshold, then the estimated value is determined based on the persistent snapshot of the server. Step S130: If the number of events triggered by the server in real time meets the hot start threshold, then the estimated value is determined based on the dynamic aggregated value or real-time snapshot obtained by the server in real time.
[0027] It should be noted that the server will execute different estimation value N generation strategies for different application scenarios, i.e., a tiered start strategy, to differentiate and limit the dynamic push period m. Specifically, the cold start threshold is for objects with a low event trigger volume (such as live streams with a low number of followers), using the estimated value of historical pushes as the current estimated value N; if there is no historical estimated value N, then 0 is directly used as the estimated value N. The warm start threshold is for regular objects or objects with a normal rate of change (such as live streams with a relatively stable number of followers, whose normal range can be preset, for example, limited by the number of followers). Since these objects are relatively stable, the estimated value N can be limited based on the server's persistent snapshot to provide a reasonable push rate. The persistent snapshot in this embodiment refers to a data copy that the server periodically saves in a reliable storage manner during operation, storing the current estimated value of dynamically aggregated values and their related state information. This snapshot typically includes the value itself, its change trend, and metadata such as timestamps, and is stored in a persistent medium such as a database or distributed cache. In one embodiment of this invention, it is implemented through a hash structure stored in a high-speed cache database to ensure efficient read and write operations. The hot start threshold targets objects triggered by short-term, large-scale events (such as the start of a top-tier live event), directly obtaining the corresponding dynamic aggregated value or a real-time snapshot (≤1s) of the server system to ensure that the client can obtain the changed values in a timely manner. The hierarchical strategy in steps S110 to S130 provides an accurate and scenario-matched initial benchmark for subsequent adaptive updates based on estimated values by distinguishing the activity level of the scene.
[0028] It is understood that the clients in the embodiments of the present invention can be divided into clients that provide services and clients that receive services. The estimated value obtained by the server is usually based on the client that provides services (e.g., a live broadcast room). The estimated value pushed by the server can be sent to both the client that provides services and the client that receives services at the same time, or it can be sent to only one type of client according to the preset settings. The present invention does not limit this.
[0029] In one embodiment of the present invention, the three startup conditions are as follows: if the client is in the hotspot whitelist or is estimated to be a large-scale application scenario, a warm start is performed; if the rate of change of the snapshot / or estimated value N within ≤5 minutes is within the preset rate range, a warm start is performed; otherwise, a cold start is performed.
[0030] Furthermore, step S120 in the above-described embodiments also includes, but is not limited to, the following steps: Step S121: When determining the estimated value based on the persistent snapshot, the estimated value is positively adjusted based on a preset ratio.
[0031] It should be noted that when determining the initial estimate based on the persistent snapshot, the historical values recorded in that snapshot are proactively increased by a preset percentage (e.g., 5%) to compensate for any potential growth in the dynamically aggregated values from snapshot generation to system startup. This operation aims to prevent initial underestimation due to directly using historical values, thereby narrowing the gap between the displayed values and the actual values at the beginning of system startup and improving the consistency and credibility of the user experience.
[0032] Furthermore, step S200 in the above-described embodiments also includes, but is not limited to, the following steps: Step S210: Determine the dynamic push period based on the square root of the estimated value and the rate of change of the estimated value, wherein the rate of change is obtained based on the exponentially weighted moving average algorithm.
[0033] It should be noted that the dynamic sampling period m and the estimated value N satisfy m∝ In addition to the relationship, in one embodiment of the present invention, the dynamic sampling period m also considers the rate of change of the estimated value, and the specific conversion formula is as follows: ...Form ①, In equation ①, ceil() is the floor function. The square root of the estimated value N, and ε is a preset calibration coefficient, where c is derived from the desired relative error target ε and is used to control the basic update frequency; The parameter abs(dN_dt_ewma) is used to adjust the influence of the rate of change on the update frequency, where abs(dN_dt_ewma) is the absolute value of the rate of change of the estimated value. Further, in this embodiment of the invention, the first derivative approximation of the rate of change of the dynamically aggregated numerical value is calculated using the Exponentially Weighted Moving Average (EWMA) algorithm, and then the dynamic sampling period is adjusted in real-time based on this rate value. This setting allows the system to sensitively perceive the intensity of numerical fluctuations and automatically shorten the period to improve real-time response when the value increases sharply, and automatically extend the period to reduce system load when the value is stable. It is understood that parameter c is derived from a preset allowable error ε through a statistical model, which establishes the relationship between the update frequency and the numerical scale (which can be determined through...). The fundamental proportional relationship between the parameters (indirectly represented) fundamentally guarantees the theoretical controllability of update accuracy under different numerical scales; while the parameters This is an engineering adjustment factor used to amplify or reduce the impact of the rate of change on the final sampling period. The larger the value, the more sensitive the system is to fluctuations, and the more aggressively it will shorten the period to improve responsiveness when it detects an acceleration of change. The smaller the value, the more the system tends to maintain the baseline rhythm determined by c, exhibiting stronger update stability. Step S210, by integrating both numerical scale and trend information, enables the dynamic push cycle m to adapt to actual dynamic fluctuations in real time, in addition to being affected by the estimated value N, achieving an adaptive balance between response speed and resource consumption at the system level.
[0034] Furthermore, step S300 in the above-described embodiments also includes, but is not limited to, the following steps: Step S310: When the cumulative number of events processed by the server reaches a preset integer multiple of the dynamic push period, the server pushes the estimated value to the client.
[0035] It should be noted that in step S310, the server maintains an event counter to accumulate the number of events processed since the last release. This counter increments with each atomic event trigger, and the system compares the accumulated event count with the dynamic push cycle in real time. When the accumulated value reaches an integer multiple of the dynamic push cycle, the operation of pushing the current estimated value to the client is triggered. The purpose of this mechanism is to establish a deterministic release rhythm based on event-driven factors and adapted to the numerical scale. It can directly bind update triggering to the actual occurrence of business events, allowing the update frequency to adaptively scale with the estimated value N and the event triggering scale of the application scenario. This enables automatic update merging and load suppression in high-frequency event scenarios, while still providing predictable periodic updates in low-frequency scenarios.
[0036] Furthermore, step S300 in the above-described embodiments also includes, but is not limited to, the following steps: Step S320: When the ratio of the previously pushed estimated value to the real-time generated estimated value is greater than a preset ratio, the server pushes the estimated value to the client. Step S330, or, when the cumulative time during which the server has not pushed the estimated value reaches a preset time threshold, the server pushes the estimated value to the client.
[0037] It should be noted that steps S320 and S330 together constitute the supplementary triggering mechanism of this embodiment of the invention. Step S320 is an amplitude threshold triggering mechanism; when the relative rate of change of the current estimated value N compared to the last published value exceeds a preset threshold δ, a publication is triggered to capture significant changes in amplitude that do not meet the periodic conditions. Step S330 is a time window guarantee mechanism; when the silence period since the last publication exceeds a preset window T_min, a publication is forcibly triggered to ensure the basic refresh rate in event-sparse scenarios. It is understood that in some embodiments of the invention, satisfying any one of the three push triggering conditions (steps S310 to S330) is sufficient to trigger a push from the server to the client; all three do not need to be satisfied simultaneously.
[0038] In addition, in the above-mentioned embodiments, the server controls the process of pushing the estimated value through an atomic script. The operation key of the atomic script stores the estimated value, the rate of change, the event counter, and the status data set of the last published state. The operation key is routed to the same service shard based on the resource identifier and hash label, thereby realizing atomic operation without concurrency contention.
[0039] It should be noted that, to achieve data consistency updates in high-concurrency scenarios, this embodiment of the invention encapsulates the state update and publication logic using atomic server-side scripts (such as Redis Lua scripts). For each independently providing service client (such as a live streaming room), a core state set named after a resource identifier is maintained in storage. This set includes at least the current estimated value N, the rate of change dN_dt_ewma calculated by exponential weighted average, an event counter for periodic accumulation, and the last published estimated value N and timestamp. By using hash labels for resource identifiers, it is ensured that all states of the same resource are routed to the same service shard; the script only reads, calculates, updates, and makes publication judgments on this single state set in a single atomic operation, thereby completely eliminating concurrency contention and ensuring the accuracy and eventual consistency of state transitions under high-frequency event triggering.
[0040] Reference Figure 2 , Figure 2 This invention provides another embodiment of a dynamic aggregated value update system, which includes a server and a client, and is used to execute the dynamic aggregated value update method of the above-described embodiments. The server can continuously generate and update the estimated value of the dynamic aggregated value based on the obtained event scale and dynamic aggregated value; The server can also determine the dynamic push period based on the estimated value. The dynamic push period is adaptively adjusted as the estimated value changes and is proportional to the square root of the estimated value. The server can also periodically push estimated values from the server to the client based on a dynamic push cycle.
[0041] It should be noted that the dynamic aggregated numerical update system provided by this invention includes a server and a client. The difference between the application and the client lies in that the application is divided into a client that provides services and a client that receives services. The client that provides services can trigger atomic events that cause numerical changes. The server can capture the corresponding event changes and perform atomic read, write, and calculation on the state set (including the current estimated value, rate of change, event counter, and last published state) stored in single-key form by executing atomic scripts. Then, it determines the dynamic push cycle based on the square root of the estimated value and the rate of change, and determines the publishing timing based on three conditions: event count, relative change amplitude, and silent time. The client is used to receive and display the estimated values pushed by the server. Through the above architecture and process, the system implements the method as a complete technical solution that supports high concurrency and ensures state consistency.
[0042] The following is an overall embodiment of the present invention: On the server side, the following status data is maintained for each live streaming room. This data can be stored in a hash structure of a high-speed caching database such as Redis to ensure efficient read and write operations: • N: An estimate of the current number of online users; •dN_dt_ewma: The exponentially weighted moving average of the rate of change in the number of online users, used to characterize the degree of recent volatility; •counter: A counter for user actions (entering / leaving) since the last published number of users; • last_published_N: The number of online users last published. • last_published_time: The UNIX timestamp of the last publication.
[0043] The core logic of the entire adaptive update method is executed through an atomic script (e.g., a Redis Lua script) deployed on the server side to avoid data races under concurrent conditions. Its processing flow is as follows: Step 1: Event Triggering. When a user action event (a user entering or leaving the live stream) occurs, the server triggers the execution of this atomic script. This event is the atomic operation that causes a change in the dynamically aggregated value.
[0044] Step 2: Basic Data Update Within the script, the basic counter value is updated first. For example, if it's an entry event, N is atomically incremented; if it's a exit event, it's atomically decremented. Simultaneously, the counter is incremented. And based on the change in N, the value of dN_dt_ewma is updated.
[0045] Step 3: Sampling Period Calculation Next, calculate the core sampling period m. The calculation formula can be specified as follows: Where: ceil() is the floor function; c and k are preset calibration coefficients, c is derived from the desired relative error target ε and is used to control the basic update frequency; k is used to adjust the degree of influence of the rate of change on the update frequency; abs(dN_dt_ewma) is the absolute value of the rate of change.
[0046] Step 4: The script for determining the release conditions will check the following three conditions, and will trigger release if any one of them is met: counter%m==0 (Sampling period hit condition); abs(N-last_published_N) / N>δ (relative change threshold condition, δ is a preset value, such as 0.05); current_time - last_published_time > T_min (time window guarantee condition, T_min is a preset value, such as 30 seconds).
[0047] Step 5: Perform the release or skip. If any of the publishing conditions are met: the script publishes the current count value N to a message queue, the downstream push service subscribes to the queue, and sends the new count to all clients in the live stream. Subsequently, the script updates last_published_N to N, last_published_time to the current time, and resets counter to 0. If none of the publishing conditions are met: the script will not perform any operation and will terminate directly.
[0048] Through the above implementation methods, this invention successfully transforms a complex dynamic system control problem into an efficient, atomic, and theoretically sound algorithm implementation. It ensures that even in a top-tier livestream room with tens of millions of users, the system will not overload due to the number of users refreshing; simultaneously, in a small livestream room with only a few dozen users, each user's entry receives timely feedback, achieving an optimal balance between resource efficiency and user experience.
[0049] like Figure 3 As shown, Figure 3 This is a structural diagram of an electronic device provided in one embodiment of the present invention. The present invention also provides an electronic device, comprising: The processor 801 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 802 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 802 and is called and executed by the processor 801 to execute the dynamic aggregation value update method of the embodiments of this application. The 803 input / output interface is used to implement information input and output. The communication interface 804 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 805 transmits information between various components of the device (e.g., processor 801, memory 802, input / output interface 803, and communication interface 804); The processor 801, memory 802, input / output interface 803, and communication interface 804 are connected to each other within the device via bus 805.
[0050] It should be noted that the electronic device executing the dynamic aggregation value update method in the embodiments of the present invention refers in particular to a server-side device with distributed processing capabilities, including but not limited to independent servers, server clusters, virtual computing instances in cloud service platforms and edge computing servers, as well as any other electronic device that can be used to execute the method. The present invention does not impose any specific limitations on this.
[0051] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate, and may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0052] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0053] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A method for updating dynamically aggregated numerical values, characterized in that, include: Based on the obtained event scale and dynamic aggregated values, the server continuously generates and updates the estimated value of the dynamic aggregated values; The dynamic push cycle is determined based on the estimated value, wherein the dynamic push cycle is adaptively adjusted as the estimated value changes and is proportional to the square root of the estimated value; According to the dynamic push period, the estimated value is periodically pushed from the server to the client.
2. The method for updating dynamically aggregated values according to claim 1, characterized in that, The step of the server continuously generating and updating the estimated value of the dynamic aggregated value based on the obtained event scale and dynamic aggregated value includes: If the number of events triggered by the server in real time meets the cold start condition, then the estimated value pushed by the server in the past is used as the current estimated value. If the number of events triggered by the server in real time meets the warm start threshold, the estimated value is determined based on the persistent snapshot of the server. If the number of events triggered by the server in real time meets the hot start threshold, the estimated value is determined based on the dynamic aggregated value or real-time snapshot obtained by the server in real time.
3. The method for updating dynamically aggregated values according to claim 2, characterized in that, When the number of events triggered by the server in real time meets the warm start threshold, the step of determining the estimated value of the dynamically aggregated value obtained by the server further includes: When determining the estimated value based on the persistent snapshot, the estimated value is positively adjusted based on a preset ratio.
4. The method for updating dynamically aggregated values according to claim 1, characterized in that, The step of determining the dynamic push cycle based on the estimated value includes: The dynamic push period is determined based on the square root of the estimated value and the rate of change of the estimated value, wherein the rate of change is obtained based on an exponentially weighted moving average algorithm.
5. The method for updating dynamically aggregated values according to claim 1, characterized in that, The step of periodically pushing the estimated value from the server to the client according to the dynamic push period includes: When the cumulative number of events processed by the server reaches a preset integer multiple of the dynamic push period, the server pushes the estimated value to the client.
6. The method for updating dynamically aggregated values according to claim 5, characterized in that, The step of periodically pushing the estimated value to the client according to the dynamic push period further includes: When the ratio of the previously pushed estimated value by the server to the real-time generated estimated value is greater than a preset ratio, the server pushes the estimated value to the client. Alternatively, when the cumulative time during which the server has not pushed the estimated value reaches a preset time threshold, the server pushes the estimated value to the client.
7. The method for updating dynamically aggregated values according to claim 4, characterized in that, The step of periodically pushing the estimated value from the server to the client according to the dynamic push period further includes: The server controls the process of pushing the estimated value through an atomic script. The operation key of the atomic script stores the estimated value, the rate of change, the event counter, and the status data set of the last published state. The operation key is routed to the same service shard based on the resource identifier and hash label, thereby realizing atomic operations without concurrency contention.
8. A dynamic aggregation numerical update system, characterized in that, The system includes a server and a client; The server can continuously generate and update the estimated value of the dynamic aggregated value based on the obtained event scale and dynamic aggregated value; The server can also determine a dynamic push period based on the estimated value, wherein the dynamic push period is adaptively adjusted as the estimated value changes and is proportional to the square root of the estimated value; The server can also periodically push the estimated value from the server to the client according to the dynamic push period.
9. An electronic device, characterized in that, The system includes a memory and a processor, the memory being used to store at least one program, and the processor being used to load the at least one program to execute the method for updating the dynamic aggregated values according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method for updating dynamically aggregated values as described in any one of claims 1 to 7.