Message management method
By using pulse coding and membrane potential mechanisms in a distributed message queue system to dynamically adjust the producer sending rate, the problem of producer-consumer rate mismatch is solved, thereby improving the stability and resource utilization of the message queue.
Patent Information
- Application Number
- CN202610002232.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-04
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies make it difficult to achieve real-time adaptive adjustment of the producer sending rate in distributed message queue systems, leading to message backlog or idle resources, which affects system stability and resource utilization.
Pulse coding is used to simulate message resource consumption, membrane potential is used to reflect the consumption pressure of the message queue, and response signals are returned to the producer to adjust the message production strategy and dynamically match the rate between the producer and the consumer.
This achieves improved real-time stability and resource utilization of the message queue, avoids message backlog and resource idleness, and enhances the robustness and resource utilization efficiency of the system.
Smart Images

Figure CN121858332A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, specifically relating to a message management method. Background Technology
[0002] In a distributed message queue system, producers continuously send messages to the queue, and consumers process the messages in the queue. When the rate at which producers send messages exceeds the processing capacity of consumers, messages accumulate in the queue, leading to a significant increase in system latency. In severe cases, this can trigger cascading failures, causing service interruptions or data loss. Conversely, if the producer sending rate is too low, the computing resources of the producer cluster will be idle, failing to effectively utilize hardware resources and reducing overall system efficiency. Therefore, dynamically adjusting the producer sending rate is a key challenge in ensuring system stability and resource utilization.
[0003] In existing technologies, threshold control mechanisms such as TCP-style window limiting or token bucket algorithms are commonly used to adjust production rates. While these methods are simple in structure and easy to implement, they heavily rely on preset fixed threshold parameters. When the system environment changes dynamically, such as cluster elastic scaling, node failure recovery, or load fluctuations, the threshold cannot automatically adapt to real-time changes in consumer processing capacity, requiring manual intervention for reconfiguration. This not only increases operational complexity but also leads to lag in control response, making it difficult to maintain queue stability under sudden traffic surges. On the other hand, machine learning-based methods attempt to predict queue backlog trends using models such as Long Short-Term Memory (LSTM) networks to generate backpressure signals. However, these methods require a large amount of historical data for training, and prediction accuracy drops sharply when data is sparse or its distribution changes. Furthermore, model training and inference consume significant computing resources, requiring additional dedicated computing power, which significantly increases system deployment costs and maintenance difficulty. These limitations make it difficult for existing technologies to achieve accurate, real-time control of production rates while maintaining low overhead. Summary of the Invention
[0004] This application provides a message management method aimed at improving the stability and resource utilization of the message management system.
[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0006] According to one aspect of the embodiments of this application, a message management method is provided, the method comprising: when a message sent by a producer is received, writing the message into a message queue; determining a membrane potential of the message queue based on a pulse code corresponding to the message, the pulse code being used to simulate the resource consumption of the message, and the membrane potential being used to simulate the consumption pressure of the message queue; and returning a response signal to the producer based on the membrane potential, the response signal being used to instruct the producer to adjust a message production strategy.
[0007] According to one aspect of the embodiments of this application, a message management device is provided, the device comprising: The write module is configured to write the message to the message queue when it receives a message sent by the producer; The determination module is configured to determine the membrane potential of the message queue based on a pulse code corresponding to the message, wherein the pulse code is used to simulate the resource consumption of the message, and the membrane potential is used to simulate the consumption pressure of the message queue. The return module is configured to return a response signal to the producer based on the membrane potential, the response signal being used to instruct the producer to adjust the message production strategy.
[0008] In some embodiments of this application, based on the above technical solutions, the determining module includes: The message recording module is configured to record the dynamic message set managed by the message queue within a historical statistical period. The historical statistical period is the historical time interval between the historical response time and the current response time. The historical response time is the moment when the message queue most recently returned a response signal to the producer. The dynamic message set includes positive pressure messages and negative pressure messages. Positive pressure messages are messages that enter the message queue within the historical statistical period, and negative pressure messages are messages that are removed from the message queue within the historical statistical period. The encoding and summarization module is configured to summarize the pulse codes of each message in the dynamic message set to obtain the input current of the message queue. The input current is used to simulate the rate of change of the message backlog status of the message queue during the historical statistical period. The change amount determination module is configured to determine the potential change amount of the message queue based on the input current and the membrane resistance of the message queue, wherein the membrane resistance is used to simulate the consumption capacity of the consumption system in which the message queue is located; A membrane potential determination module is configured to determine the membrane potential of the message queue at the current response time based on the potential change and the membrane potential of the message queue at the historical response time.
[0009] In some embodiments of this application, based on the above technical solutions, the determining module further includes: The utilization rate acquisition module is configured to acquire the resource utilization rate of the consumption system at the current response time; The utilization rate mapping module is configured to perform a weighted mapping on the resource utilization rate to obtain the membrane resistance of the message queue, wherein the membrane resistance is negatively correlated with the resource utilization rate.
[0010] In some embodiments of this application, based on the above technical solutions, the resource utilization rate includes CPU utilization rate, memory utilization rate, and network I / O utilization rate; the utilization rate mapping module is further configured to: perform weighted calculation on the CPU utilization rate, the memory utilization rate, and the network I / O utilization rate according to a preset utilization rate weight to obtain the weighted resource utilization rate of the consumption system; and perform normalized mapping on the weighted resource utilization rate according to a preset activation function to obtain the membrane resistance of the message queue.
[0011] In some embodiments of this application, based on the above technical solutions, the activation function is a hyperbolic tangent function used for nonlinear mapping of the weighted resource utilization rate.
[0012] In some embodiments of this application, based on the above technical solutions, the encoding and summarizing module is further configured to: decode the pulse encoding of each message in the dynamic message set to obtain the pulse frequency of the message; perform weighted fusion of the pulse frequencies of each message in the dynamic message set to obtain the input current of the message queue, wherein the input current is positively correlated with the pulse frequency of the positive pressure message and negatively correlated with the pulse frequency of the negative pressure message.
[0013] In some embodiments of this application, based on the above technical solutions, the acquisition module is further configured to: parse the message to obtain the pulse code carried in the message, wherein the pulse code is obtained by the producer encoding the message capacity.
[0014] In some embodiments of this application, based on the above technical solutions, the pulse coding method includes: mapping the message capacity of the message to obtain the pulse frequency of the message; and encoding the pulse frequency according to a preset coding rule to obtain the pulse code.
[0015] In some embodiments of this application, based on the above technical solutions, the return module is further configured to: perform mapping processing on the membrane potential to obtain a suppression strength, wherein the suppression strength is used to quantify the degree of suppression of the membrane potential on the message production speed of the producer; and return a response signal to the producer according to the suppression strength.
[0016] In some embodiments of this application, based on the above technical solutions, the suppression strength and the message generation speed of the producer have the following relationship:
[0017] in, It is the message production speed of the producer. This is the maximum message production rate of the producer. It is the suppression strength, It is a preset suppression constant. According to one aspect of the embodiments of this application, a computer-readable medium is provided, on which a computer program is stored, which, when executed by a processor, implements the message management method as described in the above technical solutions.
[0018] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement the message management method as described in the above technical solutions.
[0019] According to one aspect of the embodiments of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the message management method as described in the above technical solutions.
[0020] In the technical solution provided in this application embodiment, when a message sent by a producer is received, the message is written into a message queue; the membrane potential of the message queue is determined according to the pulse code corresponding to the message, the pulse code is used to simulate the resource consumption of the message, and the membrane potential is used to simulate the consumption pressure of the message queue; a response signal is returned to the producer according to the membrane potential, and the response signal is used to instruct the producer to adjust the message production strategy. By simulating the consumption pressure of the message queue and dynamically returning the response signal to adjust the production strategy, the producer's message production strategy can be adaptively adjusted, avoiding message queue backlog or resource idleness, and improving system stability and resource utilization.
[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0023] Figure 1 An exemplary system architecture block diagram illustrating the application of the technical solution of this application is shown schematically.
[0024] Figure 2 A flowchart of a message management method according to one embodiment of this application is shown.
[0025] Figure 3 A flowchart for determining the membrane potential is shown in one embodiment of this application.
[0026] Figure 4 A flowchart summarizing pulse coding is shown in one embodiment of this application.
[0027] Figure 5 A flowchart illustrating the return of a response signal is shown in one embodiment of this application.
[0028] Figure 6 The diagram illustrates the functional architecture of an embodiment of this application in an application scenario.
[0029] Figure 7 A schematic block diagram of the message management device provided in an embodiment of this application is shown.
[0030] Figure 8 A schematic diagram of a computer system architecture suitable for implementing the embodiments of this application is shown. Detailed Implementation
[0031] 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 examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0032] Furthermore, the described features, structures, or characteristics 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 application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, 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 application.
[0033] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0035] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0036] Figure 1 An exemplary system architecture block diagram illustrating the application of the technical solution of this application is shown schematically.
[0037] like Figure 1 As shown, the system architecture 100 may include terminal devices 110, a network 120, and a server 130. Terminal devices 110 may include various electronic devices such as smartphones, tablets, laptops, desktop computer smart speakers, smart wearable devices, smart in-vehicle devices, and smart payment terminals. Server 130 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Network 120 may be a communication medium of various connection types capable of providing a communication link between terminal devices 110 and server 130, such as a wired communication link or a wireless communication link.
[0038] Depending on the implementation requirements, the system architecture in this application embodiment can have any number of terminal devices, networks, and servers. For example, server 130 can be a server group composed of multiple server devices. In addition, the technical solutions provided in this application embodiment can be applied to terminal device 110, or to server 130, or can be implemented jointly by terminal device 110 and server 130. This application does not impose any special limitations on this.
[0039] In message queue systems, a dynamic mismatch between the producer's message generation rate and the consumer's processing capacity can easily lead to message backlog or resource idleness. Existing technologies, control mechanisms based on fixed thresholds require manual intervention to adapt to changes in processing capacity, while predictive model-based solutions suffer from high computational overhead and reliance on training data, making real-time adaptive adjustment of the production rate difficult. Specifically, rigid threshold settings prevent the system from responding to dynamic scenarios such as cluster scaling or node failures, while predictive models increase deployment complexity due to sample dependence and computational demands. This results in insufficient real-time performance for message queue status assessment and production strategy adjustments, ultimately impacting system stability and resource utilization.
[0040] For example, in the order processing scenario of a distributed e-commerce platform, promotional activities trigger a surge in user requests, causing a rapid increase in the message generation rate of the producer cluster, while the processing capacity of the consumer cluster decreases due to server failures. At this point, the message backlog in the message queue continues to accumulate, while some nodes in the producer cluster are idle due to excessively strict rate limits. Furthermore, the pulse coding does not establish a dynamic correlation with message resource consumption, and the membrane potential fails to accurately simulate changes in consumption pressure, resulting in the response signal failing to reflect the queue status in real time. This leads to a decrease in overall system throughput and an imbalance in resource allocation.
[0041] If the above problems are not resolved, message backlog may lead to queue overflow or cascading failures, and the system reliability will continue to deteriorate. At the same time, idle producer resources will result in wasted computing power, and key performance indicators such as service continuity and resource utilization will not be maintained within a reasonable range. In the long run, this may further increase the risk of system crash.
[0042] To address the problems existing in the above-mentioned related technologies, this application provides a message management method, the core of which lies in realizing the dynamic perception and feedback of message queue consumption pressure by simulating the mechanism of biological neurons, thereby guiding producers to adaptively adjust message production strategies.
[0043] The specific implementation of the technical solution of this application will be described in detail below through several embodiments.
[0044] Figure 2 A flowchart of a message management method according to one embodiment of this application is shown. The message management method may include the following steps S210 to S230.
[0045] S210: When a message is received from the producer, write the message to the message queue.
[0046] A producer is an entity in a messaging system responsible for generating and sending messages. A producer typically represents an application or service whose task is to create data or events and submit them to a message queue for further processing.
[0047] A message is a data unit generated and sent by a producer. Messages can contain various types of information, such as business data, event notifications, or control instructions, and are the basic carrier of inter-system communication.
[0048] A message queue is a middleware component used to store messages to be processed. Message queues provide a buffer for asynchronous communication between producers and consumers, decoupling them and smoothing message flow, thereby improving system resilience and scalability.
[0049] Writing messages to a message queue ensures that all pending messages are centrally managed. For example, a message can be appended directly to the end of the message queue, creating a first-in, first-out (FIFO) sequence. Alternatively, messages can be written to a priority-based message queue, where priorities can be pre-defined based on message type or importance.
[0050] S220: Determine the membrane potential of the message queue based on the pulse code corresponding to the message. The pulse code is used to simulate the resource consumption of the message, and the membrane potential is used to simulate the consumption pressure of the message queue.
[0051] Pulse coding is a coding method used to quantify message characteristics. In this embodiment, pulse coding is designed to simulate the amount of resources a message may consume during processing, such as CPU, memory usage, or network bandwidth. By assigning a pulse code to each message, its potential resource impact can be abstractly represented.
[0052] Membrane potential is an indicator used to simulate the current consumption pressure of a message queue. This concept draws inspiration from the membrane potential mechanism of biological neurons, reflecting the real-time load of the message queue by dynamically accumulating and releasing "charge." A higher membrane potential indicates greater consumption pressure on the message queue, and vice versa.
[0053] Pulse coding is used to simulate the resource consumption of messages, while membrane potential is used to simulate the consumption pressure of a message queue. For example, a fixed pulse coding value can be preset for each message, representing the average resources required to process that type of message. Alternatively, pulse coding can be calculated using simple linear mapping or table lookup methods based on attributes such as message size, complexity, or expected processing time. By accumulating the effects of these pulse codes, the membrane potential of the message queue can be dynamically calculated, thus reflecting its current consumption pressure.
[0054] S230: Returns a response signal to the producer based on the membrane potential. The response signal is used to instruct the producer to adjust the message production strategy.
[0055] A response signal is a feedback message sent by the message management method to the producer based on the membrane potential of the message queue. This signal carries an indication of the current state of the message queue and is intended to guide the producer to adjust its message production behavior.
[0056] A message production strategy refers to the rules by which a producer adjusts its message generation rate or method based on received response signals. By dynamically adjusting the message production strategy, the producer can synchronize with the message queue's consumption capacity, thereby optimizing the overall system performance and stability.
[0057] Response signals are used to instruct producers to adjust their message production strategies. For example, when the membrane potential reaches a preset threshold, a simple "stop" or "decelerate" signal can be sent to the producer. Alternatively, the response signal can be a numerical value containing a specific suggested production rate, which is inversely related to the membrane potential; that is, the higher the membrane potential, the lower the suggested production rate. Through this feedback mechanism, producers can perceive the load status of the message queue in real time and adjust their message production behavior accordingly to avoid message backlog or resource idleness.
[0058] The above technical solution will be described in more detail below through an optional implementation method.
[0059] In a distributed system, consider a message queue connected to multiple consumer services. Producers continuously send various business messages to this message queue. Traditional message management methods may use fixed thresholds or complex predictive models to control the producer rate, but these methods often suffer from problems such as untimely adjustments or high costs.
[0060] To address this issue, this application proposes a message management method. Specifically, when a producer generates a new business message and sends it to the message management system, the message is first received and written to a message queue. For example, after an order creation message is sent by the producer, the message management system stores it in a message queue, awaiting processing by the consumer service.
[0061] After a message is written to the message queue, the message management system determines the membrane potential of the message queue based on the pulse code corresponding to that message. Assume each order creation message is assigned a pulse code, the value of which reflects the computational resources and time required to process that order message. The message management system continuously aggregates the pulse codes of all messages in the message queue and, combined with the historical state of the message queue, dynamically calculates a membrane potential value. For example, if the message queue accumulates a large number of messages with high pulse code values, or if the inflow rate of messages far exceeds the consumption rate, the membrane potential of the message queue will increase, simulating an increase in message queue consumption pressure.
[0062] Once the membrane potential of the message queue is determined, the message management system returns a response signal to the producer based on this membrane potential. For example, when the membrane potential rises to a certain level, it indicates that the message queue is under heavy consumption pressure, and the system's processing capacity may be approaching saturation. In this case, the message management system will send a "decelerate" response signal to the producer. Upon receiving this signal, the producer will adjust according to its internal message production strategy, such as reducing its message generation rate and decreasing the number of messages sent per second. Conversely, if the membrane potential is low, it indicates that the message queue is under less consumption pressure, and the system's processing capacity is surplus. The message management system may send an "accelerate" response signal, instructing the producer to appropriately increase the message production rate.
[0063] Thus, through this dynamic pulse coding and membrane potential mechanism, the message management system can perceive the consumption pressure of the message queue in real time and provide timely feedback to the producers. Producers adjust their production strategies based on the feedback signals, thereby achieving an adaptive match between message production rate and consumption capacity, effectively avoiding message backlog and resource idleness.
[0064] Based on the above examples, the technical concept of this application demonstrates a significant technical contribution. Traditional existing message management methods, such as TCP-style window limiting or token bucket mechanisms, typically require a preset fixed threshold. In the examples above, if a fixed threshold is used, when the processing capacity of the consumer service changes due to scaling up / down or failures, the threshold will not adapt in real time, potentially leading to message backlog or resource waste. For example, when the consumer's processing capacity decreases, a fixed threshold may still allow the producer to send messages at an excessively high rate, quickly causing queue overflow.
[0065] In contrast, this application introduces the concepts of pulse coding and membrane potential to achieve dynamic, real-time quantification of message queue consumption pressure. In the example above, the pulse coding of a message directly reflects its resource consumption, while the membrane potential integrates the pulse coding of all messages and their historical states, thus accurately simulating the consumption pressure of the message queue. This evaluation method, based on the characteristics of the messages themselves and the dynamic changes of the queue, avoids reliance on manually set thresholds.
[0066] Furthermore, while existing machine learning-based methods for predicting queue backlog trends offer some dynamism, they are computationally expensive, require pre-training, and have high requirements for sample data, resulting in high deployment and maintenance costs. In the example above, if a machine learning model is used, it may be necessary to retrain the model every time the system environment changes or a new message type appears, consuming significant computational resources and time.
[0067] This application provides a lightweight and efficient solution. By abstracting message resource consumption as pulse coding and simulating message queue consumption pressure as membrane potential, this application constructs an adaptive system similar to the feedback mechanism of biological neurons. This mechanism can perceive system load in real time and at low cost, and directly provide producers with signals to adjust production strategies. Therefore, producers can dynamically adjust according to the actual consumption capacity of the message queue without manual intervention or complex prediction models, effectively solving the problems of message backlog and resource idleness, and improving the robustness and resource utilization of the entire messaging system.
[0068] Figure 3 A flowchart for determining the membrane potential in one embodiment of this application is shown. Based on the above embodiment, step S220 may include the following steps S222 to S228.
[0069] S222: Records the dynamic message set managed by the message queue within the historical statistical period. The historical statistical period is the historical time period between the historical response time and the current response time. The historical response time is the moment when the message queue most recently returned a response signal to the producer. The dynamic message set includes positive pressure messages and negative pressure messages. Positive pressure messages are messages that entered the message queue within the historical statistical period, and negative pressure messages are messages that were removed from the message queue within the historical statistical period.
[0070] The purpose of recording a dynamic message set managed by a message queue within a historical statistical period is to capture the message flow of the message queue within a specific time period, providing basic data for subsequent calculations of the rate of change in message backlog status. Its function is to provide a dynamic dataset reflecting the actual inflow and outflow of messages. One implementation is that the message management system can maintain a message log, recording the timestamps of each message entering and leaving the message queue, and filtering messages within a specific time period based on timestamps when needed. Another implementation is that the message queue can periodically snapshot its internal state and record message increments and decrements, thereby constructing a dynamic message set.
[0071] The historical statistical period refers to the historical time interval between the historical response time and the current response time. This period is dynamically defined, starting at the moment the message queue most recently returned a response signal to the producer and ending at the moment when the membrane potential needs to be calculated. This dynamic definition ensures that the membrane potential calculation is always based on the latest message flow data synchronized with the producer's interaction cycle, thus reflecting the consumption pressure of the message queue in real time.
[0072] The historical response time is the moment when the message queue most recently returned a response signal to the producer. This moment serves as the starting point of the historical statistical period, and its purpose is to align the calculation of the membrane potential with the time when the producer receives feedback and may adjust its production strategy, thereby forming a closed-loop feedback control cycle.
[0073] The current response time refers to the current point in time when the system needs to calculate and return a response signal to the producer. This time, serving as the end point of the historical statistical period, ensures that the membrane potential calculation is based on the latest message queue status, thereby providing the most timely feedback on consumption pressure.
[0074] The dynamic message set is a collection of messages managed by the message queue within a historical statistical period, including both positive-pressure and negative-pressure messages. The introduction of this set allows the system to comprehensively consider both message inflows and outflows, rather than just the instantaneous length of the queue, thus more accurately reflecting the dynamic changes of the message queue.
[0075] Positive pressure messages are messages that enter the message queue within a historical statistical period. These messages represent the inflow into the message queue, and their pulse coding will have a "positive" effect on the membrane potential of the message queue, i.e., increase consumption pressure.
[0076] Negative pressure messages are messages removed from the message queue during a historical statistical period. These messages represent the outflow from the message queue, and their pulse coding will have a "negative" effect on the membrane potential of the message queue, i.e., reduce consumption pressure.
[0077] S224: Summarize the pulse codes of each message in the dynamic message set to obtain the input current of the message queue. The input current is used to simulate the rate of change of the message backlog status of the message queue during the historical statistical period.
[0078] The input current of the message queue, obtained by summing the pulse codes of each message in the dynamic message set, aims to quantify the rate of change in the message backlog status of the message queue over a historical statistical period. The input current is an abstract representation of the total resource consumption caused by message inflows and outflows within a specific time period. One implementation is to perform a simple algebraic summation of the pulse codes of all messages in the dynamic message set, taking positive values for pulse codes of positive-pressure messages and negative values for pulse codes of negative-pressure messages. Another implementation is to assign different weights to the pulse codes of different messages based on their type or priority before performing a weighted summation to more precisely reflect their impact on the backlog status.
[0079] The input current is used to simulate the rate of change in message backlog status of the message queue over a historical statistical period. It is a comprehensive indicator that reflects the net change in resource consumption or backlog trend of the message queue due to message inflows and outflows over a period of time.
[0080] S226: Determine the potential change of the message queue based on the input current and the membrane resistance of the message queue. The membrane resistance is used to simulate the consumption capacity of the consumption system where the message queue is located.
[0081] Membrane resistors are used to simulate the consumption capacity of a message queue's consumer system. The value of the membrane resistor reflects the efficiency or carrying capacity of the consumer system in processing messages. A larger membrane resistor indicates a weaker consumption capacity; for the same input current, the membrane potential will change more significantly. Conversely, a smaller membrane resistor indicates a stronger consumption capacity; for the same input current, the membrane potential will change less significantly. One implementation method is to set the membrane resistor based on a preset fixed processing capacity value of the consumer system. Another implementation method is to dynamically adjust the membrane resistor value based on real-time monitoring data of the consumer system's currently available resources (such as CPU, memory, network bandwidth, etc.) through table lookup or simple function mapping.
[0082] The potential change refers to the magnitude of the change in the membrane potential of the message queue over a historical statistical period. It is determined by both the input current and the membrane resistance, reflecting the actual trend of message backlog after considering the processing capacity of the consumer system.
[0083] S228: Determine the membrane potential of the message queue at the current response time based on the potential change and the membrane potential of the message queue at historical response times.
[0084] Based on the potential change and the membrane potential of the message queue at historical response times, the membrane potential of the message queue at the current response time is determined. The aim is to use a cumulative effect to add the change in message backlog within the current period to the membrane potential at the previous response time, thus obtaining the latest membrane potential. Its function is to achieve continuous updating and dynamic adjustment of the membrane potential, ensuring that it always reflects the latest consumption pressure of the message queue. One implementation method is to perform a simple addition operation between the membrane potential at historical response times and the potential change. Another implementation method is to introduce a decay factor or time constant, so that the influence of historical membrane potentials gradually weakens over time, thereby emphasizing the impact of recent message flow.
[0085] This application's embodiments introduce the concepts of dynamic message sets and membrane resistance to dynamically calculate the membrane potential of the message queue, thereby reflecting the rate of change in message backlog status in real time and adapting to changes in the consumption system's capabilities.
[0086] Specifically, after the message management method receives a message from the producer and writes it to the message queue, in order to determine the consumption pressure of the message queue, the system first records the dynamic message set managed by the message queue within a historical statistical period. This historical statistical period is a dynamic time window, starting from the historical response time when the message queue most recently returned a response signal to the producer, and ending at the current response time when the membrane potential needs to be calculated. During this period, the system identifies positive pressure messages entering the message queue and negative pressure messages leaving the message queue, thereby comprehensively capturing the inflow and outflow of messages. Based on this, the system summarizes the pulse codes of each message in the dynamic message set to obtain the input current of the message queue. Since pulse codes are used to simulate the resource consumption of messages, this input current can accurately simulate the rate of change of the message backlog status of the message queue within the historical statistical period, that is, the net increase or decrease trend of the message backlog.
[0087] Subsequently, the system determines the potential change of the message queue based on the calculated input current and the membrane resistance simulating the consumption capacity of the consumer system. The introduction of the membrane resistance ensures that the potential change not only considers message inflow and outflow but also incorporates the actual processing capacity of the consumer system, thereby achieving adaptive assessment of consumption pressure.
[0088] Ultimately, the system superimposes this potential change onto the membrane potential of the message queue at historical response times, thereby determining the membrane potential of the message queue at the current response time. This continuously updated membrane potential accurately and in real-time reflects the current consumption pressure of the message queue, providing a reliable basis for subsequently returning response signals to the producer and guiding it to adjust its message production strategy.
[0089] Through this mechanism, the proposed solution can dynamically and adaptively manage the consumption pressure of the message queue, avoiding the limitations of fixed thresholds or manual intervention in traditional methods, thereby effectively solving the problems of message backlog and insufficient resource utilization.
[0090] In one optional implementation, the message management method is implemented as follows.
[0091] When a message queue receives a message, the message management module records it in a message log service. This log service records the timestamp of each message entering the queue. Simultaneously, when a message is successfully consumed by a consumer and removed from the queue, its removal timestamp is also recorded in the log. Assuming the historical response time is T_prev and the current response time is T_curr, the message management module queries the message log service, filtering out all messages entering the message queue within the time period (T_prev, T_curr) as positive pressure messages, and all messages removed from the message queue as negative pressure messages, together forming a dynamic message set.
[0092] For each message in the dynamic message set, its pulse code can be a value representing the message size or processing complexity. For example, if the pulse code represents the message capacity, the input current of the message queue can be obtained by simply adding the pulse code values of all positive pressure messages and subtracting the pulse code values of all negative pressure messages. For example, if the sum of the pulse codes of positive pressure messages is P_in and the sum of the pulse codes of negative pressure messages is P_out, then the input current can be calculated as I = P_in - P_out.
[0093] The membrane resistance of the message queue can be provided by a separate resource monitoring module. This module monitors indicators such as CPU utilization and memory utilization of the consuming system in real time and converts them into membrane resistance values according to a preset mapping function (e.g., an inverse proportional function or an exponential decay function). For example, when the resource utilization of the consuming system is high, the membrane resistance value will increase accordingly, indicating a decrease in consumption capacity. Once the input current I and membrane resistance R are obtained, the potential change ΔV can be calculated using the analog form of Ohm's law, for example, ΔV = I × R.
[0094] Finally, this potential change ΔV is added to the membrane potential V_prev of the message queue at a historical response time to obtain the membrane potential V_curr = V_prev + ΔV at the current response time. This V_curr value is then used to generate a response signal, which is fed back to the producer to adjust its message production rate. For example, if V_curr is high, indicating high consumption pressure, the response signal will instruct the producer to reduce the production rate.
[0095] Through the above technical solution, this application can dynamically and adaptively calculate the membrane potential of the message queue, thereby reflecting the rate of change in message backlog status in real time and adapting to changes in the capacity of the consumption system. Specifically, by recording the dynamic message set managed by the message queue during historical statistical periods and distinguishing between positive and negative pressure messages, this solution can comprehensively capture the inflow and outflow of messages, avoiding the inaccuracies caused by relying on fixed time windows or static thresholds in traditional methods, making the membrane potential calculation closer to the actual message flow. The input current is obtained by summarizing the pulse codes of each message in the dynamic message set, accurately simulating the rate of change in message backlog status of the message queue during historical statistical periods, providing quantitative and real-time basic data for subsequent membrane potential calculation. Furthermore, the potential change is determined based on the input current and the membrane resistance simulating the consumption capacity of the consumption system, ensuring that the adjustment of the membrane potential not only considers message inflow and outflow but also fully integrates the actual processing capacity of the consumption system. This adaptive mechanism avoids the need for manual intervention and can automatically adjust the feedback intensity to producers according to the dynamic changes in the resources of the consumption system. Ultimately, by combining the potential change with the membrane potential at historical response times, the membrane potential at the current response time is continuously updated, ensuring that the membrane potential always accurately and promptly reflects the consumption pressure of the message queue. This dynamic and adaptive membrane potential calculation method, combined with the mechanism in the aforementioned message management method that returns response signals to producers based on membrane potential, forms an efficient and robust closed-loop control system. This effectively solves the problems of message backlog and insufficient resource utilization, significantly improving the stability and resource utilization efficiency of the message system.
[0096] In one embodiment of this application, before determining the potential change of the message queue based on the input current and the membrane resistance of the message queue, the resource utilization rate of the consumption system at the current response time can be obtained; the membrane resistance of the message queue is obtained by weighted mapping of the resource utilization rate, and the membrane resistance is negatively correlated with the resource utilization rate.
[0097] The purpose of acquiring the resource utilization rate of the consumption system at the current response moment is to monitor the current load of the consumption system in real time, providing basic data for subsequent dynamic adjustment of the membrane resistor. Specifically, metrics such as CPU utilization, memory usage, disk I / O, and network bandwidth utilization can be collected periodically through the API of the operating system or virtualization platform. In addition, resource usage can also be proactively reported by agents deployed in the consumption system, such as Prometheus Node Exporter or Datadog Agent. These agents can collect and send detailed system resource data at a preset frequency.
[0098] The membrane resistance of a message queue is obtained by weighted mapping of resource utilization. Its function is to synthesize multi-dimensional resource utilization into a single membrane resistance value, which quantifies the overall consumption capacity of the system. This mapping process can be achieved by defining a weighting function, multiplying different types of resource utilization (such as CPU, memory, and network I / O) by their respective weights, summing the results, and then applying a reverse mapping function (e.g., a monotonically decreasing function, such as `R = R_max × (1- f(U))`, where `U` is the weighted resource utilization and `f` is a normalization function) to obtain the membrane resistance. Alternatively, a machine learning model, such as linear regression or a neural network, can be used. This model is trained using historical data, taking multi-dimensional resource utilization as input, and directly outputting the membrane resistance value, ensuring a negative correlation between the membrane resistance and resource utilization.
[0099] Membrane resistance exhibits a negative correlation with resource utilization, clarifying the mathematical or logical relationship between them. When resource utilization is high (i.e., the system is busy and consumption capacity is declining), membrane resistance should be low, resulting in a larger change in membrane potential and a faster attainment of the producer suppression threshold. Conversely, when resource utilization is low (i.e., the system is idle and consumption capacity is sufficient), membrane resistance should be high, resulting in a smaller change in membrane potential and mitigating producer suppression. This negative correlation can be achieved by designing an inverse proportional function or an exponential decay function, such as `R = A / (U + B)` or `R = C × exp(-D × U)`, where `U` is the resource utilization rate, and `A, B, C, D` are positive constants. Alternatively, piecewise functions or lookup tables can be used to set corresponding membrane resistance values based on different intervals of resource utilization, ensuring an overall negative correlation.
[0100] This application's embodiments address the problem in traditional solutions where membrane resistance cannot reflect real-time changes in the actual consumption capacity of the consumer system by introducing real-time monitoring of the consumer system's resource utilization and dynamically mapping it to membrane resistance. Specifically, by acquiring the resource utilization of the consumer system at the current response time, real-time and accurate input data is provided for the dynamic calculation of membrane resistance, ensuring that the membrane resistance reflects the current true load status of the consumer system. Based on this, a weighted mapping of resource utilization is performed to obtain the membrane resistance of the message queue, and this membrane resistance is negatively correlated with resource utilization. This mapping mechanism is the core of this solution, integrating multi-dimensional resource utilization (e.g., CPU, memory, network I / O) into a single membrane resistance value. Through the negative correlation, when the consumer system's resources are strained (manifested as high utilization), the membrane resistance automatically decreases. Consequently, when determining the potential change based on the input current and membrane resistance, even if the input current (simulating the rate of change of message backlog status in the message queue during historical statistical periods) is the same, the potential change will be greater, causing the membrane potential of the message queue to rise faster, thus triggering producer suppression earlier. Conversely, when the consumer system has sufficient resources (manifested as low utilization), the membrane resistance automatically increases, reducing the potential change and slowing the rise in membrane potential, allowing producers to produce at a faster rate. This dynamic and adaptive method of obtaining membrane resistance enables the entire message management method to provide more precise and real-time suppression strength when returning response signals to producers based on membrane potential. This allows for adaptive adjustment of producer production strategies, avoiding message backlog or resource waste. Furthermore, it enables the neuron-based flow control mechanism to better cope with the dynamically changing environment of the consumer system, requiring no manual intervention and significantly improving the system's robustness and efficiency.
[0101] In an optional implementation, the consumption system can be assumed to be a microservice cluster consisting of multiple server nodes, whose message consumption capacity is mainly affected by the CPU utilization, memory utilization, and network I / O utilization of each node. The message management system can periodically (e.g., every second) obtain the current CPU utilization, memory utilization, and network I / O utilization by calling the monitoring API of each node in the consumption system (e.g., Prometheus's ` / metrics` interface). After obtaining this resource utilization data, firstly, according to preset utilization weights (e.g., CPU utilization weight set to 0.5, memory utilization weight set to 0.3, and network I / O utilization weight set to 0.2), the obtained resource utilizations are weighted and summed to obtain a comprehensive weighted resource utilization rate. Secondly, this weighted resource utilization rate is input into a preset activation function (e.g., a hyperbolic tangent function `tanh(x)` or a sigmoid function) for normalization, so that its value falls between 0 and 1. Finally, the membrane resistance of the message queue is calculated using a reverse mapping function (e.g., `membrane resistance = R_max × (1 - normalized weighted resource utilization)`, where `R_max` is the preset maximum membrane resistance value). In this way, the higher the weighted resource utilization, the larger the normalized value, and the smaller `1 - normalized value`, resulting in a smaller calculated membrane resistance. This demonstrates the negative correlation between membrane resistance and resource utilization.
[0102] Through the above technical solution, this application effectively solves the problem that membrane resistance cannot reflect changes in the actual consumption capacity of the consumption system in real time, avoiding the inaccurate and untimely producer adjustment strategies caused by static or preset membrane resistance. Specifically, by acquiring the resource utilization rate of the consumption system in real time, the dynamic nature of the membrane resistance is ensured, enabling it to accurately reflect the current load status of the consumption system. Simultaneously, a weighted mapping mechanism is introduced to integrate multi-dimensional resource utilization rates into a single membrane resistance value, making it negatively correlated with resource utilization. This means that when the consumption system is resource-constrained, the membrane resistance automatically decreases, accelerating the rise of the membrane potential and thus more promptly suppressing producers; when resources are sufficient, the membrane resistance automatically increases, slowing the rise of the membrane potential and allowing producers to produce faster. This adaptive membrane resistance adjustment mechanism enables the entire message management method to dynamically adjust the producer's message production strategy according to the actual processing capacity of the consumption system without manual intervention, significantly improving the system's adaptability, stability, and resource utilization, and effectively avoiding message backlog and resource waste.
[0103] In one embodiment of this application, resource utilization includes CPU utilization, memory utilization, and network I / O utilization; weighting the resource utilization to obtain the membrane resistance of the message queue may further include: performing a weighted operation on CPU utilization, memory utilization, and network I / O utilization according to preset utilization weights to obtain the weighted resource utilization of the consumption system; and performing a normalized mapping on the weighted resource utilization according to a preset activation function to obtain the membrane resistance of the message queue.
[0104] Specifically, resource utilization refers to the extent to which a consumer system uses its computing resources (such as CPU), storage resources (such as memory), and network communication resources (such as network I / O) within a specific time period. CPU utilization reflects the workload of the processor executing tasks, memory utilization reflects the system's memory usage, and network I / O utilization reflects the data transmission load of the network interface. These metrics are key parameters for evaluating the overall performance and load status of a consumer system. Together, they constitute a comprehensive view of system resource consumption, providing fundamental data for accurately quantifying consumption capacity.
[0105] Weighted calculation is a method that assigns different weights to different indicators according to their importance or influence, and then performs a comprehensive calculation. Here, the preset utilization weights reflect the relative importance of CPU, memory, and network I / O in the message processing process of the consuming system. For example, in CPU-intensive applications, CPU utilization may have a higher weight; while in I / O-intensive applications, network I / O utilization may have a higher weight. Through weighted calculation, multiple independent resource utilization indicators can be merged into a single, more representative weighted resource utilization rate that better represents the overall resource consumption status of the system. This avoids the distortion that may result from simple averaging and more accurately reflects the actual load of the consuming system. This weighted calculation can use a linear weighted summation method, i.e., Weighted Resource Utilization Rate = W_cpu × CPU Utilization Rate + W_mem × Memory Utilization Rate + W_net × Network I / O Utilization Rate, where W_cpu, W_mem, and W_net are the preset weights for CPU, memory, and network I / O, respectively, and their sum is 1. In addition, more complex weighted models can be used, such as training historical data based on machine learning models to learn the optimal weight allocation strategy, or dynamically adjusting the weights according to system configuration and application type.
[0106] An activation function is a non-linear function often used to transform input values to a specific output range, introducing non-linear characteristics. Normalization mapping refers to the process of transforming data to a specific range (such as 0 to 1 or -1 to 1) to eliminate dimensional differences and make the data comparable. Here, a pre-defined activation function is used to non-linearly map and normalize the weighted resource utilization rate, a comprehensive indicator, to a value representing membrane resistance. Membrane resistance simulates the consumption capacity of the message queue's consumption system; its value is negatively correlated with resource utilization rate—the higher the resource utilization rate, the lower the consumption capacity, and the larger the membrane resistance. Through the non-linear mapping of the activation function, the complex non-linear relationship between resource utilization rate and consumption capacity can be better captured, making the calculation of membrane resistance more accurate and robust. This activation function can use the Sigmoid function for normalization mapping, mapping the weighted resource utilization rate to the range of 0 to 1, and then converting it to membrane resistance through an inverse proportional relationship. Alternatively, the ReLU (Rectified Linear Unit) function or Leaky ReLU function can be used, combining linear transformation and normalization processing to convert the weighted resource utilization rate to membrane resistance.
[0107] In determining the membrane potential of the message queue, this application introduces a refined evaluation mechanism for resource utilization to more accurately simulate the consumption capacity of the consumption system. Specifically, this scheme first comprehensively considers three core resource indicators of the consumption system: CPU utilization, memory utilization, and network I / O utilization, ensuring that the monitoring of system load is multi-dimensional and comprehensive.
[0108] Given that different resources may have varying importance in message processing, this application further weights the utilization rates of these independent resources according to preset utilization rate weights. This weighting process effectively integrates resource consumption information from different dimensions, generating a weighted resource utilization rate that better represents the overall system load, thereby avoiding the bias of a single indicator or the distortion of simple averaging.
[0109] Building upon this, to transform this weighted resource utilization rate into a membrane resistance that can simulate consumption capacity, this embodiment employs a preset activation function for normalization mapping. The nonlinear characteristics of the activation function allow the membrane resistance calculation to better reflect the complex nonlinear relationship between resource utilization and consumption capacity. Simultaneously, normalization ensures that the membrane resistance value remains within a reasonable range and is negatively correlated with consumption capacity. Through this multi-index weighting and nonlinear mapping mechanism, this scheme obtains a more accurate and robust membrane resistance. Consequently, the potential change determined based on the membrane resistance and the final membrane potential can more accurately reflect the consumption pressure of the message queue, providing a more reliable basis for producers to adjust message production strategies. This method effectively solves the problem of inaccurate integration of multiple resource indicators in traditional schemes, improving the quantitative accuracy of the actual processing capacity of the consumption system.
[0110] As an optional implementation, the message management system can periodically (e.g., every second) collect the CPU utilization, memory utilization, and network I / O utilization of each node in the consumption system. Assume the preset utilization weights are W_cpu = 0.5, W_mem = 0.3, and W_net = 0.2. When the collected CPU utilization is 70%, memory utilization is 60%, and network I / O utilization is 40%, a weighted calculation is first performed to obtain the weighted resource utilization rate = 0.5 × 70% + 0.3 × 60% + 0.2 × 40% = 35% + 18% + 8% = 61%. Subsequently, this weighted resource utilization rate is input into a preset activation function for normalization mapping. For example, an adjusted Sigmoid function can be used to map the weighted resource utilization rate from 0 to 100% to a membrane resistance value from 0 to 100, with a negative correlation in the mapping relationship. Specifically, a lower weighted resource utilization rate results in a lower membrane resistance, indicating stronger consumption capacity; conversely, a higher weighted resource utilization rate results in a higher membrane resistance, indicating weaker consumption capacity. For instance, when the weighted resource utilization rate is 61%, this activation function mapping yields a specific membrane resistance value, such as 50 ohms. This membrane resistance value is then used to calculate the potential change in the message queue, thereby updating the membrane potential.
[0111] Through the above technical solution, this application effectively solves the problem of inaccurate integration of multiple resource indicators when evaluating the consumption capacity of a consumption system using traditional methods. By incorporating CPU utilization, memory utilization, and network I / O utilization into the calculation and performing weighted calculations according to preset weights, the overall load status of the consumption system can be comprehensively and accurately reflected, avoiding the one-sidedness of a single indicator. Furthermore, by using a preset activation function to perform nonlinear normalization mapping on the weighted resource utilization, the membrane resistance calculation can more precisely capture the complex relationship between resource utilization and consumption capacity, thereby obtaining a more accurate and robust membrane resistance. This accurate membrane resistance can more accurately simulate the actual consumption capacity of the consumption system, thus enabling the membrane potential of the message queue to more realistically reflect consumption pressure. Ultimately, this helps producers receive more accurate response signals, enabling them to adjust message production strategies more rationally and promptly, effectively avoiding message backlog or resource waste, and improving the stability and resource utilization efficiency of the entire message management system.
[0112] In one embodiment of this application, the activation function is a hyperbolic tangent function used for nonlinear mapping of weighted resource utilization.
[0113] Activation functions play a central role in neural networks and nonlinear mappings. Their main function is to transform input signals into output signals and introduce nonlinear characteristics. In resource management scenarios, activation functions are used to convert weighted resource utilization rates into a value with a specific range and distribution to simulate the membrane resistance of message queues. Common activation functions, besides the hyperbolic tangent function, include the sigmoid function, the ReLU (Rectified Linear Unit) function, and the Leaky ReLU function. These functions each have their own characteristics. For example, the sigmoid function maps the input to between 0 and 1, while the ReLU function remains linear in the positive interval and zero in the negative interval. The hyperbolic tangent function (tanh function) is an S-shaped nonlinear activation function whose output range is typically between -1 and 1. It has a zero-centered property, meaning the average value of the output is close to zero, which helps accelerate convergence in certain computational scenarios. In the process of mapping weighted resource utilization to membrane resistance, the hyperbolic tangent function can provide a smooth nonlinear transformation, avoiding the boundary distortion or insufficient sensitivity problems that may be caused by linear mapping, thus making the calculation results of membrane resistance more accurate and stable.
[0114] This application further optimizes the determination process of membrane resistance by specifically defining the activation function as the hyperbolic tangent function. In the aforementioned message management method, to accurately simulate the consumption capacity of the consumption system where the message queue resides, the resource utilization rate of the consumption system needs to be converted into membrane resistance. This conversion process first obtains the weighted resource utilization rate of the consumption system by weighting the CPU utilization rate, memory utilization rate, and network I / O utilization rate. Subsequently, to normalize this weighted resource utilization rate and introduce nonlinear characteristics, an activation function needs to be applied. As a nonlinear function with a smooth S-shaped curve, the hyperbolic tangent function can effectively map any range of weighted resource utilization rates to a fixed interval, typically -1 to 1. This nonlinear mapping avoids the limitations that linear functions may have when dealing with complex resource usage patterns, such as the inability to accurately reflect the impact on consumption capacity when resource utilization is extremely high or low. At the same time, the zero-centeredness characteristic of the hyperbolic tangent function helps to make the calculation results of membrane resistance more stable and have good discriminative power. In this way, the membrane resistance can more accurately reflect the actual consumption capacity of the consumption system, thus providing a more reliable basis for determining the membrane potential of the message queue, and enabling the response signal to more accurately guide the producer to adjust the message production strategy.
[0115] As an optional implementation, when determining the membrane resistance of the message queue, the system first obtains the CPU utilization, memory utilization, and network I / O utilization of the consuming system. These utilizations are assumed to be `U_cpu`, `U_mem`, and `U_net`, respectively. The system then performs a weighted calculation on these utilizations according to preset utilization weights `W_cpu`, `W_mem`, and `W_net`, for example, by using the formula `Weighted Resource Utilization = W_cpu × U_cpu + W_mem × U_mem + W_net × U_net` to calculate the weighted resource utilization of the consuming system. Subsequently, this weighted resource utilization is used as input and substituted into a hyperbolic tangent function for normalization mapping. For example, if the weighted resource utilization, after appropriate scaling or offset, falls within a certain range, the hyperbolic tangent function will smoothly map it to the range of -1 to 1. Based on this, further transformations (such as linear inverse mapping) can ensure that the final membrane resistance value is negatively correlated with the weighted resource utilization. For example, when the weighted resource utilization rate is high, the final membrane resistance value will tend to be lower, and vice versa, thus accurately reflecting the consumption capacity of the consumption system.
[0116] By employing the aforementioned technical solution, the activation function is explicitly defined as the hyperbolic tangent function, effectively resolving the accuracy issues that may arise when normalizing weighted resource utilization to membrane resistance. The smooth, nonlinear mapping capability provided by the hyperbolic tangent function allows the membrane resistance to more accurately and stably reflect the actual consumption capacity of the consumption system, avoiding mapping distortion or insufficient sensitivity caused by inappropriate activation function selection. This ensures higher reliability of the membrane resistance calculation results, thereby enabling the membrane potential determined based on the membrane resistance to more accurately simulate the consumption pressure of the message queue. Ultimately, the response signals received by the producer will more accurately reflect the true state of the consumption system, allowing for more reasonable and timely adjustments to message production strategies, effectively avoiding message backlog or resource waste, and improving the stability and efficiency of the entire message management system. Figure 4 A flowchart summarizing pulse coding is shown in one embodiment of this application. For example... Figure 4 As shown, based on the above embodiments, step S224 may further include the following steps S224a to S224b.
[0117] S224a: Decode the pulse code of each message in the dynamic message set to obtain the pulse frequency of the message.
[0118] S224b: The pulse frequencies of each message in the dynamic message set are weighted and fused to obtain the input current of the message queue. The input current is positively correlated with the pulse frequency of positive voltage messages and negatively correlated with the pulse frequency of negative voltage messages.
[0119] Specifically, pulse coding is used to simulate the resource consumption of messages; essentially, it's the result of encoding information such as message capacity. To more accurately quantify the resource consumption intensity of messages, these pulse codes need to be decoded to restore them to a more intuitive and calculable pulse frequency. The pulse frequency can be understood as the intensity of a message's demand on system resources per unit time or its impact on the message queue backlog. For example, decoding can be done by using a pre-defined lookup table to directly map a specific pulse code to its corresponding pulse frequency value; or, a reverse algorithm can be used to convert the pulse code back to its original pulse frequency representation according to the encoding rules. After obtaining the pulse frequencies of each message, these frequencies need to be weighted and fused to comprehensively reflect the overall message backlog change rate of the message queue within a specific time period, i.e., the input current.
[0120] The purpose of weighted fusion is to differentiate the impact of different message types on queue backlog. For example, positive weights can be assigned to positive-pressure messages (messages entering the queue) and negative weights to negative-pressure messages (messages leaving the queue), and then the pulse frequencies of all messages can be weighted and summed. Alternatively, the weighting coefficients can be dynamically adjusted based on the message's priority, importance, or actual impact on system resource consumption, allowing the input current to more accurately reflect the actual dynamic changes in the message queue. A positive correlation between the input current and the pulse frequency of positive-pressure messages means that the more messages entering the queue and the higher their pulse frequency, the larger the input current, reflecting an increasing trend of message queue backlog. Conversely, a negative correlation between the input current and the pulse frequency of negative-pressure messages means that the more messages leaving the queue and the higher their pulse frequency, the smaller the input current (or the larger the negative value), reflecting a decreasing trend of message queue backlog. This correlation ensures that the input current accurately reflects the combined impact of message inflows and outflows on the backlog status.
[0121] The message management method of this application first writes the message to a message queue upon receiving a message from a producer. To effectively manage the message queue and return appropriate response signals to the producer to adjust its production strategy, the membrane potential of the message queue needs to be determined based on the pulse code corresponding to the message. A key step in determining the membrane potential is to aggregate the pulse codes of each message in the dynamic message set to obtain the input current of the message queue. This input current is used to simulate the rate of change of the message backlog state of the message queue over a historical statistical period. To calculate this input current more accurately, the scheme of this application first decodes the pulse codes of each message in the dynamic message set to obtain the pulse frequency of each message. The pulse code is an abstract representation of message resource consumption; by decoding it into a pulse frequency, the influence of a single message on the message queue backlog state can be quantified more intuitively and accurately. Subsequently, these decoded pulse frequencies are weighted and fused to comprehensively evaluate the overall dynamic changes of the message queue. In the weighted fusion process, the nature of the messages is fully considered: for positive-pressure messages entering the message queue during the historical statistical period, their pulse frequency contributes positively to the input current, meaning the input current is positively correlated with the pulse frequency of positive-pressure messages, reflecting the increasing backlog trend caused by message inflow; conversely, for negative-pressure messages leaving the message queue during the historical statistical period, their pulse frequency contributes negatively to the input current, meaning the input current is negatively correlated with the pulse frequency of negative-pressure messages, reflecting the decreasing backlog trend caused by message outflow. Through this refined decoding and weighted fusion mechanism, the obtained input current can more realistically and accurately simulate the rate of change of message backlog status in the message queue during a specific period. This precise input current is then used in conjunction with the membrane resistance of the message queue to determine the potential change of the message queue, and ultimately to determine the membrane potential of the message queue at the current response moment, thus providing a more reliable basis for returning response signals to the producer.
[0122] As an optional implementation, assume that the message queue receives two positive pressure messages M1 and M2 and removes one negative pressure message M3 within a certain historical statistical period. The pulse code for message M1 is "01", the pulse code for message M2 is "10", and the pulse code for message M3 is "00". First, the system decodes these pulse codes to obtain the pulse frequencies. For example, a decoding rule can be preset: the code "00" corresponds to a pulse frequency of 10Hz, the code "01" corresponds to a pulse frequency of 20Hz, and the code "10" corresponds to a pulse frequency of 30Hz. According to this rule, the pulse frequency of message M1 is 20Hz, the pulse frequency of message M2 is 30Hz, and the pulse frequency of message M3 is 10Hz. Next, these pulse frequencies are weighted and fused to obtain the input current of the message queue. Assume that the weight of the positive pressure message is +1 and the weight of the negative pressure message is -1. Therefore, the input current can be calculated as follows: Input current = (Pulse frequency of M1 × Positive voltage weight) + (Pulse frequency of M2 × Positive voltage weight) + (Pulse frequency of M3 × Negative voltage weight). Substituting the values, the input current = (20Hz × 1) + (30Hz × 1) + (10Hz × -1) = 20 + 30 - 10 = 40Hz. This calculated result of 40Hz is the input current of the message queue in the current historical statistical period, reflecting the overall backlog trend of the message queue. In this way, the system can accurately quantify the combined impact of message inflow and outflow on the queue backlog state, thus providing accurate input for subsequent membrane potential calculations.
[0123] Through the above technical solution, this application can more accurately simulate the dynamic changes of message queues. Specifically, by decoding pulse codes, abstract encoded information is transformed into quantifiable pulse frequencies, allowing for a more accurate representation of the resource consumption intensity of each message. Based on this, by weighted fusion of the pulse frequencies of positive and negative pressure messages, and by clarifying the positive correlation between the input current and the pulse frequency of positive pressure messages, as well as the negative correlation with the pulse frequency of negative pressure messages, this application can finely distinguish the different impacts of message inflows and outflows on the message queue backlog state. This allows the obtained input current to more realistically and accurately reflect the rate of change in the message backlog state of the message queue within historical statistical periods, thus solving the problem of not being able to accurately distinguish the impact of positive and negative pressure messages when directly summarizing pulse codes. This more accurate input current calculation further improves the accuracy of membrane potential determination, enabling the system to return response signals to producers more promptly and reasonably based on the actual consumption pressure of the message queue. This allows for precise adjustment of the producer's message production strategy, effectively avoiding message backlog and fully utilizing the processing capacity of the consumption system. In one embodiment of this application, before determining the membrane potential of the message queue based on the pulse code corresponding to the message, the message can be parsed to obtain the pulse code carried in the message. The pulse code is obtained by the producer encoding the message capacity.
[0124] Message parsing aims to identify and extract useful information fragments from received raw message data. This involves analyzing the message's structure, format, and content to locate and separate specific data fields. One implementation involves encapsulating the message into a data packet of a specific format, such as JSON, XML, or a custom binary protocol, before sending. The parsing process then extracts the required data according to predefined protocol specifications, using field offsets, delimiters, or tags. Another implementation utilizes the message body parsing capabilities provided by message queue systems. For example, message middleware typically allows users to define message serialization and deserialization mechanisms, thus automatically completing parsing before the message is consumed.
[0125] Surge coding is a key attribute of a message, transforming its business characteristics into numerical values that can be used to simulate neuronal behavior. One implementation involves reserving a dedicated field in the message structure to store the surge code, which the parser directly reads. Another implementation may involve the surge code existing in some form of encryption or compression within the message, requiring decryption or decompression after parsing to obtain the final surge code value. Furthermore, the surge code is obtained by the producer encoding the message's capacity, clarifying its source and generation mechanism. It is not randomly generated but produced by the message sender (producer) through a specific encoding process based on the message's capacity (i.e., message size or data volume). Message capacity directly reflects the network bandwidth, storage space, and processing resources consumed by the message. One implementation involves the producer first measuring the message's byte size as the capacity when constructing the message, and then converting this capacity value into surge code using a predefined function (e.g., linear mapping, logarithmic mapping, or piecewise function). Another approach is for the producer to generate pulse codes using different encoding rules based on the message type or priority and its message capacity, in order to more precisely reflect the resource consumption characteristics of different messages.
[0126] This parsing mechanism ensures reliable extraction of pulse codes, avoiding errors in membrane potential calculation caused by missing codes or format inconsistencies. Furthermore, the pulse code is not generated arbitrarily, but rather obtained by the producer through encoding processing based on the message's capacity. This means the pulse code directly reflects the actual resource consumption of the message, such as its data size and complexity, thus providing a realistic and quantitative input for membrane potential calculation. In this way, the message queue can dynamically assess its consumption pressure based on the actual resource consumption of the message, making the simulation of membrane potential more accurate. This mechanism, which transforms the physical attributes of the message (message capacity) into neuron model parameters (pulse codes) and ensures their reliable acquisition, lays a solid foundation for subsequent membrane potential determination based on pulse codes. This enables the entire message management system to perceive and respond to consumption pressure more accurately and in real-time, effectively avoiding message backlog or resource waste, and improving the system's adaptability to changes in consumption capacity.
[0127] As an optional implementation, when the message management system receives a message from a producer, the message may be a data packet containing order information. Before writing the message to the message queue, the system starts a message parsing module. This module can identify the message header information, such as message type and protocol version, and extract specific fields from the message body according to predefined protocol specifications. For example, if the message is in JSON format, the parsing module uses a JSON parsing library (such as Jackson or Gson) to parse the message string and locate the preset "pulseCode" field. The value of the "pulseCode" field is the pulse code carried in the message. This pulse code is obtained when the producer generates the message by calculating the message size (e.g., the message's byte size) and applying a preset mapping function (such as dividing the message size by a constant factor). For example, a message with a message size of 1KB may be encoded as pulse code 10, while a message with a message size of 2KB may be encoded as pulse code 20. In this way, the message management system can accurately obtain the pulse code reflecting message resource consumption, providing reliable data input for subsequent membrane potential determination.
[0128] Through the above technical solution, this method ensures the reliable and accurate acquisition of the pulse code carried in the message before determining the membrane potential of the message queue. Since the pulse code is obtained by the producer through encoding processing based on the message's message capacity, it directly quantifies the message's resource consumption, allowing the determination of the membrane potential to be based on the actual message load. This significantly improves the accuracy and real-time performance of simulating consumption pressure using the membrane potential, enabling the message management system to more accurately perceive the backlog status and changes in consumption pressure of the message queue. Ultimately, the producer can receive more accurate response signals and adjust its message production strategy accordingly, effectively avoiding system crashes caused by message backlog, while also making fuller use of the consumer cluster's processing capacity, thus improving the overall stability and resource utilization efficiency of the messaging system.
[0129] In one embodiment of this application, the pulse coding method includes: mapping the message capacity to obtain the message pulse frequency; and encoding the pulse frequency according to a preset coding rule to obtain pulse coding.
[0130] The process involves mapping the message's capacity to obtain its pulse frequency, aiming to transform the message's actual size (i.e., message capacity) into a value that quantifies its resource consumption. This step is fundamental to generating pulse coding, ensuring that subsequent coding accurately reflects the message's resource consumption characteristics. Specifically, this can be achieved in several ways: one is linear mapping, where the message capacity is directly converted to pulse frequency using a preset scaling factor, with a higher pulse frequency for larger message capacities; another is piecewise linear mapping, setting different conversion slopes for different message capacity intervals to accommodate the resource consumption characteristics of messages of varying sizes; and a nonlinear mapping, such as logarithmic or exponential functions, can be used to more precisely capture the complex relationship between resource consumption and message capacity.
[0131] The pulse frequency is encoded according to a preset encoding rule to obtain pulse code. This aims to convert the obtained pulse frequency into a standardized and recognizable encoded form for transmission, parsing, and use in the message management system. This step ensures the consistency and resolvability of the pulse code throughout the system. Specifically, the preset encoding rule can be to convert the pulse frequency value into a binary string of a specific length, for example, rounding the frequency value to the nearest integer and then converting it into a fixed-length binary code; or, the encoding rule can be defined as dividing the pulse frequency into several discrete intervals, each interval corresponding to a preset encoded value, thus achieving discretized encoding; in addition, a variable-length encoding scheme can be used to dynamically adjust the encoding length according to the pulse frequency magnitude to optimize encoding efficiency.
[0132] This encoding method maps the message capacity, first converting the actual message size into a pulse frequency that quantifies its resource consumption. This conversion is crucial; it concretizes the abstract message capacity into a measurable frequency signal, laying the foundation for subsequent encoding. Then, this pulse frequency is encoded according to preset encoding rules to obtain the final pulse code. The entire process forms a complete chain from the original message capacity to the standardized pulse code, ensuring that the resource consumption of each message can be accurately and consistently quantified and represented. This method solves the problem of inconsistent pulse code generation, enabling the pulse code to truly reflect the message capacity. The pulse code generated in this way can be accurately carried in messages by producers and used by message management methods to determine the membrane potential of the message queue. This allows the membrane potential to more accurately simulate the consumption pressure of the message queue, thereby guiding producers to adjust message production strategies and improving the accuracy and responsiveness of the entire message management system.
[0133] As an optional implementation, the above technical means can be implemented with reference to the following example. Assume the message capacity is in bytes. When mapping the message capacity to obtain the message pulse frequency, a linear mapping relationship can be set, for example, every 1KB (1024 bytes) of message capacity corresponds to a 1Hz pulse frequency. Therefore, a message with a capacity of 10KB will be mapped to a 10Hz pulse frequency, and a message with a capacity of 100KB will be mapped to a 100Hz pulse frequency. When encoding the pulse frequency according to a preset encoding rule to obtain the pulse code, a simple encoding rule can be defined: directly convert the pulse frequency value into a fixed-length binary string. For example, if the pulse frequency is 10Hz, it is encoded as "00001010"; if the pulse frequency is 100Hz, it is encoded as "01100100". This encoding method ensures that the pulse frequency can be recognized and processed by the system in a uniform format.
[0134] Through the above technical solution, this application provides a standardized and quantifiable pulse code generation mechanism. This mechanism effectively solves the problem of inconsistent pulse code generation by precisely mapping the message capacity to pulse frequency and further encoding it into pulse code according to preset rules, ensuring that the pulse code accurately and objectively reflects the actual resource consumption of the message. This accuracy and consistency enable message management methods to obtain more reliable input data when subsequently determining the membrane potential of the message queue, thus allowing the membrane potential to more realistically simulate the consumption pressure of the message queue. Ultimately, this helps producers adjust message production strategies based on more accurate feedback signals, avoiding message backlog or resource waste, and improving the efficiency and stability of the entire message management system.
[0135] Figure 5 A flowchart illustrating the return of a response signal is shown in one embodiment of this application. For example... Figure 5 As shown, based on the above embodiments, step S230 may further include the following steps S232 to S234.
[0136] S232: Map the membrane potential to obtain the suppression strength, which is used to quantify the degree to which the membrane potential suppresses the producer's message production rate.
[0137] S234: Return a response signal to the producer based on the suppression strength.
[0138] The phrase "mapping the membrane potential to obtain the suppression strength" refers to transforming the abstract indicator (membrane potential) simulating message queue consumption pressure into a quantifiable indicator (suppression strength) with clear physical meaning and operability. Changes in the membrane potential reflect the backlog or processing load of the message queue, while the suppression strength quantifies the degree to which this consumption pressure affects the producer's message production speed. One implementation method is to use a linear mapping function. For example, the membrane potential value can be converted into suppression strength through a preset scaling factor and offset, i.e., `suppression strength = a × membrane potential + b`, where `a` and `b` are constants determined based on system characteristics and the desired suppression effect. Another implementation method is to use a nonlinear mapping function. For example, a piecewise function can be used, applying different mapping rules in different membrane potential ranges to achieve differentiated responses to changes in consumption pressure; or exponential or logarithmic functions can be used, making the suppression strength change slowly when the membrane potential is low and rapidly when the membrane potential is high, thus better simulating the actual system response. In addition, it can also be achieved by using a lookup table. A table of correspondence between membrane potential and inhibition intensity can be pre-constructed, and the system can directly look up the corresponding inhibition intensity based on the current membrane potential value during operation.
[0139] "Suppression strength is used to quantify the degree to which membrane potential inhibits the message production rate of producers" means that suppression strength, as a quantitative indicator, plays a crucial role in providing an objective and measurable value that directly reflects the degree to which the current message queue's consumption pressure restricts the producer's message production behavior. It acts as a bridge between consumption pressure and production rate adjustment, enabling the system to shift from qualitative judgment to quantitative control. For example, suppression strength can be directly used as an adjustment coefficient for the producer's message production rate. The producer can calculate its expected production rate based on the received suppression strength according to a preset formula (e.g., `actual production rate = maximum production rate × (1 - suppression strength)`). Furthermore, suppression strength can also serve as an input parameter for producer-side flow control algorithms (e.g., rate-limiting or window-adjustment-based algorithms), guiding these algorithms to dynamically adjust their internal parameters, thereby achieving fine-grained control over message production rate.
[0140] "Returning a response signal to the producer based on the suppression strength" refers to the feedback information sent by the message queue management system to the producer. Its purpose is to transmit quantified consumption pressure information (i.e., suppression strength) to the producer to guide the producer in adjusting its message production strategy. One implementation is that the response signal directly contains the specific numerical value of the suppression strength. After receiving this value, the producer adjusts its message production rate according to its own preset logic or algorithm. Another implementation is that the response signal can be a control command containing a suggested production speed or production rate adjustment instruction. After receiving the command, the producer directly executes the specified production speed or adjustment operation. It can also be achieved by sending different types of response signals or status codes, each signal or status code corresponding to a preset suppression strength range or production mode. The producer switches to the corresponding production mode based on the received signal, thereby indirectly achieving production speed adjustment based on suppression strength.
[0141] In the message management method of this application, when the message queue management system receives a message sent by a producer, it first writes the message into the message queue. Subsequently, the system determines the membrane potential of the message queue based on the pulse code corresponding to the message. The pulse code simulates the resource consumption of the message, while the membrane potential simulates the consumption pressure of the message queue. To enable the system to more accurately guide the producer in adjusting its message production strategy, this scheme further maps the membrane potential after determination to obtain a quantified suppression strength. This suppression strength explicitly quantifies the degree to which the membrane potential suppresses the producer's message production speed, transforming the abstract consumption pressure into a specific, operable control parameter. Finally, the system returns a response signal to the producer based on this quantified suppression strength. Upon receiving this response signal, the producer can dynamically and accurately adjust its message production speed based on the suppression strength information it contains. Through the above process, this scheme establishes a quantified bridge between the consumption pressure of the message queue (membrane potential) and the producer's message production speed adjustment (response signal). While the basic approach can return a response signal based on membrane potential, it may lack clear quantitative evidence regarding the degree of suppression on production speed, leading to imprecise producer adjustment strategies. This approach introduces a mapping process from membrane potential to suppression intensity, enabling the response signal to carry more instructive quantitative information. This not only allows producers to more accurately understand the current pressure status of the consumption system, thus enabling refined adjustments to production speed, but also avoids message backlog or resource idleness caused by inaccurate adjustments. This quantitative mechanism significantly improves the message management system's ability to perceive and respond to consumption pressure, ensuring a dynamic balance between message production and consumption, thereby improving the overall system stability and resource utilization efficiency.
[0142] As a specific implementation method, the message queue management system can implement the above technical solution according to the following steps. First, the system continuously monitors the membrane potential of the message queue. Assume the membrane potential ranges from 0 to 100 units, where 0 represents no pressure and 100 represents maximum pressure. To convert the membrane potential into inhibition strength, the system can use a non-linear mapping function. For example, when the membrane potential is below 50 units, the inhibition strength can increase at a slower rate, e.g., `inhibition strength = 0.01 × membrane potential`; when the membrane potential reaches or exceeds 50 units, the inhibition strength can increase at a faster rate, e.g., `inhibition strength = 0.5 + 0.02 × (membrane potential - 50)`. Thus, when consumption pressure is low, the system exerts a weaker inhibitory effect on the producer, while when consumption pressure is high, the inhibitory effect rapidly strengthens to more effectively control message production. After obtaining the inhibition strength, the system constructs a response signal and sends it to the producer. The response signal can be a data packet containing a suppression strength value, such as a JSON message `{"inhibition_strength": 0.75}`, where 0.75 is the calculated suppression strength value. Upon receiving this response signal, the producer will parse out the suppression strength. The producer can internally set a message production rate adjustment model to adjust the actual message production rate based on the suppression strength. In this way, the producer can precisely adjust its production rate quantitatively according to the real-time consumption pressure of the message queue, thereby avoiding message backlog or resource waste.
[0143] Through the above technical solution, this application effectively solves the problem that in message management, the lack of a quantitative mechanism for the degree of inhibition of message production speed by membrane potential leads to inaccurate adjustment strategies, an inability to reflect changes in consumption pressure in real time, and potential message backlog or resource idleness. Specifically, by mapping the membrane potential to obtain the inhibition strength, this solution transforms the abstract consumption pressure into a specific, quantifiable indicator. This enables the message queue management system to assess the degree to which current consumption pressure limits the producer's production speed in a more accurate and objective way. Based on the response signal returned by this quantified inhibition strength, it can provide producers with clear adjustment basis, thereby guiding producers to make fine-grained adjustments to message production speed. This quantitative and accurate feedback mechanism significantly improves the message management system's ability to perceive and respond to consumption pressure, ensuring that producers can dynamically and accurately match the processing capacity of consumers, effectively avoiding excessive message backlog or idle system resources, thereby improving the stability and operating efficiency of the entire message system.
[0144] In one embodiment of this application, the suppression strength is related to the producer's message generation speed as follows:
[0145] in, It is the producer's message production speed. It is the maximum message production rate of the producer. It is the intensity of inhibition. It is a preset suppression constant. This application provides an explicit and computable feedback mechanism that enables producers to adaptively adjust based on the system's current consumption capacity. This relationship can be implemented by deploying a control module on the producer side, which receives the suppression strength. As input, and according to preset and The parameter is used to calculate the appropriate message production rate, v, in real time. Alternatively, it can be implemented using a lookup table. The message production rate v corresponding to different suppression intensities I is pre-calculated and stored in a lookup table. The producer then determines the appropriate rate based on the received suppression intensity. Query the corresponding production speed.
[0146] Here, v represents the producer's message production rate, referring to the number of messages or data sent to the message queue per unit of time. It is a direct quantitative indicator of the producer's behavior and a target parameter that needs to be dynamically adjusted in this scheme. The producer can adjust the message production rate v by controlling the rate of its message sending threads, limiting the number of messages sent per second, or limiting the number of data bytes sent per second. Alternatively, the producer can indirectly control the message production rate v by adjusting the message batch size or the sending interval.
[0147] It is the maximum message production rate of the producer, referring to the rate at which no inhibition (i.e., the intensity of inhibition) occurs. The theoretically highest message production rate that a producer can achieve when the value is 0. It represents the maximum processing capacity of a producer under ideal conditions. It could be a fixed configuration parameter set during system initialization based on factors such as the producer's hardware performance and network bandwidth. Or, It can also be a parameter that is dynamically adjusted based on the scaling up or down of the producer cluster or the resource allocation, to reflect the actual maximum capacity of the producer cluster.
[0148] It is the suppression strength, a quantitative value calculated by the message queue based on its membrane potential (simulating consumption pressure), used to indicate the extent to which producers should reduce their message production rate. The higher the value, the greater the consumption pressure, and the stronger the inhibition that producers should experience. Inhibition Intensity The membrane potential can be calculated by the message queue management module using a mapping function and sent to the producer as part of the response signal. Alternatively, the suppression strength... It can also be a normalized value, for example, between 0 and 1, where 0 represents no suppression and 1 represents complete suppression.
[0149] It is a preset inhibition constant, a preset system parameter used to adjust the inhibition intensity. The sensitivity to the impact on message production speed v. It determines the sensitivity of the suppression strength. The steepness of the decrease in production rate v during the change. The larger the value, the less sensitive the producer is to the intensity of inhibition; The smaller the value, the more sensitive the producer is to the intensity of inhibition. The system administrator can configure it according to the actual business scenario and system performance requirements, for example, through configuration files or a management interface. Alternatively, Optimization can also be achieved through historical data analysis or machine learning models to find the value that best balances system throughput and stability.
[0150] This application embodiment establishes suppression strength. The precise mathematical relationship between message production rate v and message queue consumption pressure (via membrane potential and inhibition strength) (Quantization) directly translates into production speed adjustment instructions executable by the producer. Specifically, when the message queue receives a message sent by the producer, it determines the membrane potential of the message queue based on the message's pulse code. This membrane potential simulates the consumption pressure of the message queue. Subsequently, the message queue obtains the suppression strength based on the membrane potential mapping. The intensity of inhibition The degree to which membrane potential inhibits the producer's message production rate was quantified. The producer receives this inhibition strength. Then, utilize the preset maximum message production speed. and suppression constant The system calculates the appropriate message production rate, *v*, in real time. Producers then adjust their message sending rate based on the calculated *v* value. This mechanism forms a closed-loop feedback control system, enabling producers to respond dynamically to message queue consumption pressure in real time, thus avoiding message backlog or resource idleness. This mathematical relationship provides an adaptive adjustment strategy that requires no manual intervention or complex predictive models, ensuring a balance of capabilities between producers and consumers.
[0151] Through the above technical solution, this application provides a precise mathematical relationship for real-time adjustment of the producer's message production speed. This relationship allows the producer to adjust the message queue's consumption pressure (through suppression strength) based on the message queue's consumption pressure. This approach uses quantification to adaptively adjust, effectively addressing the problems of traditional solutions that lack precise feedback mechanisms and rely on manual thresholds or complex prediction models. This avoids message backlogs and potential cascading crashes caused by excessively fast production speeds, while also preventing resource idleness and wasted processing capacity due to excessively slow production speeds. Ultimately, it achieves a dynamic balance between the capabilities of producers and consumers, improving the stability and resource utilization efficiency of the entire messaging system.
[0152] Figure 6 This diagram illustrates the functional architecture of an embodiment of this application in an application scenario. Figure 6 As shown, the functional architecture in this application scenario involves the interaction between producers, message queues, neural network controllers, and consumer clusters. The implementation details of the technical solution in this application scenario are described in detail below.
[0153] The messages delivered by the producer to the message queue are accompanied by pulse codes. Pulse codes use an eight-bit binary format to achieve high bandwidth utilization and fast parsing. The content is essentially the message body size p mapped to the pulse frequency. The message size is generally proportional to the resource consumption required for consumption.
[0154]
[0155] For example, suppose producer A needs to deliver a message to message queue Q. The message size is medium, which is mapped to a pulse frequency of 30Hz. Producer A encodes the message as an 8-bit binary pulse code, such as 01100101, representing a pulse frequency of 30Hz.
[0156] The message queue receives messages from producers, maintains pulse codes in the storage medium, triggers membrane potential calculation every millisecond, and uses the pulse codes of messages in the storage medium within the trigger interval to calculate the real-time membrane potential in the queue through differential equations.
[0157] The differential equation for calculating membrane potential is the core innovation of this patent, and its derivation integrates neuroscience principles and system control theory. The fundamental equation is the neuronal leak-in-firing model. In neuroscience, changes in neuronal membrane potential follow the leak-in-firing model (LIF Model):
[0158] Where u represents the membrane potential (mV), τ represents the membrane time constant (ms), R represents the membrane resistance (MΩ), and I(t) represents the input current (nA).
[0159] This application adapts neuroscience models to message queue scenarios:
[0160] The mapping relationship of the key parameters is as follows.
[0161]
[0162] Where u refers to the existing queue load potential and the calculated value obtained from the previous membrane potential calculation, stored in the storage medium. fj refers to the pulse input frequency carried by the pulse code in the message. The pulse input frequencies within the trigger interval need to be summed to obtain the accumulation change rate, and then multiplied by the adaptive synaptic weight to obtain the potential change difference per unit time. wj refers to the adaptive synaptic weight, which needs to be obtained from the consumer cluster and grows nonlinearly with the system load.
[0163] On the consumer cluster side, the usage of CPU, memory, and network I / O resources is obtained through the API provided by the operating system. Normalized weighting is then applied, and the weighted values are compressed to the [0, 1] interval using the hyperbolic tangent function tanh to prevent the synaptic weights from becoming uncontrollable due to excessively large absolute load values, ultimately yielding the adaptive synaptic weight wj.
[0164] For example, suppose consumer cluster C obtains the following resource usage information through the operating system API: CPU utilization is 20%, memory utilization is 30%, and network I / O utilization is 10%.
[0165] Normalize resource utilization to the range [0, 1]. Typically, resource utilization is already expressed as a percentage and can be used directly. For example, CPU utilization is represented as 0.20%, memory utilization as 0.30%, and network I / O utilization as 0.10.
[0166] Each resource is assigned a weight based on its importance. For example, the weights for CPU, memory, and network I / O are 0.5, 0.3, and 0.2, respectively.
[0167] Calculate a weighted value for the above resource utilization rates and weights: 0.20×0.4+0.30×0.3+0.10×0.3=0.80+0.90+0.30=0.20.
[0168] By compressing the hyperbolic tangent function tanh, tanh(0.20)≈0.1973. Compress to the [0, 1] interval
[0169] Rounding to one decimal place, we get wj = 0.6.
[0170] The time constant τ must also be set, as it controls the rate of change of the membrane potential. It determines the response speed of the membrane potential u to the input current I, and an appropriate time constant can be selected according to different systems.
[0171] Generally speaking, a time constant τ = 0.2 seconds (200 milliseconds) is a reasonable initial value for the following reasons.
[0172] Response speed: The time constant of 0.2 seconds makes the change in membrane potential relatively smooth, which can better adapt to the flow fluctuations in the system.
[0173] Stability: A small time constant makes the system overly sensitive to changes in input current, potentially causing drastic fluctuations in membrane potential and affecting the stability of backpressure control. A time constant of 0.2 seconds can balance response speed and stability.
[0174] Practical Applications: In practical applications, a time constant of 0.2 seconds can accommodate the response time of most message queues, ensuring that the system can respond at the microsecond level without incurring excessive computational overhead due to overly frequent adjustments.
[0175] Next, we calculate the real-time membrane potential using the above differential equation. For better calculation, we first use the Euler discretized membrane potential formula:
[0176] in
[0177] For example, a burst of traffic lasting 100ms is as follows.
[0178] First 30ms: Normal flow rate (backlog change rate = 80 Hz); 30-70ms: Burst flow (backlog change rate = 200 Hz); After 70ms: Flow resumes (backlog change rate = 40 Hz).
[0179] Since the membrane potential calculated in the previous calculation is required for the first calculation, an initial resting potential needs to be set, usually -0.7. A lower resting potential can prevent the system from triggering the back pressure control signal too early in the initial state, which helps to reduce accumulated errors and allows the system to maintain continuous growth when there is no actual load accumulation.
[0180] Because the membrane potential calculation is triggered once every 1ms, with a time step Δt of 0.001s, the cumulative change rate is obtained by summing the pulse input frequencies carried by the messages within the time step.
[0181] The input current I(t) is the sum of the rate of change of the accumulated pressure per unit time and the dynamic weight. A high membrane potential is set to trigger back pressure control to suppress the producer's production rate. For example, the trigger starts when the membrane potential exceeds 1.
[0182] After the message queue calculates the real-time membrane potential, it is transmitted to the neuron controller. The neuron controller triggers hierarchical backpressure and sends it to the producer. The producer adjusts its production strategy based on the backpressure information and gives excitation or inhibition signals.
[0183] As can be seen from the above application scenarios, this application has achieved four major breakthroughs through neuronal pulse coding technology: 1. Millisecond-level dynamic response: Regardless of message backlog or changes in processing capacity, the production rate can be automatically and instantly adjusted without manual intervention; 2. Resource perception and prediction: Through dynamic mapping of message type and pulse frequency, accurately quantify the future resource consumption pressure of consumers; 3. Intelligent load adaptation, employing a non-linearly growing adaptive synaptic weight algorithm to integrate system load metrics such as CPU / memory in real time; 4. Priority-based circuit breaker protection: Under high-pressure scenarios, a gradient-triggered suppression strategy prioritizes restricting low-priority producers and completely circuit-breakers non-critical traffic during overload, ensuring uninterrupted high-priority services. Essentially, it simulates the biodynamic mechanisms of neurons to complete a "perception-decision-control" closed loop in milliseconds, forming an intelligent flow control system far exceeding traditional TCP / reactive streaming.
[0184] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0185] The following describes an apparatus embodiment of this application, which can be used to execute the message management method described in the above embodiments of this application.
[0186] Figure 7 A schematic block diagram of a message management device provided in an embodiment of this application is shown. Figure 7 As shown, the message management device 700 includes: The writing module 710 is configured to write the message to the message queue when it receives a message sent by the producer. The determination module 720 is configured to determine the membrane potential of the message queue based on a pulse code corresponding to the message, wherein the pulse code is used to simulate the resource consumption of the message, and the membrane potential is used to simulate the consumption pressure of the message queue. The return module 730 is configured to return a response signal to the producer based on the membrane potential, the response signal being used to instruct the producer to adjust the message production strategy.
[0187] In some embodiments of this application, based on the above technical solutions, the determining module 720 includes: The message recording module is configured to record the dynamic message set managed by the message queue within a historical statistical period. The historical statistical period is the historical time interval between the historical response time and the current response time. The historical response time is the moment when the message queue most recently returned a response signal to the producer. The dynamic message set includes positive pressure messages and negative pressure messages. Positive pressure messages are messages that enter the message queue within the historical statistical period, and negative pressure messages are messages that are removed from the message queue within the historical statistical period. The encoding and summarization module is configured to summarize the pulse codes of each message in the dynamic message set to obtain the input current of the message queue. The input current is used to simulate the rate of change of the message backlog status of the message queue during the historical statistical period. The change amount determination module is configured to determine the potential change amount of the message queue based on the input current and the membrane resistance of the message queue, wherein the membrane resistance is used to simulate the consumption capacity of the consumption system in which the message queue is located; A membrane potential determination module is configured to determine the membrane potential of the message queue at the current response time based on the potential change and the membrane potential of the message queue at the historical response time.
[0188] In some embodiments of this application, based on the above technical solutions, the determining module 720 further includes: The utilization rate acquisition module is configured to acquire the resource utilization rate of the consumption system at the current response time; The utilization rate mapping module is configured to perform a weighted mapping on the resource utilization rate to obtain the membrane resistance of the message queue, wherein the membrane resistance is negatively correlated with the resource utilization rate.
[0189] In some embodiments of this application, based on the above technical solutions, the resource utilization rate includes CPU utilization rate, memory utilization rate, and network I / O utilization rate; the utilization rate mapping module is further configured to: perform weighted calculation on the CPU utilization rate, the memory utilization rate, and the network I / O utilization rate according to a preset utilization rate weight to obtain the weighted resource utilization rate of the consumption system; and perform normalized mapping on the weighted resource utilization rate according to a preset activation function to obtain the membrane resistance of the message queue.
[0190] In some embodiments of this application, based on the above technical solutions, the activation function is a hyperbolic tangent function used for nonlinear mapping of the weighted resource utilization rate.
[0191] In some embodiments of this application, based on the above technical solutions, the encoding and summarizing module is further configured to: decode the pulse encoding of each message in the dynamic message set to obtain the pulse frequency of the message; perform weighted fusion of the pulse frequencies of each message in the dynamic message set to obtain the input current of the message queue, wherein the input current is positively correlated with the pulse frequency of the positive pressure message and negatively correlated with the pulse frequency of the negative pressure message.
[0192] In some embodiments of this application, based on the above technical solutions, the acquisition module 710 is further configured to: parse the message to obtain the pulse code carried in the message, wherein the pulse code is obtained by the producer encoding the message capacity.
[0193] In some embodiments of this application, based on the above technical solutions, the pulse coding method includes: mapping the message capacity of the message to obtain the pulse frequency of the message; and encoding the pulse frequency according to a preset coding rule to obtain the pulse code.
[0194] In some embodiments of this application, based on the above technical solutions, the return module 730 is further configured to: perform mapping processing on the membrane potential to obtain a suppression strength, wherein the suppression strength is used to quantify the degree of suppression of the membrane potential on the message production speed of the producer; and return a response signal to the producer according to the suppression strength.
[0195] In some embodiments of this application, based on the above technical solutions, the suppression strength and the message generation speed of the producer have the following relationship:
[0196] in, It is the message production speed of the producer. This is the maximum message production rate of the producer. It is the suppression strength, It is a preset suppression constant. The specific details of the message management device provided in the various embodiments of this application have been described in detail in the corresponding method embodiments, and will not be repeated here.
[0197] Figure 8 A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present application is shown.
[0198] It should be noted that, Figure 8 The computer system 800 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0199] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM). The RAM 803 also stores various programs and data required for system operation. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output interface 805 (I / O interface) is also connected to the bus 804.
[0200] The following components are connected to the input / output interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a local area network card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.
[0201] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit 801, it performs various functions defined in the system of this application.
[0202] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0203] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0204] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0205] Through 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 application 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, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0206] Other embodiments of this application 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 application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0207] It should be understood that this application is not limited to the precise structure 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 application is limited only by the appended claims.
Claims
1. A message management method, characterized in that, The method includes: When a message is received from the producer, the message is written to the message queue; The membrane potential of the message queue is determined based on the pulse code corresponding to the message, wherein the pulse code is used to simulate the resource consumption of the message, and the membrane potential is used to simulate the consumption pressure of the message queue. The producer returns a response signal based on the membrane potential, which instructs the producer to adjust its message production strategy.
2. The message management method according to claim 1, characterized in that, Determining the membrane potential of the message queue based on the pulse code corresponding to the message includes: The system records the dynamic message set managed by the message queue during a historical statistical period. The historical statistical period is the historical time interval between the historical response time and the current response time. The historical response time is the moment when the message queue most recently returned a response signal to the producer. The dynamic message set includes positive pressure messages and negative pressure messages. Positive pressure messages are messages that enter the message queue during the historical statistical period. Negative pressure messages are messages that are removed from the message queue during the historical statistical period. The pulse codes of each message in the dynamic message set are summarized to obtain the input current of the message queue. The input current is used to simulate the rate of change of the message backlog status of the message queue during the historical statistical period. The potential change of the message queue is determined based on the input current and the membrane resistance of the message queue, wherein the membrane resistance is used to simulate the consumption capacity of the consumption system in which the message queue is located. The membrane potential of the message queue at the current response time is determined based on the potential change and the membrane potential of the message queue at the historical response time.
3. The message management method according to claim 2, characterized in that, Before determining the potential change of the message queue based on the input current and the membrane resistance of the message queue, the method further includes: Obtain the resource utilization rate of the consumption system at the current response time; The membrane resistance of the message queue is obtained by weighted mapping of the resource utilization rate, and the membrane resistance is negatively correlated with the resource utilization rate.
4. The message management method according to claim 3, characterized in that, The resource utilization rate includes CPU utilization, memory utilization, and network I / O utilization. The step of weighting the resource utilization rate to obtain the membrane resistance of the message queue includes: Based on preset usage rate weights, the CPU usage rate, the memory usage rate, and the network I / O usage rate are weighted and calculated to obtain the weighted resource usage rate of the consumption system; The weighted resource utilization rate is normalized and mapped according to a preset activation function to obtain the membrane resistance of the message queue.
5. The message management method according to claim 4, characterized in that, The activation function is a hyperbolic tangent function used to perform a nonlinear mapping of the weighted resource utilization rate.
6. The message management method according to claim 2, characterized in that, The step of summarizing the pulse codes of each message in the dynamic message set to obtain the input current of the message queue includes: The pulse code of each message in the dynamic message set is decoded to obtain the pulse frequency of the message; The pulse frequencies of each message in the dynamic message set are weighted and fused to obtain the input current of the message queue. The input current is positively correlated with the pulse frequency of the positive pressure message and negatively correlated with the pulse frequency of the negative pressure message.
7. The message management method according to claim 1, characterized in that, Before determining the membrane potential of the message queue based on the pulse code corresponding to the message, the method further includes: The message is parsed to obtain the pulse code carried in the message. The pulse code is obtained by the producer encoding the message capacity.
8. The message management method according to claim 7, characterized in that, The pulse coding encoding method includes: The message capacity is mapped to obtain the message's pulse frequency; The pulse frequency is encoded according to a preset encoding rule to obtain the pulse code.
9. The message management method according to claim 1, characterized in that, The step of returning a response signal to the producer based on the membrane potential includes: The membrane potential is mapped to obtain the suppression strength, which is used to quantify the degree to which the membrane potential inhibits the message production rate of the producer. A response signal is returned to the producer based on the suppression intensity.
10. The message management method according to claim 9, characterized in that, The suppression strength is related to the message generation speed of the producer as follows: in, It is the message production speed of the producer. This is the maximum message production rate of the producer. It is the suppression strength, It is a preset suppression constant.
