Message forwarding control method, device, equipment and computer program product
By obtaining the data queue and processor load status in the data gateway, dynamically controlling the allocation speed of the allocation area, solving the queue blockage problem caused by large traffic or burst traffic on the network link, and achieving efficient message forwarding and network stability.
Patent Information
- Application Number
- CN202411680173.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-21
AI Technical Summary
In the data gateway, when the network link has large traffic or burst traffic increases, it will cause the reception queue to be blocked, causing network packet loss and long-tail delay, affecting the online stability of network services.
By obtaining the load status of the data queue in the data gateway and the processor, the allocation speed of the area to be allocated is dynamically controlled to adjust the link load and avoid queue blockage.
It effectively solves the data packet loss and long-tail delay problems caused by queue blockage, realizes efficient forwarding of packets, and ensures the online stability of network services.
Smart Images

Figure CN119182733B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a message forwarding control method, device, equipment and computer program product. Background Art
[0002] Data Gateway is a key device or software component responsible for data forwarding in the network. It is usually used to connect different networks or subnets and is responsible for forwarding data from one network to another. At present, when there is a large flow or sudden increase in traffic on the data forwarding network link, the system's core processing capacity can easily reach its limit, which can easily cause congestion in the receiving queue in the data gateway, and then cause network packet loss and long-tail delay problems, affecting the online stability of network services. Summary of the invention
[0003] The embodiments of the present invention provide a control method, device, equipment and computer program product for message forwarding, which can solve the congestion problem existing in the receiving queue and help ensure the online stability of network services.
[0004] In a first aspect, an embodiment of the present invention provides a method for controlling message forwarding, which is applied to a data gateway, and the method includes:
[0005] Acquire a data queue in the data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded;
[0006] Determining a load state of a processor, wherein the processor is used to process the message to be forwarded and dynamically allocate the area to be allocated;
[0007] The allocation speed of the to-be-allocated area is controlled based on the load status.
[0008] In a second aspect, an embodiment of the present invention provides a control device for message forwarding, which is applied to a data gateway, and the device includes:
[0009] A first acquisition module is used to acquire a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded;
[0010] A first determination module, used to determine a load state of a processor, wherein the processor is used to process the message to be forwarded and to dynamically allocate the area to be allocated;
[0011] The first processing module is used to control the allocation speed of the to-be-allocated area based on the load state.
[0012] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the control method for message forwarding in the above-mentioned first aspect.
[0013] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the control method for message forwarding in the first aspect when executed.
[0014] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when the computer instructions are executed by one or more processors, causes the one or more processors to execute the steps in the message forwarding control method shown in the first aspect above.
[0015] In a sixth aspect, an embodiment of the present invention provides a data gateway, including:
[0016] A network card component, used for obtaining a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded;
[0017] A processing component is communicatively connected with the network card component and is used to determine a load state of a processor, wherein the processor is used to process the message to be forwarded and dynamically allocate the area to be allocated; and to control an allocation speed of the area to be allocated based on the load state.
[0018] The control method, device, equipment and computer program product for message forwarding provided by the embodiments of the present invention determine the load state of the processor by acquiring the data queue in the data gateway; and then control the allocation speed of the to-be-allocated area based on the load state, thereby effectively realizing that the allocation speed of the to-be-allocated area can be regulated based on different load states to alleviate the load degree of the link, which can not only solve the problems of data packet loss and long-tail delay caused by queue congestion, but also realize efficient forwarding processing operations of the message, which is conducive to ensuring the online stability of the network service, and further improves the practicality of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A schematic diagram of a scenario of a method for controlling message forwarding provided by an embodiment of the present invention;
[0021] Figure 2 A flow chart of a method for controlling message forwarding provided by an embodiment of the present invention;
[0022] Figure 3 A schematic diagram of a flow chart for determining the load state of a link for processing the message to be forwarded provided by an embodiment of the present invention;
[0023] Figure 4 A flowchart of another method for controlling message forwarding provided by an embodiment of the present invention;
[0024] Figure 5 A schematic diagram of conversion between various areas corresponding to a data queue provided in an embodiment of the present invention;
[0025] Figure 6 A flowchart of another method for controlling message forwarding provided by an embodiment of the present invention;
[0026] Figure 7 A schematic diagram of the principle of a method for controlling congestion of a cloud gateway data path provided by an application embodiment of the present invention;
[0027] Figure 8 A principle block diagram of a method for controlling cloud gateway data path congestion provided by an application embodiment of the present invention;
[0028] Fig. 9 A schematic diagram of conversion between various areas in a data receiving queue provided by an application embodiment of the present invention;
[0029] Fig.10 A schematic diagram of the structure of a control device for message forwarding provided by an embodiment of the present invention;
[0030] Fig.11 For Fig.10 A schematic diagram of the structure of an electronic device corresponding to the control device for message forwarding provided in the embodiment is shown;
[0031] Fig.12 A schematic diagram of the structure of a data gateway provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "an", and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the situation of including at least one.
[0034] It should be understood that the term "and / or" used in this article is only a way to describe the association relationship of associated devices, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated devices before and after are in an "or" relationship.
[0035] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0036] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0037] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0038] Terminology explanation:
[0039] Cloud Gateway: It is a forwarding node of the data center gateway type and is the convergence point of traffic.
[0040] Congestion Control Algorithm (CC): used to solve the congestion problem of packet forwarding on the data path.
[0041] Direct Memory Access: Direct Memory Access, referred to as DMA, is a technology that allows hardware devices to directly access system memory without going through the core processor (Central Processing Unit, referred to as CPU). DMA enables external devices to exchange data directly with the memory, thereby reducing the burden on the CPU and improving the efficiency of data transmission.
[0042] Traffic back pressure: It is the action part of congestion control, which performs speed limit or packet loss processing based on the operation results of the congestion control algorithm.
[0043] Receive queue (RX queue) / send queue (TX queue): is a data message exchanged between hardware and software, and the exchanged data message is designed in the form of a queue, with the head of the queue entering the queue and the tail of the queue leaving the queue.
[0044] Driver component: Polling Mode Driver, referred to as PMD, usually refers to the user-mode network card device driver developed based on the Data Plane Development Kit (DPDK).
[0045] In order to facilitate understanding of the specific implementation process and implementation effect of the message forwarding control method, device, equipment and computer program product in this embodiment, the relevant technology is briefly described below:
[0046] Data Gateway is a key device or software component responsible for data forwarding in the network. It is usually used to connect different networks or subnets and is responsible for forwarding data from one network to another. At present, when there is a large flow or sudden increase in traffic on the data forwarding network link, the system's core processing capacity can easily reach its limit, which can easily cause congestion in the receiving queue in the data gateway, and then cause network packet loss and long-tail delay problems, affecting the online stability of network services.
[0047] In order to avoid the congestion problem caused by the receiving queue, the related technology provides a congestion control solution implemented by pure software. This solution can collect the flow information of each processor core through bypass, count and analyze the load of the processor core; perform flow control according to the degree of load. Specifically, the flow of each source IP can be counted first, the abnormal source IP can be determined, and then congestion control information can be sent to the abnormal source IP to perform source-side back pressure operation through the congestion control information. However, the above congestion control solution has the following problems:
[0048] (1) It is necessary to perform separate collection and calculation load operations on the processor core, which consumes additional CPU resources;
[0049] (2) Limited by the bypass collection cycle, the accuracy of flow control is very low, usually in seconds. However, when the above-mentioned flow control operation is performed in seconds, link congestion may have already occurred. In addition, the back pressure link corresponding to the above congestion control scheme includes: detecting the abnormal source end - speed limiting the abnormal source end IP - bandwidth detection feedback, etc. Such a back pressure link is relatively long, which can easily reduce the quality and efficiency of flow control.
[0050] In order to solve the above technical problems, the embodiments of the present invention provide a method, device, equipment and computer program product for controlling message forwarding, wherein, with reference to the attached Figure 1 As shown, the execution subject of the message forwarding control method is the message forwarding control device 200, and the message forwarding control device 200 is communicatively connected with the client 100 and the server 300. Among them, the message forwarding control device 200 can be implemented as a data gateway, and the data gateway can be implemented as any one of the following: cloud gateway, serving gateway (Serving GateWay, SGW), Internet Gateway (Internet Gateway, IGW), customer gateway (Customer Gateway, CGW), virtual gateway (Virtual Gateway, VGW), etc.; when the message forwarding control device 200 is implemented as a cloud gateway, the message forwarding control method can be executed in the cloud, and several computing nodes (cloud servers) can be deployed in the cloud, and each computing node has computing, storage and other processing resources. In the cloud, multiple computing nodes can be organized to provide a certain service. Of course, a computing node can also provide one or more services. The way to provide the service in the cloud can be to provide a service interface to the outside, and the user calls the service interface to use the corresponding service. Service interfaces include software development kits (SDKs), application programming interfaces (APIs), and other forms.
[0051] The control device 200 for message forwarding refers to a device that can provide control operations for message forwarding in a network virtual environment, and generally refers to a device that uses a network to perform information planning and message forwarding control operations. In physical implementation, the control device 200 for message forwarding can be any device that can provide computing services, respond to control requests for message forwarding, and perform control operations for message forwarding. The device can be integrated on a preset device, for example, a cluster server, a conventional server, a cloud server, a cloud host, a virtual center, etc. The control device 200 for message forwarding mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.
[0052] The client 100 can be implemented as a mobile phone, a personal computer PC, a tablet computer, a setting application, etc. In addition, the basic structure of the client 100 may include: at least one processor. The number of processors depends on the configuration and type of the client 100. The client 100 may also include a memory, which may be volatile, such as: random access memory (Random Access Memory, referred to as RAM), or non-volatile, such as: read-only memory (Read-Only Memory, referred to as ROM), flash memory, etc., or may include both types. The memory usually stores an operating system (Operating System, referred to as OS), one or more application programs, and may also store program data, etc. In addition to the processing unit and the memory, the client 100 also includes some basic configurations, such as: a network card chip, an IO bus, a display component, and some peripheral devices, etc. Optionally, some peripheral devices may include, for example: a keyboard, a mouse, an input pen, a printer, etc. Other peripheral devices are well known in the art and will not be described in detail here.
[0053] In the above embodiment, a network connection is established between the client 100 and the control device 200 for message forwarding, and between the control device 200 for message forwarding and the server 300, and the network connection may be a wireless or wired network connection. If the client 100 and the control device 200 for message forwarding, and between the control device 200 for message forwarding and the server 300 are communication connections, the network standard of the mobile network may be any one of 2G (Global System for Mobile Communications GSM), 2.5G (General Packet Radio Service GPRS), 3G (Wideband Code Division Multiple Access WCDMA, Time Division Synchronous Code Division Multiple Access TD-SCDMA, Code Division Multiple Access 2000 CDMA2000, Universal Mobile Telecommunications System UTMS), 4G (Long Term Evolution LTE), 4G+ (Enhanced Long Term Evolution LTE+), Worldwide Interoperability for Microwave Access WiMax, 5G, 6G, etc.
[0054] The client 100 is used for users to apply to generate and obtain messages to be forwarded. In some instances, the messages to be forwarded can be obtained through human-computer interaction operations or voice interaction operations. In order to implement corresponding message processing operations, the messages to be forwarded can be sent to the message forwarding control device 200, so that the message forwarding control device 200 can perform corresponding control operations on the messages to be forwarded.
[0055] The control device 200 for message forwarding is communicatively connected with the client 100, and is used for obtaining the message to be forwarded sent by the client 100. Specifically, the control device 200 for message forwarding can obtain the data queue in the data gateway, wherein the data queue includes one or more messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded; then the load state of the processor can be determined, wherein the processor is used to process the messages to be forwarded and dynamically allocate the area to be allocated; the load state can include a first state for indicating that no congestion has occurred, or a second state for indicating that congestion has occurred; since the processor or the link can correspond to different load states, the allocation speed of the area to be allocated can be controlled according to the determined load state. In some instances, when the load state is the first state, it means that the link or processor used to process the message to be forwarded is not blocked, and the allocation speed of the area to be allocated can be increased at this time; when the load state is the second state, it means that the link or processor used to process the message to be forwarded is blocked. In order to alleviate the congestion on the processor or link, the allocation speed of the area to be allocated can be lowered, thereby effectively realizing the flexible regulation of the allocation speed of the area to be allocated based on the load state, which can not only alleviate the load level of the processor or link, solve or alleviate the congestion problem of the queue, but also realize the forwarding processing operation of the message, which is conducive to ensuring the online stability of the network service, and further improves the practicality of the method.
[0056] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0057] Figure 2 A flow chart of a method for controlling message forwarding provided by an embodiment of the present invention; Figure 2As shown, this embodiment provides a control method for message forwarding, the execution subject of the method is a control device for message forwarding, and the control device for message forwarding can be implemented as software, or a combination of software and hardware. When the control device for message forwarding is implemented as hardware, it can be various electronic devices with the control capability of message forwarding. In some instances, the control device for message forwarding can be implemented as a data gateway, that is, the control method for message forwarding can be applied to a data gateway, which can include but is not limited to: cloud gateway, serving gateway (Serving GateWay, referred to as SGW), Internet gateway (Internet Gateway, referred to as IGW), customer gateway (Customer Gateway, referred to as CGW), virtual gateway (Virtual Gateway, referred to as VGW), etc.; when the control device for message forwarding is implemented as software, it can be installed in the electronic devices listed above. Based on the above-mentioned control device for message forwarding, the control method for message forwarding in this embodiment includes:
[0058] Step S201: obtaining a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded.
[0059] Step S202: Determine a load state of a processor, wherein the processor is used to process the message to be forwarded and to dynamically allocate the area to be allocated.
[0060] Step S203: Controlling the allocation speed of the area to be allocated based on the load status.
[0061] The specific implementation process and effects of each of the above steps are described in detail below:
[0062] Step S201: obtaining a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded.
[0063] In application scenarios where message processing is performed, it is often necessary to use a data gateway to forward messages. In order to avoid data packet loss and long-tail delays caused by blockage of the message forwarding link, the allocation speed of the to-be-allocated area corresponding to the data queue can be flexibly adjusted. Specifically, the data queue in the data gateway can be obtained first. In some instances, the data gateway is pre-configured with data queues for implementing message writing operations, message sending operations, and message caching operations. The data queue can be stored in a preset area in the data gateway. When there is a demand for message forwarding, the data queue can be obtained by accessing the preset area in the data gateway.
[0064] For a data queue, it may include one or more messages to be forwarded, and different application scenarios may correspond to different types of messages to be forwarded, such as: notification messages to be forwarded, inform messages to be forwarded, command messages to be forwarded, indication messages to be forwarded, and so on. In addition, a data queue may correspond to a data queue area with a fixed length, and the above-mentioned data queue area may include an area to be allocated for caching messages to be forwarded, that is, the data queue may correspond to an area to be allocated, and the size of the area to be allocated may be flexibly changed based on the progress of the message forwarding operation. For example, at time t1, the data queue may correspond to a 4KB area to be allocated; at time t2, the data queue may correspond to a 16KB area to be allocated, and so on.
[0065] Step S202: Determine a load state of a processor, wherein the processor is used to process the message to be forwarded and to dynamically allocate the area to be allocated.
[0066] For the messages to be forwarded in the data queue, in order to implement the corresponding message processing operations, it is often necessary to forward the messages to be forwarded to the next network node for processing, wherein the network nodes through which the messages to be forwarded are forwarded constitute the links for processing the messages to be forwarded, and different application scenarios may correspond to different links for processing the messages to be forwarded. For the above-mentioned links or processors for implementing message processing operations, the links or processors in different application scenarios may correspond to different load states, wherein the load states may include: a blocked state and an unblocked state. Since different load states may correspond to different message forwarding control strategies, therefore, in order to avoid or alleviate the problem of data packet loss or long-tail delay caused by link congestion, the load state of the processor may be determined, wherein the processor is used to process the messages to be forwarded and to dynamically allocate the allocated areas.
[0067] In some instances, the load state of the processor can be determined by a status register deployed on the processor. In this case, determining the load state of the processor may include: obtaining a status register used to detect the state of the processor; determining the load state of the processor based on the state information of the status register, for example: when the state in the status register is a preset "0", it is determined that the processor is in an unblocked state; when the state in the status register is a preset "1", it is determined that the processor is in a blocked state.
[0068] In other instances, the load state of the processor can be determined not only by the status register deployed on the processor, but also by the current area size of the area to be allocated. At this time, determining the load state of the processor may include: determining the current area size of the area to be allocated; based on the current area size, determining the load state, and the load state is used to identify whether congestion occurs.
[0069] Among them, since the area to be allocated is obtained by performing a cache area allocation operation or an area backfill operation on the system cache pool, the allocation operation or the area backfill operation of the area to be allocated is related to the forwarding operation efficiency information of the message. When the forwarding operation efficiency of the message is high, the speed of the allocation operation or the area backfill operation of the area to be allocated is high, thereby making the current area size of the determined area to be allocated larger; when the forwarding operation efficiency of the message is low, the speed of the allocation operation or the area backfill operation of the area to be allocated is low, thereby making the current area size of the determined area to be allocated smaller.
[0070] It can be seen from the above that the current area size of the area to be allocated is closely related to the load state of the processor. Therefore, in order to accurately determine the load state of the processor, the current area size of the area to be allocated can be determined first, wherein the current area size can be obtained by scanning and counting the area to be allocated, or the current area size can be obtained by the total queue area corresponding to the data queue and the total size of other areas corresponding to other areas except the area to be allocated; the current area size of the area to be allocated is determined based on the total queue area and the size of other areas. In some instances, the current area size = the total queue area - the total size of other areas.
[0071] After obtaining the current region size, the current region size may be analyzed and processed to determine the load state of the processor. In some instances, based on the current region size, determining the load state may include: obtaining a mapping relationship table for identifying the load state of the processor, the mapping relationship table including load state information corresponding to each allocated region size; determining the load state of the processor based on the mapping relationship table and the current region size, thereby effectively ensuring the accuracy and reliability of determining the load state of the link.
[0072] In other instances, the load state of the processor can be determined not only by a mapping relationship table, but also by an allocated area threshold for identifying the load state. In this case, based on the current area size, determining the load state may include: obtaining the allocated area threshold for identifying the load state; when the current area size is greater than the allocated area threshold, determining the load state as a first state for identifying that no congestion has occurred; and when the current area size is less than or equal to the allocated area threshold, determining the load state as a second state for identifying that congestion has occurred.
[0073] Among them, a pre-configured allocation area threshold for identifying whether the load state is a congestion state, the allocation area threshold can be an allocation area upper limit value for identifying that the load state is not a congestion state. In order to accurately determine the load state, the allocation area threshold for identifying the load state can be obtained first, and the allocation area threshold can be obtained through human-computer interaction, or the allocation area threshold can be a pre-configured value. After obtaining the allocation area threshold, the current area size and the allocation area threshold can be analyzed and compared. When the current area size is greater than the allocation area threshold, it means that the area to be allocated is larger, and then the load state of the processor can be determined to be the first state for identifying that no congestion has occurred; when the current area size is less than or equal to the allocation area threshold, it means that the area to be allocated is smaller, and then the load state of the processor can be determined to be the second state for identifying that congestion has occurred, thereby effectively achieving accurate and reliable determination of the load state of the processor that processes the forwarded message.
[0074] Step S203: Controlling the allocation speed of the area to be allocated based on the load status.
[0075] Among them, the load state of the processor can directly reflect whether the processor or the link used to analyze and process the message is in a blocked state. Whether the processor is in a blocked state can directly affect the control strategy of the message forwarding operation. For example, if the processor is in a blocked state, data packet loss or long-tail delay problems are prone to occur; if the processor is not in a blocked state, data packet loss or long-tail delay problems are not likely to occur. Therefore, in order to alleviate or avoid the problem of data packet loss or long-tail delay caused by the processor being in a blocked state, after determining the load state of the processor used to process the message to be forwarded, the allocation speed of the allocated area can be controlled based on the load state.
[0076] In some instances, the allocation speed of the allocated area is controlled by a pre-trained neural network model. At this time, controlling the allocation speed of the allocated area based on the load status may include: obtaining a pre-trained neural network model; inputting the load status into the neural network model, obtaining control information output by the neural network model, and controlling the allocation speed of the allocated area based on the control information.
[0077] In other instances, the allocation speed of the allocated area can be controlled not only by a neural network model, but also by a control strategy corresponding to the load state. At this time, controlling the allocation speed of the allocated area based on the load state may include: obtaining the allocation speed for dynamically allocating the allocated area; when the load state is a first state for indicating that no congestion has occurred, increasing or maintaining the allocation speed; when the load state is a second state for indicating that a congestion has occurred, decreasing the allocation speed.
[0078] Specifically, in order to be able to accurately control the allocation speed of the area to be allocated based on the load status, the allocation speed of the area to be allocated can be obtained first. In some instances, the allocation speed for dynamic allocation of the area to be allocated can be determined based on human-computer interaction operations, or the allocation speed for dynamic allocation of the area to be allocated can be a preset theoretical allocation speed. At this time, the allocation speed for dynamic allocation of the area to be allocated can be stored in a preset area, and then the allocation speed for dynamic allocation of the area to be allocated can be obtained by accessing the preset area.
[0079] In other instances, the allocation speed for dynamically allocating the areas to be allocated may be determined based on the current area size and an allocation area threshold. In this case, obtaining the allocation speed for dynamically allocating the areas to be allocated may include: determining a theoretical allocation area size of the allocation area, and an allocation area threshold for identifying a load state; and determining the allocation speed for dynamically allocating the areas to be allocated based on the theoretical area allocation size and the allocation area threshold.
[0080] Specifically, the allocation speed for dynamic allocation of the allocated area is used to identify the area size corresponding to an allocation operation on the allocated area. In order to accurately obtain the allocation speed for dynamic allocation of the allocated area, the theoretical allocation area size of the allocated area and the allocation area threshold for identifying the load status can be determined first, wherein the theoretical allocation area size can be determined by the processing status of the message in the data queue; after determining the theoretical allocation area size and the allocation area threshold of the allocated area, the theoretical allocation area size and the allocation area threshold can be analyzed and processed to determine the allocation speed for dynamic allocation of the allocated area.
[0081] In some instances, determining an allocation speed for dynamically allocating areas to be allocated based on a theoretical area allocation size and an allocation area threshold may include: obtaining the number of deviation areas between the theoretical area allocation size and the allocation area threshold; and determining an allocation speed for dynamically allocating areas to be allocated based on the number of deviation areas, wherein the allocation speed is positively correlated with the number of deviation areas.
[0082] For example 1, when the theoretical area allocation size is N and the allocation area threshold is K, if N>K, the number of deviation areas between the theoretical area allocation size and the allocation area threshold, that is, NK, can be obtained, and then the allocation speed of the area to be allocated can be determined based on the number of deviation areas (NK), wherein the allocation speed is positively correlated with the number of deviation areas, that is, the allocation speed can be (NK) or a*(NK), wherein a is a preset value greater than 0.
[0083] For example 2, when the theoretical area allocation size is N and the allocation area threshold is K, if N<K, the number of deviation areas between the theoretical area allocation size and the allocation area threshold can be obtained, that is, KN, and then the allocation speed of the area to be allocated can be determined based on the number of deviation areas (KN), wherein the allocation speed is positively correlated with the number of deviation areas, that is, the allocation speed can be (KN) or b*(KN), wherein b is a value greater than 0, thereby effectively realizing the accurate determination of the allocation speed of the area to be allocated.
[0084] After obtaining the allocation speed for dynamically allocating the area to be allocated, different control operations can be performed on the allocation speed based on different load states. Specifically, when the load state is the first state for indicating that no congestion has occurred, it means that the load on the link for processing the forwarded message is small, and the system has more data processing resources. At this time, in order to improve the quality and efficiency of message processing, the allocation speed can be increased or kept unchanged, that is, the area to be allocated can be allocated quickly, and then the message receiving operation and the message sending operation can be performed based on the allocated area to be allocated, which is conducive to improving the quality and efficiency of message processing.
[0085] When the load state is the second state for identifying that congestion has occurred, it means that the load on the link used to process the forwarded message is large and the system has fewer data processing resources. At this time, in order to avoid data packet loss and long-tail delay problems due to link congestion, the allocation speed of the area to be allocated can be reduced, so that the allocation operation of the area to be allocated can occupy fewer data processing resources, so that the system can use more data processing resources for message processing operations.
[0086] In addition, the present embodiment does not limit the specific implementation method for adjusting the allocation speed. In some instances, increasing the allocation speed can be achieved by a preset coefficient. In this case, increasing or maintaining the allocation speed may include: obtaining a first coefficient for adjusting the allocation speed; increasing or maintaining the allocation speed based on the first coefficient to obtain an adjusted allocation speed, wherein the adjusted allocation speed is greater than or equal to the allocation speed.
[0087] Among them, in order to be able to adjust the allocation speed, a first coefficient for adjusting the allocation speed can be obtained first. The first coefficient can be determined through human-computer interaction, or the first coefficient can be determined by preset configured parameters; after obtaining the first coefficient, the allocation speed can be increased or maintained based on the first coefficient, and the adjusted allocation speed obtained is greater than or equal to the allocation speed, which effectively realizes the ability to regulate the allocation speed based on the load status of the link.
[0088] For example, when the first coefficient is a value greater than 1, after the allocation speed is increased based on the first coefficient, the adjusted allocation speed obtained can be the first coefficient*allocation speed. In this case, the adjusted allocation speed obtained is greater than the allocation speed. When the first coefficient is a value equal to 1, the allocation speed can be kept unchanged based on the first coefficient, that is, the adjusted allocation speed=1*allocation speed. In this case, the adjusted allocation speed obtained is the same as the allocation speed before adjustment, that is, the adjusted allocation speed=the above-mentioned allocation speed.
[0089] When the first coefficient is a value less than 1, after the allocation speed is adjusted up based on the first coefficient, the adjusted allocation speed obtained may be allocation speed / first coefficient. In this case, the adjusted allocation speed obtained is greater than the allocation speed. When the first coefficient is a value equal to 1, after the allocation speed is adjusted up based on the first coefficient, the adjusted allocation speed obtained may be: allocation speed / 1. In this case, the adjusted allocation speed obtained is the same as the allocation speed before adjustment.
[0090] Similarly, reducing the allocation speed can also be achieved through a preset coefficient. In this case, reducing the allocation speed may include: obtaining a second coefficient for adjusting the allocation speed; reducing the allocation speed based on the second coefficient to obtain an adjusted allocation speed, wherein the adjusted allocation speed is less than the allocation speed.
[0091] Among them, in order to be able to adjust the allocation speed, a second coefficient for adjusting the allocation speed can be obtained first. The second coefficient can be determined through human-computer interaction, or the second coefficient can be determined by preset configured parameters; the second coefficient can be a value greater than 0 and less than 1. After obtaining the second coefficient, the allocation speed can be reduced based on the second coefficient. Since the second coefficient is a value greater than 0 and less than 1, the adjusted allocation speed is less than the allocation speed. This effectively realizes the ability to regulate the allocation speed based on the load status of the link.
[0092] For example, when the second coefficient is a value greater than 0 and less than 1, after the allocation speed is reduced based on the second coefficient, the adjusted allocation speed obtained may be the first coefficient*allocation speed, in which case the adjusted allocation speed obtained is less than the allocation speed. When the second coefficient is a value greater than 1, after the allocation speed is reduced based on the second coefficient, the adjusted allocation speed obtained may be the allocation speed / second coefficient, in which case the adjusted allocation speed obtained is less than the allocation speed, thereby achieving the effect of reducing the allocation speed.
[0093] The message forwarding control method provided in this embodiment determines the load state of the processor by acquiring the data queue in the data gateway; and then controls the allocation speed of the allocation area to be allocated based on the load state, which effectively realizes that the allocation speed of the allocation area to be allocated can be regulated based on different load states to alleviate the load level of the link. This not only solves the problems of data packet loss and long-tail delay caused by queue congestion, but also realizes efficient forwarding processing operations of the message, which is beneficial to ensuring the online stability of network services, and further improves the practicality of the method.
[0094] Figure 3 A flow chart of determining a load state according to an embodiment of the present invention; based on the above embodiment, refer to the attached Figure 3 As shown, for the data queue in the data gateway, the data queue may correspond not only to an area to be allocated for caching the forwarded message, but also to a message receiving area allowing the message writing operation. At this time, the load state of the processor may be determined in combination with the message receiving area. Specifically, determining the load state of the processor in this embodiment may include:
[0095] Step S301: Determine the receiving area size of the message receiving area.
[0096] Among them, for the data queue, the data queue may not only correspond to an area to be allocated for caching the forwarded messages, but also correspond to a message receiving area that allows message writing operations, that is, in the application scenario of message writing, the message data packet is allowed to be written into the message receiving area in the data queue. When the data queue corresponds to a message receiving area, the load state can be determined based on the receiving area size of the message receiving area. In order to accurately determine the load state, the receiving area size of the message receiving area can be determined first, wherein the method for determining the receiving area size is similar to the method for determining the "current area size" in the above embodiment. For details, please refer to the above statement, which will not be repeated here.
[0097] Step S302: Determine the load status based on the size of the receiving area, where the load status is used to identify whether congestion occurs.
[0098] After obtaining the receiving area size, the receiving area size may be analyzed and processed to determine the load state. In some examples, the load state may be determined by analyzing and processing the receiving area size through a receiving area threshold. In this case, based on the receiving area size, determining the load state may include: obtaining a receiving area threshold for identifying the load state; when the receiving area size is greater than the receiving area threshold, determining the load state as a first state for identifying that no congestion has occurred; when the receiving area size is less than or equal to the receiving area threshold, determining the load state as a second state for identifying that congestion has occurred.
[0099] Among them, a receiving area threshold for identifying whether the load state is a congestion state is pre-configured, and the receiving area threshold can be an upper limit value of the receiving area for identifying that the load state is not a congestion state. In order to accurately determine the load state of the processor, the receiving area threshold for identifying the load state can be obtained first, and the receiving area threshold can be obtained through human-computer interaction, or the receiving area threshold can be a pre-configured value. After obtaining the receiving area threshold, the receiving area size and the receiving area threshold can be analyzed and compared. When the receiving area size is greater than the receiving area threshold, it means that the area of the message receiving area is larger, and then the load state can be determined to be the first state for identifying that no congestion has occurred; when the receiving area size is less than or equal to the receiving area threshold, it means that the area of the message receiving area is smaller, and then the load state can be determined to be the second state for identifying that congestion has occurred, thereby effectively achieving accurate and reliable determination of the load state of the link to be forwarded.
[0100] In some other instances, the load status can be determined not only by analyzing and processing the receiving area size through the receiving area threshold, but also by combining the area to be allocated and the message receiving area. At this time, based on the receiving area size, determining the load status may include: determining the current area size of the area to be allocated; determining the load status based on the receiving area size and the current area size.
[0101] When the data queue corresponds to an area to be allocated and a message receiving area, the load status can be determined in combination with the area to be allocated and the message receiving area. Specifically, the current area size of the area to be allocated can be determined first, and then the receiving area size and the current area size can be comprehensively analyzed to determine the load status. This effectively ensures the accuracy and reliability of determining the load status of the link.
[0102] In some instances, the load state of the processor can be determined by performing a comprehensive analysis of the receiving area size and the current area size using a pre-trained neural network model. At this time, based on the receiving area size and the current area size, determining the load state may include: obtaining a pre-trained neural network model; inputting the receiving area size and the current area size into the neural network model to perform a determination operation on the load state of the processor, thereby stably obtaining the load state of the processor for processing the forwarded message.
[0103] In other instances, the load state of the processor can not only be determined by a pre-trained neural network model, but also can be determined by analyzing and processing the allocated area and the message receiving area through the allocated area threshold and the receiving area threshold. At this time, based on the receiving area size and the current area size, determining the load state may include: obtaining an allocated area threshold for identifying the load state, and a receiving area threshold for identifying the load state; when the receiving area size is greater than the receiving area threshold, and the current area size is greater than the allocated area threshold, determining the load state as a first state for identifying that no congestion has occurred; when the receiving area size is less than or equal to the receiving area threshold, or the current area size is less than or equal to the allocated area threshold, determining the load state as a second state for identifying that congestion has occurred.
[0104] Among them, an allocation area threshold and a receiving area threshold for identifying whether the load state is a congestion state are pre-configured. The allocation area threshold can be an allocation area upper limit value for identifying that the load state is not a congestion state. Similarly, the receiving area threshold can be a receiving area upper limit value for identifying that the load state is not a congestion state. In order to accurately determine the load state, the allocation area threshold for identifying the load state and the receiving area threshold for identifying the load state can be first obtained, and then the current area size can be analyzed and compared with the allocation area threshold, the receiving area size and the receiving area upper limit value. When the receiving area size is greater than the receiving area threshold and the current area size is greater than the allocation area threshold, it means that the message receiving area and the area to be allocated are larger, and then the load state can be determined to be a first state for identifying that no congestion has occurred; when the current area size is less than or equal to the allocation area threshold, or the current area size is less than or equal to the allocation area threshold, it means that the area to be allocated is smaller, or the area of the message receiving area is smaller, and then the load state can be determined to be a second state for identifying that congestion has occurred, thereby effectively achieving accurate and reliable determination of the load state of the processor that processes the forwarded message.
[0105] In some instances, the data queue may correspond not only to a message receiving area and an area to be allocated, but also to a message sending area where message sending operations are allowed, that is, the data gateway may forward messages located in the message sending area, for example: the messages in the message sending area may be forwarded to the CPU for processing; at this time, the load state may be determined in combination with the sending area size of the message sending area. Specifically, in this embodiment, determining the load state based on the receiving area size and the current area size may include: determining the sending area size of the message sending area; determining the load state based on the receiving area size, the current area size and the sending area size.
[0106] Among them, when the data queue corresponds to a message sending area, the sending area size of the message sending area can be determined first. The determination method of the above "sending area size" is similar to the determination method of the "receiving area size" in the above embodiment. For details, please refer to the above statement content, which will not be repeated here. After determining the sending area size of the message sending area, the receiving area size, the current area size and the sending area size can be analyzed and processed to determine the load state.
[0107] In some instances, determining the load state based on the receiving area size, the current area size, and the sending area size may include: obtaining an allocated area threshold, a receiving area threshold, and a sending area threshold for identifying the load state; when the receiving area size is greater than the receiving area threshold, the current area size is greater than the allocated area threshold, and the sending area size is greater than the sending area threshold, determining the load state as a first state for identifying that no congestion has occurred; when the receiving area size is less than or equal to the receiving area threshold, or the current area size is less than or equal to the allocated area threshold, or the sending area size is less than or equal to the sending area threshold, determining the load state as a second state for identifying that congestion has occurred, thereby effectively ensuring the accuracy and reliability of determining the load state of the processor.
[0108] In this embodiment, by determining the size of the receiving area of the message receiving area, the load state can be determined based on the receiving area size, thereby effectively achieving accurate determination of the load state of the processor and further improving the practicality of the method.
[0109] Figure 4 A flowchart of another method for controlling message forwarding provided by an embodiment of the present invention; Figure 5 A schematic diagram of conversion between various areas corresponding to the data queue provided in an embodiment of the present invention; based on the above embodiment, refer to the attached Figure 4-Figure 5As shown, after the allocation speed of the area to be allocated is controlled based on the load state, a flexible regulation operation can be performed between the area to be allocated and the message receiving area. The method in this embodiment may also include:
[0110] Step S401: Obtain the allocation status of the area to be allocated.
[0111] In the process of forwarding messages using data queues, the to-be-allocated area, message receiving area and message sending area corresponding to the data queue can change dynamically. The to-be-allocated area corresponding to the data queue is determined by the allocation operation performed by the system cache. For the to-be-allocated area corresponding to the data queue, it can correspond to different allocation states. Specifically, in the process of performing the allocation operation on the to-be-allocated area, the allocation state of the to-be-allocated area is an unfinished state; when the allocation operation on the to-be-allocated area is completed, the allocation state of the to-be-allocated area is a completed state.
[0112] In order to accurately and flexibly perform conversion operations between the various areas corresponding to the data queue, the allocation status of the area to be allocated can be obtained. In some instances, the allocation status of the area to be allocated can be determined by information in a status register, or the allocation status of the area to be allocated can be determined by comparing the allocated area size of the area to be allocated with the theoretical allocation area size.
[0113] Step S402: When the allocation state is the completed state, the area to be allocated is adjusted to a message receiving area.
[0114] Among them, the area to be allocated is used to cache messages to be forwarded. When the area to be allocated is in an unfinished state, it means that the area to be allocated is still in the dynamic allocation stage or the backfill stage, that is, the size of the area to be allocated is not fixed, and the area to be allocated at this time cannot be used as a message receiving area that allows message writing operations; when the allocation state of the area to be allocated is a completed state, it means that the allocation operation of the area to be allocated has been completed, that is, the size of the area to be allocated can be fixed, and the area to be allocated can be used as a message receiving area that allows message writing operations, and then the area to be allocated can be adjusted to the message receiving area, thereby effectively realizing the flexible conversion operation of the area to be allocated and the message receiving area based on the allocation state of the area to be allocated.
[0115] Similarly, the present embodiment can not only flexibly adjust between the area to be allocated and the message receiving area, but also realize flexible conversion operations between the message receiving area and the message sending area. At this time, the method in the present embodiment can also include: obtaining the message writing status corresponding to the message receiving area; when the message writing status is the completion status, adjusting the message receiving area to the message sending area.
[0116] Specifically, when it is necessary to perform a message writing operation on the message receiving area in the data queue, the message receiving area can be switched between the message sending area, and the message receiving area can correspond to different message writing states. For example, when the message writing operation on the message receiving area corresponding to the data queue has been completed, the message writing state corresponding to the message receiving area can be determined to be a completed state; when the message writing operation on the message receiving area corresponding to the data queue has not been completed, the message writing state corresponding to the message receiving area can be determined to be an uncompleted state.
[0117] In addition, the message receiving area is used to implement the message writing operation to the data queue, and the message sending area is used to implement the sending of the message in the data queue to the next network node; when the message writing status corresponding to the message receiving area is an unfinished status, it means that the message receiving area is still in the process of the message writing operation, that is, the message receiving area has not completed the message writing operation, and the message in the message receiving area cannot perform the message forwarding operation; when the message writing status of the message receiving area is a completed status, it means that the message writing operation has been completed, and the message in the message receiving area can perform the message forwarding operation, and then the message receiving area can be adjusted to the message sending area, thereby effectively realizing the flexible conversion operation of the message receiving area and the message sending area based on the message writing status of the message receiving area.
[0118] Similarly, the present embodiment can also determine the area size of the area to be allocated based on the message sending status of the message sending area. At this time, the method in the present embodiment may further include: obtaining the message sending status corresponding to the message sending area; when the message sending status is the completed state, determining the theoretical allocation area size of the area to be allocated based on the sending area size of the message sending area.
[0119] Specifically, the message sending area is used to send the message in the data queue to the next network node; the message sending area can correspond to different message sending states, for example: when the message in the message sending area has been forwarded to the next network node, the message sending state corresponding to the message sending area is determined to be a completed state; when the message in the message sending area has not been sent to the next network node, the message sending state corresponding to the message sending area is determined to be an uncompleted state.
[0120] When the message sending state corresponding to the message sending area is an unfinished state, it means that the message sending area is still in the process of message sending operation, that is, the message in the message sending area has not completed the sending operation, and the message in the message sending area can be continuously forwarded at this time; when the message sending state corresponding to the message sending area is a completed state, it means that the message sending operation has been completed, and the message in the message sending area has completed the message forwarding operation, that is, the message in the message sending area has been forwarded to the next network node, and then the cache area of the message sending area in the data queue can be released. The theoretical allocation area size of the area to be allocated can be determined based on the area size corresponding to the message sent in the message sending area. In some instances, the theoretical allocation area size of the area to be allocated can be equal to the area size corresponding to the message sent in the message sending area, that is, when the data queue releases an area of the sending area size, the system buffer pool can be used to allocate an area to be allocated of corresponding size to the data queue. After obtaining the theoretical allocation area size of the area to be allocated, the area allocation operation of the area to be allocated can be performed based on the theoretical allocation area size of the area to be allocated, thereby ensuring the flexibility and reliability of the allocation of the area to be allocated.
[0121] In this embodiment, by obtaining the allocation status of the area to be allocated, when the allocation status is the completed status, the area to be allocated can be adjusted to the message receiving area, effectively realizing the flexible switching operation between the area to be allocated and the message receiving area; similarly, it can also realize the flexible switching operation between the message receiving area and the message sending area, and can determine the theoretical allocation area size of the area to be allocated based on the sending area size of the message sending area, which is conducive to ensuring the allocation operation of the area to be allocated. After the flexible switching operation between the above-mentioned areas, the stability and reliability of the message processing operation based on the data queue can be effectively guaranteed.
[0122] Figure 6 A flow chart of another method for controlling message forwarding provided by an embodiment of the present invention; based on any one of the above embodiments, refer to the attached Figure 6 As shown, before obtaining the data queue in the data gateway, this embodiment can perform a message writing operation based on the message receiving area in the data queue. At this time, the method in this embodiment may also include:
[0123] Step S601: Acquire a message buffer queue located at a media access control layer, wherein the message buffer queue includes a plurality of messages to be processed.
[0124] The data gateway may include a media access control layer MAC. When a user has a message processing requirement, the data gateway may obtain the message to be processed and store the message to be processed in a message cache queue. The message cache queue may be implemented as a hardware cache queue on the MAC layer in a field programmable gate array (FPGA). In order to accurately implement the message forwarding operation, the message cache queue located at the MAC layer may be obtained so as to write the message to be processed in the message cache queue to the data queue and obtain the message to be forwarded included in the data queue in the data gateway.
[0125] Step S602: Based on the message cache queue, a plurality of to-be-forwarded messages to be written into the data queue are determined.
[0126] After obtaining the message cache queue, a plurality of messages to be forwarded for writing into the data queue can be determined based on the message cache queue; in some instances, determining a plurality of messages to be forwarded for writing into the data queue based on the message cache queue may include: obtaining a plurality of messages to be processed included in the message cache queue; and determining at least a portion of the plurality of messages to be processed in the message cache queue as a plurality of messages to be forwarded for writing into the data queue.
[0127] In other instances, based on the message cache queue, determining multiple messages to be forwarded for writing into the data queue may include: obtaining multiple messages to be processed included in the message cache queue; determining the number of data packets to be written into the data queue, and then selecting, from the multiple messages to be processed, the messages to be processed that meet the number of data packets to be determined as the multiple messages to be forwarded for writing into the data queue, thereby effectively ensuring the accuracy and reliability of determining the multiple messages to be forwarded.
[0128] Among them, determining the number of data packets for writing to the data queue may include: obtaining the area size of the area to be allocated in the data queue; determining the number of data packets that can cache messages in the area to be allocated based on the area size of the area to be allocated; and then determining the number of data packets of the cached messages as the number of data packets for writing to the data queue; or, determining the number of data packets for writing to the data queue may include: displaying a human-computer interaction interface; obtaining an execution operation input by a user in the human-computer interaction interface; and determining the number of data packets for writing to the data queue based on the execution operation, thereby effectively ensuring the accuracy and reliability of determining the number of data packets.
[0129] Step S603: Determine a message receiving area in the data queue where message writing operations are allowed.
[0130] Since the messages in the message cache queue need to be written to the message receiving area in the data queue, in order to accurately implement the control operation of message forwarding, the message receiving area in the data queue that allows the message writing operation can be determined. In some instances, the message receiving area can be determined by the to-be-allocated area in the data queue. At this time, determining the message receiving area in the data queue that allows the message writing operation can include: obtaining the to-be-allocated area in the data queue; determining the current area size of the to-be-allocated area; and determining the message receiving area in the data queue that allows the message writing operation based on the current area size, wherein the size of the message receiving area can be the same as the current area size, thereby effectively ensuring the message receiving area in the data queue that allows the message writing operation.
[0131] Step S604: when the message receiving area can store multiple messages to be forwarded, the multiple messages to be forwarded in the message buffer queue are written into the message receiving area.
[0132] Since multiple messages to be forwarded need to be stored in the message receiving area, in order to accurately implement the control operation of message forwarding, after determining the message receiving area in the data queue that allows message writing operations and multiple messages to be forwarded, the message receiving area and the multiple messages to be forwarded can be analyzed and compared to identify whether the message receiving area can store multiple messages to be forwarded.
[0133] In some instances, identifying whether a message receiving area can store multiple messages to be forwarded may include: obtaining message demand space corresponding to multiple messages to be forwarded; determining a receiving area size of the message receiving area; when the receiving area size is greater than or equal to the message demand space, determining that the message receiving area can store multiple messages to be forwarded; when the receiving area size is less than the message demand space, determining that the message receiving area cannot store multiple messages to be forwarded.
[0134] When the message receiving area can store multiple messages to be forwarded, the multiple messages to be forwarded in the message cache queue can be directly sucked into the message receiving area, thus realizing the message writing operation. In addition, the method in this embodiment can also include: when the message receiving area cannot store multiple messages to be forwarded, storing the multiple messages to be forwarded in the global cache.
[0135] Specifically, when the message receiving area cannot store multiple messages to be forwarded, the message writing operation cannot be performed on the message receiving area. At this time, the global cache can be obtained and the multiple messages to be forwarded can be stored in the global cache, which can effectively avoid data packet loss.
[0136] In other instances, before storing multiple messages to be forwarded in the global cache, a packet loss processing operation can be performed based on the status information of the global cache. At this time, the method in this embodiment can also include: obtaining the status information of the global cache; when the status information is full, performing packet loss processing on the multiple messages to be forwarded, or performing packet loss processing on the cached messages in the global cache, so that the global cache can store multiple messages to be forwarded.
[0137] Among them, for the global cache, different times may correspond to different status information. For example, if data is continuously stored in the global cache and the data in the global cache is not cleaned up, the global cache may be in a full state; if the data in the global cache is cleaned up regularly, the global cache may be in a not full state; since the global cache may correspond to different status information, different states of the global cache may correspond to different message forwarding operations.
[0138] Specifically, in order to ensure the stability and reliability of the message forwarding operation, before storing multiple messages to be forwarded in the global cache, the status information of the global cache can be obtained, wherein the status information of the global cache can be obtained through a preset status register. When the status information is full, packet loss processing can be performed on the multiple messages to be forwarded, or packet loss processing operations can be performed on the cached messages in the global cache, so that the global cache can store multiple messages to be forwarded, thereby effectively ensuring the accurate reliability of the storage of multiple messages to be forwarded.
[0139] In this embodiment, by acquiring a message cache queue located at the media access control layer, a plurality of messages to be forwarded are determined to be written into the data queue based on the message cache queue, and then a message receiving area in the data queue that allows the message writing operation is determined. When the message receiving area can store a plurality of messages to be forwarded, the plurality of messages to be forwarded in the message cache queue can be written into the message receiving area. This effectively achieves that the data queue in the data gateway can be acquired based on the message cache queue, so that the message forwarding operation can be performed based on the data queue, further improving the practicality of the method.
[0140] In specific applications, take the cloud gateway as a data gateway as an example, where the cloud gateway may include: Field Programmable Gate Array (FPGA) network card components and multi-core processing components, see the attached Figure 7-Figure 8As shown, this application embodiment provides a method for congestion control of a data path based on a cloud gateway, which can solve the problems of packet loss and long-tail delay caused by traffic bursts on the data path. The executor of the method can be implemented as a cloud gateway. The cloud gateway can adopt a combination of software and hardware. In the message receiving direction of the data plane, it can collect the status of the receiving queue RX / transmitting queue TX of the network card component in real time, and then control the speed or rate of the area to be backfilled (mbuf) in the backfill queue according to the queue status and the congestion control algorithm to achieve congestion control operations. In addition, the method is a flow control operation implemented based on data messages, so that congestion control accuracy at the microsecond level can be achieved; the technical solution can achieve the online system without perception, so that the method has good affinity, so that the deployment and evolution of the method are very flexible. Specifically, the method of congestion control of the data path may include:
[0141] Step 1: The FPGA network card component in the cloud gateway receives the message to be processed.
[0142] Among them, the FPGA network card component can be connected to the client for communication. When the user has a message processing demand, the FPGA network card component can actively or passively obtain the message to be processed through the client.
[0143] Step 2: Write the message to be processed into the message buffer queue through the DMA component in the FPGA network card component.
[0144] The message cache queue may be a queue located at a media access control layer MAC, and the message cache queue is used to cache received messages to be processed.
[0145] Step 3: Determine the receiving area size of the message receiving area corresponding to the receiving queue in the FPGA network card component.
[0146] Among them, there may be three types of cache areas corresponding to the receiving queue, specifically including: a message receiving area, a message sending area, and an area to be backfilled (corresponding to the area to be allocated in the above embodiment). The message receiving area is used to implement the message writing operation. This area can be a completion area for backfilling the area to be backfilled by the PMD driver component in the multi-core processing component. The DMA component can perform a message writing operation from the starting position of this area. Specifically, the message to be processed in the message cache queue can be written to the message receiving area, thereby obtaining the message to be forwarded in the receiving queue. The message sending area is used to implement the message sending operation. This area can be a completion area for performing a message writing operation by the DMA component. The PMD driver component can forward the message at the starting position of this area to the CPU in the multi-core processing component (for example: X86 component) for processing. The area to be backfilled is used to implement the message cache operation. The area to be backfilled can be a completion area corresponding to the message receiving operation performed by the PMD driver component.
[0147] In addition, the area to be backfilled and the message receiving area in the receiving queue can be switched, as well as the message receiving area and the message sending area. Fig. 9 As shown, the PMD component can start receiving messages from the message sending area to forward the messages in the message sending area to the CPU for processing, and then the message sending area can be converted into the area to be backfilled. In some instances, when some messages in the message sending area are forwarded to the CPU for processing, the specific message sending area corresponding to the part of the messages that have completed the forwarding operation can be converted into the area to be backfilled; or, the message sending area corresponding to each message that has completed the forwarding operation can be converted into the area to be backfilled; the DMA component can write the message from the message cache queue to the message receiving area in the receiving queue, and then the message receiving area can be converted into the message sending area; the PMD component can perform an area backfill operation based on the area to be backfilled converted from the message sending area, and after completing the area backfill operation, the area to be backfilled completed by the area backfill operation becomes the message receiving area.
[0148] From the above, it can be seen that the dynamic change process between the above three areas can reflect the load change information on the link. For example, when the load on the link is large, the message receiving area corresponding to the receiving queue will become larger due to the backlog of messages, and the to-be-backfilled area corresponding to the receiving queue will become smaller due to the slower response. Therefore, the backfill rate of the to-be-backfilled area can be dynamically adjusted according to the change information of the to-be-backfilled area; or, the backfill rate of the to-be-backfilled area can be dynamically adjusted according to the change information of the to-be-backfilled area or the message receiving area, so as to be able to regulate the load in the system.
[0149] Step 4: Based on the size of the receiving area, it is determined whether the message receiving area can store the batch of messages to be processed.
[0150] Among them, a batch parameter batch for processing messages to be processed is pre-configured, and a message demand area for messages to be processed of the batch to be processed is determined based on the batch parameter batch. The message demand areas for messages to be processed corresponding to different batch parameters batch are different. The size of the receiving area is analyzed and compared with the message demand area. When the size of the receiving area is smaller than the message demand area, it means that the message receiving area cannot store the messages to be processed of the batch to be processed, and then step 5 can be executed; when the size of the receiving area is greater than or equal to the message demand area, it means that the message receiving area can store the messages to be processed of the batch to be processed, and then step 6 is executed.
[0151] Step 5: When the message receiving area cannot store the to-be-processed messages of the to-be-processed batch, there is no need to write the messages in the message cache queue to the message receiving area in the receiving queue, and the to-be-processed messages are stored in the global cache.
[0152] Among them, before storing the pending message in the global cache, it can be detected whether the pending message can be stored in the global cache. When the pending message can be stored in the global cache, the pending message is allowed to be stored in the global cache area; because the capacity of the global cache area is limited, after the global cache area is full, the pending message cannot be stored in the global cache area, and then the traffic back pressure operation can be performed, and specifically, data packet loss processing can be performed through the back pressure MAC layer, which can specifically include: packet loss processing for the pending message; or, clearing some messages in the global cache, so that the global cache area after the clearing operation can store the pending message, and can protect the CPU from causing data packet loss and increasing long-tail delay.
[0153] Step 6: When the message receiving area is able to store the batch of messages to be processed, the messages in the message buffer queue are written into the message receiving area in the receiving queue.
[0154] Step 7: Determine the area size of the to-be-backfilled area in the receiving queue, the queue size of the receiving queue, and a congestion control threshold for identifying whether the link is congested.
[0155] Step 8: Mapping the area size of the area to be backfilled, the queue size of the receiving queue, and the congestion control threshold for identifying whether the link is congested to the multi-core processing component.
[0156] Step 9: Notify the PMD driver component to perform a message receiving operation to inform the multi-core processing component to prepare a cache space for receiving data packets.
[0157] Step 10: The PMD driver component in the multi-core processing component can identify whether the link is in a congested state based on the area size of the mapped area to be backfilled, the queue size of the receiving queue, and the congestion control threshold used to identify whether the link is congested.
[0158] Among them, the PMD driver component obtains the queue identifier queue id of the queue to be read, determines the queue to be read based on the queue identifier queue id, and can update the data write position of the queue to be read RX queue based on the queue identifier queue id, and notify the PMD driver component to perform the message receiving operation. In addition, in order to accurately implement the message reading operation or the message receiving operation, the load operation status of the link can be identified first, and specifically, the area size N of the area to be backfilled can be analyzed and compared with the congestion control threshold K. When the area size N of the area to be backfilled is greater than or equal to the congestion control threshold K, it is determined that the link is not in a blocked state; when the area size N of the area to be backfilled is less than the congestion control threshold K, it is determined that the link is in a blocked state.
[0159] Step 11: When it is determined that the link is not in a blocked state, the backfill speed of the area to be backfilled can be maintained or increased, and then the buffer in the buffer pool can be used to fill all the free positions in the receiving queue, that is, the backfill operation of the area to be backfilled is completed.
[0160] Step 12: When it is determined that the link is in a congested state, a congestion control algorithm is used to regulate the backfill speed of the area to be backfilled.
[0161] Specifically, a first preset coefficient A and a second preset coefficient B are obtained for regulating the backfill speed of the area to be backfilled. In some instances, A=1, B=2. When N>K, the backfill speed of the area to be backfilled can be determined based on the first preset coefficient A, and the backfill speed can be (NK) area spaces; when N<K, the backfill speed of the area to be backfilled can be determined based on the second preset coefficient B, and the backfill speed can be (KN) / 2 area spaces. In this way, when the link is in an unblocked state, the backfill speed of the area to be backfilled can be increased or maintained, which is beneficial to improving the quality and efficiency of message processing; when the link is in a blocked state, the backfill speed of the area to be backfilled can be reduced, which can minimize the problems of data packet loss and long-tail delay.
[0162] It should be noted that the first preset coefficient A and the second preset coefficient B can not only be implemented as "1" and "2" as mentioned above, but technical personnel in this field can also flexibly adjust the first preset coefficient A and the second preset coefficient B according to specific application scenarios or application requirements, as long as it can be achieved that when the link is in an unblocked state, the backfill speed of the area to be backfilled can be increased or maintained; when the link is in a blocked state, the backfill speed of the area to be backfilled can be reduced.
[0163] Step 13: When the message writing state is completed, the message receiving area corresponding to the receiving queue can be converted into a message sending area.
[0164] Step 14: Forward the message in the message sending area to the CPU in the multi-core processing component for processing.
[0165] Step 15: After the message forwarding CPU in the message sending area processes the message, the multi-core processing component may determine a released area based on the forwarded message, and determine a backfill area size of the to-be-backfilled area based on the released area.
[0166] Step 16: backfill the area to be backfilled corresponding to the receiving queue based on the size of the backfill area. Specifically, the backfill operation can be performed on the area to be backfilled corresponding to the receiving queue using a continuous cache area or a discontinuous cache area in the system cache pool.
[0167] The technical solution provided by this application embodiment can achieve the following effects: 1) Congestion detection operation can be implemented without deploying a bypass traffic detection system. The size of the backfill area to be backfilled corresponding to the receiving queue (message receiving queue) is counted, and then the backfill area size and the set threshold are analyzed and matched, and the congestion control algorithm is run to control the backfill rate of the backfill area to be backfilled, so as to control the rate at which the DMA component writes messages to the receiving queue. In this way, the load of the link can be controlled in a negative feedback manner without occupying additional CPU resources, and the congestion packet loss and long delay problems of the system can be solved; 2) Congestion control is performed on the data plane. The congestion control logic can be integrated into the message receiving logic in the PMD component, which is less invasive to the application system. Each receiving queue The message sending logic and message receiving logic can run independently. During the packet receiving operation of the PMD driver component, congestion control can be performed on the messages in the receiving queue. The congestion control accuracy is high and can achieve the congestion control accuracy of the microsecond level corresponding to the message processing operation, thereby improving the quality and response speed of message processing; 3) To solve the problem of load imbalance between cores, the receiving queue corresponding to each core can run congestion control independently, and the backfill rate corresponding to the to-be-backfilled area of each receiving queue can be controlled; 4) There is no need to design an additional traffic backpressure module, and the PMD driver component and DMA component are used for backpressure operations. In general, the implementation principle of this method is simple, the application system is basically unaware, it has extremely high technical innovation value, and further improves the practicality of this method.
[0168] Fig.10 A schematic diagram of a control device for message forwarding provided in an embodiment of the present invention; Fig.10 As shown, this embodiment provides a control device for message forwarding. The execution subject of the method is the control device for message forwarding. The control device for message forwarding can be implemented as a data gateway, that is, the control device for message forwarding can be applied to a data gateway. The control device for message forwarding can be implemented as software, or a combination of software and hardware. When the control device for message forwarding is implemented as hardware, it can be various electronic devices with message forwarding control capabilities, including but not limited to personal computers, servers, etc. When the control device for message forwarding is implemented as software, it can be installed in the electronic devices listed above. Based on the above-mentioned control device for message forwarding, the control device for message forwarding in this embodiment may include:
[0169] A first acquisition module 11 is used to acquire a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded;
[0170] A first determination module 12, used to determine a load state of a processor, wherein the processor is used to process the message to be forwarded and to dynamically allocate the area to be allocated;
[0171] The first processing module 13 is used to control the distribution speed of the area to be distributed based on the load status.
[0172] In some examples, when the first determination module 12 determines the load status, the first determination module 12 is used to perform: determining a current area size of the area to be allocated; and determining the load status based on the current area size.
[0173] In some instances, when the first determination module 12 determines the load state based on the current area size, the first determination module 12 is used to perform: obtaining an allocated area threshold for identifying the load state; when the current area size is greater than the allocated area threshold, determining the load state as a first state for identifying that no congestion has occurred; and when the current area size is less than or equal to the allocated area threshold, determining the load state as a second state for identifying that congestion has occurred.
[0174] In some instances, when the first processing module 13 controls the allocation speed of the area to be allocated based on the load status, the first processing module 13 is used to execute: obtaining the allocation speed for dynamically allocating the area to be allocated; when the load status is a first status for indicating that no congestion has occurred, increasing or maintaining the allocation speed; when the load status is a second status for indicating that congestion has occurred, decreasing the allocation speed.
[0175] In some instances, when the first processing module 13 obtains an allocation speed for dynamically allocating areas to be allocated, the first processing module 13 is used to execute: determining a theoretical allocation area size of an allocation area, and an allocation area threshold for identifying a load state; and determining an allocation speed for dynamically allocating areas to be allocated based on the theoretical area allocation size and the allocation area threshold.
[0176] In some instances, when the first processing module 13 determines an allocation speed for dynamically allocating areas to be allocated based on a theoretical area allocation size and an allocation area threshold, the first processing module 13 is used to execute: obtaining the number of deviation areas between the theoretical area allocation size and the allocation area threshold; and determining an allocation speed for dynamically allocating the areas to be allocated based on the number of deviation areas, wherein the allocation speed is positively correlated with the number of deviation areas.
[0177] In some instances, when the first processing module 13 increases or maintains the distribution speed, the first processing module 13 is used to execute: obtaining a first coefficient for adjusting the distribution speed; increasing or maintaining the distribution speed based on the first coefficient to obtain an adjusted distribution speed, wherein the adjusted distribution speed is greater than or equal to the distribution speed.
[0178] In some examples, when the first processing module 13 reduces the distribution speed, the first processing module 13 is used to execute: obtaining a second coefficient for adjusting the distribution speed; reducing the distribution speed based on the second coefficient to obtain an adjusted distribution speed, wherein the adjusted distribution speed is less than the distribution speed.
[0179] In some instances, the data queue corresponds to a message receiving area that allows message writing operations; when the first determination module 12 determines the load state of the processor, the first determination module 12 is used to execute: determine the receiving area size of the message receiving area; based on the receiving area size, determine the load state, and the load state is used to identify whether congestion occurs.
[0180] In some instances, when the first determination module 12 determines the load state based on the receiving area size, the first determination module 12 is used to perform: obtaining a receiving area threshold for identifying the load state; when the receiving area size is greater than the receiving area threshold, determining the load state as a first state for identifying that no congestion has occurred; when the receiving area size is less than or equal to the receiving area threshold, determining the load state as a second state for identifying that congestion has occurred.
[0181] In some examples, when the first determination module 12 determines the load status based on the received area size, the first determination module 12 is used to perform: determining the current area size of the area to be allocated; and determining the load status based on the received area size and the current area size.
[0182] In some instances, when the first determination module 12 determines the load state based on the receiving area size and the current area size, the first determination module 12 is used to perform: obtaining an allocated area threshold for identifying the load state, and a receiving area threshold for identifying the load state; when the receiving area size is greater than the receiving area threshold and the current area size is greater than the allocated area threshold, determining the load state as a first state for identifying that no congestion has occurred; when the receiving area size is less than or equal to the receiving area threshold, or the current area size is less than or equal to the allocated area threshold, determining the load state as a second state for identifying that congestion has occurred.
[0183] In some instances, the data queue corresponds to a message sending area that allows message sending operations; when the first determination module 12 determines the load status based on the receiving area size and the current area size, the first determination module 12 is used to execute: determine the sending area size of the message sending area; determine the load status based on the receiving area size, the current area size and the sending area size.
[0184] In some examples, after controlling the distribution speed of the to-be-distributed area based on the load state, the first acquisition module 11 and the first processing module 13 in this embodiment are used to perform the following steps:
[0185] The first acquisition module 11 is used to acquire the allocation status of the area to be allocated;
[0186] The first processing module 13 is used to adjust the area to be allocated to the message receiving area when the allocation state is the completion state.
[0187] In some examples, the first acquisition module 11 and the first processing module 13 in this embodiment are used to perform the following steps:
[0188] A first acquisition module 11 is used to acquire a message writing status corresponding to a message receiving area;
[0189] The first processing module 13 is used to adjust the message receiving area to the message sending area when the message writing state is the completion state.
[0190] In some examples, the first acquisition module 11 and the first processing module 13 in this embodiment are used to perform the following steps:
[0191] A first acquisition module 11 is used to acquire a message sending status corresponding to a message sending area;
[0192] The first processing module 13 is configured to determine a theoretical allocation area size of the area to be allocated based on a sending area size of the message sending area when the message sending state is a completion state.
[0193] In some examples, before obtaining the data queue in the data gateway, the first obtaining module 11, the first determining module 12 and the first processing module 13 in this embodiment are used to perform the following steps:
[0194] A first acquisition module 11 is used to acquire a message cache queue located at a media access control layer, wherein the message cache queue includes a plurality of messages to be processed;
[0195] A first determination module 12 is used to determine a plurality of to-be-forwarded messages to be written into a data queue based on the message cache queue;
[0196] The first determination module 12 is further used to determine a message receiving area in the data queue where a message writing operation is allowed;
[0197] The first processing module 13 is configured to write a plurality of messages to be forwarded in the message buffer queue into the message receiving area when the message receiving area is capable of storing a plurality of messages to be forwarded.
[0198] Fig.10 The device shown can perform Figure 2-Figure 9 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 2-Figure 9 The implementation process and technical effects of this technical solution refer to Figure 2-Figure 9 The description in the illustrated embodiment will not be repeated here.
[0199] In one possible design, Fig.10 The structure of the control device for message forwarding shown in the figure can be realized as an electronic device, which can be a controller, a personal computer, a server, or other devices. Fig.11 As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 is used to store the corresponding electronic device to execute the above Figure 2-Figure 8 The program of the message forwarding control method provided in the illustrated embodiment, the first processor 21 is configured to execute the program stored in the first memory 22 .
[0200] The program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the first processor 21: obtaining a data queue in the data gateway, the data queue including messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded; determining the load state of the processor, wherein the processor is used to process the messages to be forwarded and dynamically allocate the area to be allocated; and controlling the allocation speed of the area to be allocated based on the load state.
[0201] Furthermore, the first processor 21 is also used to execute the aforementioned Figure 2 All or part of the steps in the illustrated embodiments.
[0202] The structure of the electronic device may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.
[0203] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 2 The program involved in the message forwarding control method in the illustrated embodiment.
[0204] In addition, an embodiment of the present invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the above Figure 2 The steps in the method for controlling message forwarding in the method embodiment are shown.
[0205] Fig.12 A schematic diagram of a data gateway structure provided by an embodiment of the present invention is shown in FIG. Fig.12 As shown, this embodiment provides a data gateway, which is used to execute Figure 2 The control method for message forwarding shown, specifically, the data gateway may include:
[0206] The network card component 31 is used to obtain a data queue in the data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded;
[0207] The processing component 32 is in communication with the network card component 31 and is used to determine the load status of the processor, wherein the processor is used to process the message to be forwarded and dynamically allocate the area to be allocated; and control the allocation speed of the area to be allocated based on the load status.
[0208] The network card component 31 can be implemented as an FPGA network card, and the processing component 32 can be implemented as a multi-core processing component (for example, an X86 component). Specifically, the data gateway in this embodiment can execute Figure 2-Figure 9 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 2-Figure 9 The implementation process and technical effects of this technical solution refer to Figure 2-Figure 9 The description in the illustrated embodiment will not be repeated here.
[0209] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0210] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0211] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0212] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0213] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide the functions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps of the functions specified in the blocks or multiple blocks. In a typical configuration, the computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0214] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0215] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for controlling message forwarding, characterized in that: Applied to a data gateway, the data gateway includes a processor for processing a message to be forwarded; the method includes: Acquire a data queue in the data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded; Determining a load state of a processor, wherein the processor performs a dynamic allocation operation on the area to be allocated; Controlling the allocation speed of the area to be allocated based on the load state, wherein the allocation speed is used to identify the area size corresponding to one allocation operation on the area to be allocated; The step of determining the load state of the processor includes: Determine the current area size of the area to be allocated; The load status is determined based on the current area size, and the load status is used to identify whether congestion occurs.
2. The method according to claim 1, characterized in that Determining the load state based on the current area size includes: obtaining an allocation area threshold for identifying the load state; When the current area size is greater than the allocated area threshold, determining that the load state is a first state for indicating that no congestion occurs; When the current area size is less than or equal to the allocated area threshold, the load state is determined to be a second state for identifying that congestion has occurred.
3. The method according to claim 1, characterized in that The data queue corresponds to a message receiving area that allows message writing operations; Determine the processor load status, including: Determine a receiving area size of the message receiving area; The load status is determined based on the size of the receiving area, and the load status is used to identify whether congestion occurs.
4. The method according to claim 3, characterized in that Determining the load state based on the size of the receiving area includes: obtaining a receiving area threshold for identifying the load state; When the receiving area size is greater than the receiving area threshold, determining that the load state is a first state for indicating that no congestion occurs; When the receiving area size is less than or equal to the receiving area threshold, the load state is determined to be a second state for identifying that congestion has occurred.
5. The method according to claim 3, characterized in that: Determining the load state based on the size of the receiving area includes: Determine the current area size of the area to be allocated; The load status is determined based on the receiving area size and the current area size.
6. The method according to claim 5, characterized in that Determining the load state based on the receiving area size and the current area size includes: Acquire a distribution area threshold for identifying the load state and a reception area threshold for identifying the load state; When the receiving area size is greater than the receiving area threshold and the current area size is greater than the allocation area threshold, determining that the load state is a first state for indicating that no congestion occurs; When the receiving area size is smaller than or equal to the receiving area threshold, or the current area size is smaller than or equal to the allocated area threshold, the load state is determined to be a second state for identifying that congestion has occurred.
7. The method according to claim 5, characterized in that The data queue corresponds to a message sending area that allows message sending operations; and based on the receiving area size and the current area size, determining the load state includes: Determine the size of the sending area of the message sending area; The load status is determined based on the receiving area size, the current area size, and the sending area size.
8. The method according to any one of claims 1 to 7, characterized in that: Controlling the distribution speed of the to-be-distributed area based on the load state includes: Acquire an allocation speed for dynamically allocating the area to be allocated; When the load state is in the first state for indicating that no blockage occurs, increasing or maintaining the dispensing speed; When the load state is in the second state for indicating that a blockage has occurred, the dispensing speed is reduced.
9. The method according to claim 8, characterized in that Obtaining an allocation speed for dynamically allocating the area to be allocated, including: determining a theoretical area allocation size of the allocation area and an allocation area threshold for identifying the load state; Based on the theoretical area allocation size and the allocation area threshold, an allocation speed for dynamically allocating the area to be allocated is determined.
10. The method according to claim 9, characterized in that Determining an allocation speed for dynamically allocating the to-be-allocated area based on the theoretical area allocation size and the allocation area threshold includes: Obtaining the number of deviation areas between the theoretical area allocation size and the allocation area threshold; Based on the number of deviation areas, an allocation speed for dynamically allocating the to-be-allocated areas is determined, wherein the allocation speed is positively correlated with the number of deviation areas.
11. The method according to any one of claims 3 to 7, characterized in that: After controlling the distribution speed of the to-be-distributed area based on the load state, the method further includes: Obtaining the allocation status of the area to be allocated; When the allocation state is a completed state, the area to be allocated is adjusted to the message receiving area.
12. The method according to any one of claims 3 to 7, characterized in that: The method further comprises: Obtaining the message writing status corresponding to the message receiving area; When the message writing state is a completion state, the message receiving area is adjusted to a message sending area.
13. The method according to any one of claims 3 to 7, characterized in that: The method further comprises: Get the message sending status corresponding to the message sending area; When the message sending state is a completion state, the theoretical area allocation size of the area to be allocated is determined based on the sending area size of the message sending area.
14. The method according to any one of claims 1 to 7, characterized in that: Before acquiring the data queue in the data gateway, the method further includes: Acquire a message cache queue located at a media access control layer, wherein the message cache queue includes a plurality of messages to be processed; Based on the message cache queue, determining a plurality of to-be-forwarded messages to be written into the data queue; Determine a message receiving area in the data queue where a message writing operation is allowed; When the message receiving area is capable of storing the plurality of messages to be forwarded, the plurality of messages to be forwarded in the message buffer queue are written into the message receiving area.
15. A control device for message forwarding, characterized in that: Applied to a data gateway, the data gateway includes a processor for processing a message to be forwarded; the device includes: A first acquisition module is used to acquire a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded; A first determination module, used to determine a load state of a processor, wherein the processor is used to dynamically allocate the area to be allocated; A first processing module, configured to control an allocation speed of the area to be allocated based on the load state, wherein the allocation speed is used to identify an area size corresponding to one allocation operation on the area to be allocated; The first determination module is further used to determine the current area size of the area to be allocated; based on the current area size, determine the load status, and the load status is used to identify whether congestion occurs.
16. A data gateway, characterized in that: include: A network card component, used for obtaining a data queue in a data gateway, wherein the data queue includes messages to be forwarded, and the data queue corresponds to an area to be allocated for caching the messages to be forwarded; A processing component, comprising a processor, the processing component is in communication with the network card component, and is used to determine a load state of the processor, wherein the processor is used to process the message to be forwarded and dynamically allocate the area to be allocated; based on the load state, an allocation speed of the area to be allocated is controlled, wherein the allocation speed is used to identify an area size corresponding to an allocation operation performed on the area to be allocated; The processing component is further used to determine the current area size of the area to be allocated; based on the current area size, determine the load state, and the load state is used to identify whether congestion occurs.
17. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1 to 14.
18. A computer storage medium, characterized in that: Used to store a computer program, which enables a computer to implement the method of any one of claims 1 to 14 when executed.
19. A computer program product, characterized in that include: A computer program, when executed by a processor of an electronic device, causes the processor to execute the steps of any one of the methods of claims 1 to 14.
Citation Information
Patent Citations
Method, device and system for processing messages in server system
CN110580202A