Flow control optimization method and system

By prioritizing the interface and adding priority information to the packet header, the problem of interface delay in high concurrency and high throughput environments is solved, and the stability and response time of high-priority interfaces are guaranteed.

CN119583465APending Publication Date: 2025-03-07FUJIAN TQ ONLINE INTERACTIVE INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411783192.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In a high concurrency and high throughput environment, the random packet transmission of multiple http requests or RPC requests in a TCP connection may cause the key interface to delay due to waiting for data transmission time.

Method used

By prioritizing the interface, the interface is divided into high priority, medium priority and low priority, and priority information is added to the data packet header, the packet header information is read when the underlying TCP layer receives data packets, and the packet is sent to the corresponding queue, and the high priority queue messages are processed first.

Benefits of technology

By adjusting the priority order of packets, the stability and response time of high-priority interfaces can be effectively guaranteed, and packet transmission delays caused by indefinite queueing can be prevented.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583465A_ABST
    Figure CN119583465A_ABST
Patent Text Reader

Abstract

The invention discloses a flow control optimization method and system. The method comprises the following steps: uniformly arranging priorities for interfaces in a project; s2, providing a universal external request SDK (Software Development Kit), splitting a requested data packet from the inside of the SDK, and adding priority information corresponding to a self interface into the corresponding data packet after splitting; s3, when the bottom layer of the TCP receives the data packets, header information reading is preferentially carried out on all the received packets, and the corresponding packets are sent to three corresponding new queues, namely a high queue, a middle queue and a low queue, according to the priorities in the header information; and S4, preferentially sending a high queue message, a middle queue message and a low queue message, setting a certain time interval at the same time, and carrying out packet sending in the next stage after all queue messages in one stage are sent. And the stability and the response time of the high-priority interface can be ensured emphatically.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer communications, and in particular to an optimization method and system for flow control. Background Art

[0002] At present, in order to meet the requirements of high concurrency and high throughput, the server usually adopts the microservice deployment method to deploy services. Under the microservice architecture, in order to achieve access and data interaction between different services, data interaction is usually carried out through the http protocol or the rpc protocol. Generally speaking, the bottom layer of http and rpc uses the TCP protocol to transmit data packets. At present, in order to reuse connections, usually a TCP connection may support multiple http requests or RPC requests at the upper layer, and each request may generate multiple data packets. At present, multiple data packets at the upper layer are transmitted through TCP in a random manner. In this way, some key interfaces may be delayed due to the waiting time for data transmission. Summary of the invention

[0003] To overcome the above problems, the purpose of the present invention is to provide a flow control optimization method that can adjust the priority order of packet transmission, focusing on ensuring the stability and response time of high-priority interfaces.

[0004] The present invention is implemented by the following scheme: a method for optimizing flow control, the method comprising the following steps:

[0005] Step S1: uniformly arrange the priorities of the interfaces in the project, and classify the interfaces into high priority, medium priority and low priority according to the priorities defined in the business;

[0006] Step S2: Provide a universal external request SDK, split the requested data packet within the SDK package, and add the priority information corresponding to the own interface in the corresponding data packet after splitting;

[0007] Step S3: When the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues, namely the high queue, the middle queue, and the low queue, according to the priority in the packet header information;

[0008] Step S4: high queue messages are sent first, followed by medium queue messages, and finally low queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait until all queue messages of one stage are sent before sending the next stage package.

[0009] Furthermore, the data packet splitting is further as follows: when an interface request needs to transfer a kb of data, the bottom layer automatically splits the data into b data packets, and sets the priority data of the corresponding interface in the header of each data packet.

[0010] Furthermore, the priority information corresponding to the own interface needs to be added in the corresponding data packet after the splitting, and further includes: recording the priority service information of the corresponding interface in the request header block of each data packet.

[0011] A flow control optimization system, the system comprising a priority arrangement module, a data packet splitting module, a data packet queuing module and a queue data packet sending module;

[0012] The priority arrangement module: uniformly arranges the priorities of the interfaces in the project, and divides the interfaces into high priority, medium priority and low priority according to the priorities defined in the business;

[0013] The data packet splitting module provides a universal external request SDK, which splits the requested data packets within the SDK package, and after splitting, it is necessary to add the priority information corresponding to its own interface in the corresponding data packets;

[0014] The data packet queuing module: when the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues according to the priority in the packet header information, namely the high queue, the middle queue, and the low queue;

[0015] The queue data packet sending module: first sends high queue messages, then medium queue messages, and finally low queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait until all queue messages of one stage are sent before sending the next stage packet.

[0016] Furthermore, the data packet splitting is further as follows: when an interface request needs to transfer a kb of data, the bottom layer automatically splits the data into b data packets, and sets the priority data of the corresponding interface in the header of each data packet.

[0017] Furthermore, the priority information corresponding to the own interface needs to be added in the corresponding data packet after the splitting, and further includes: recording the priority service information of the corresponding interface in the request header block of each data packet.

[0018] The beneficial effects of the present invention are as follows: for each interface in the project, the priority of the interface is set first, and a general request forwarding layer function is provided. When the upper layer protocol is converted into the lower layer protocol, the priority of the interface is included in the generated data packet header. When the underlying TCP performs data transmission, certain rules can be adopted to sort the data packets, give priority to processing high-priority data packets, and then process low-priority data packets. In this way, the interface's own priority data is added to the data packet header, and the underlying layer can adjust the priority order of packet sending, thereby focusing on ensuring the stability and response time of the high-priority interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a schematic flow chart of the method of the present invention.

[0020] Figure 2 It is a system principle block diagram of the present invention. DETAILED DESCRIPTION

[0021] The present invention will be further described below in conjunction with the accompanying drawings.

[0022] See also Figure 1 As shown, a flow control optimization method of the present invention comprises the following steps:

[0023] Step S1: uniformly arrange the priorities of the interfaces in the project, and classify the interfaces into high priority, medium priority and low priority according to the priorities defined in the business;

[0024] Step S2: Provide a universal external request SDK, split the requested data packet within the SDK package, and add the priority information corresponding to the own interface in the corresponding data packet after splitting;

[0025] Step S3: When the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues, namely the high queue, the middle queue, and the low queue, according to the priority in the packet header information;

[0026] Step S4: high queue messages are sent first, followed by medium queue messages, and finally low queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait until all queue messages of one stage are sent before sending the next stage package.

[0027] The present invention will be further described below in conjunction with a specific embodiment:

[0028] A flow control optimization method,

[0029] 1. Prioritize the interfaces in the project in a unified manner, and classify the interfaces into high priority, medium priority, and low priority according to the priorities defined in the business;

[0030] For example: 1. Assume there are 3 types of interfaces, 2 interfaces for each type of interface, and 6 interfaces with 3 priorities: high, medium, and low. Assume each interface has 10K data volume.

[0031] 2. Provide a general external request SDK, which splits the requested data packets within the SDK package. After splitting, the priority information corresponding to the interface itself needs to be added to the corresponding data packets; all external request functions of the system, including http protocol or rpc protocol, are forwarded and processed by the SDK package.

[0032] 2.1 The data packet splitting is further as follows: when an interface request needs to transfer a kb of data, the bottom layer automatically splits the data into b data packets and sets the priority data of the corresponding interface in the header of each data packet.

[0033] 2.2 After the splitting, the priority information corresponding to the own interface needs to be added in the corresponding data packet, and further includes: recording the priority business information of the corresponding interface in the request header block of each data packet.

[0034] For example: 2. When each interface data arrives at the SDK package, the 10K interface data will be split into 10 data packets, each of which is about 1K.

[0035] 3. When the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues according to the priority in the packet header information, namely the high queue, the middle queue, and the low queue;

[0036] For example, there are three queues, corresponding to high, medium, and low queues, and each queue stores 20 data packets.

[0037] 4. Send high-queue messages first, followed by medium-queue messages, and finally low-queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait for all queue messages in a stage to be sent before sending the next stage of packets. A certain time interval needs to obtain this interval data according to different business stress tests. Generally speaking, a 10-millisecond execution interval is generally set; the stage here refers to a certain time period, and it is necessary to wait for all data packets in the stage to be sent. When the high priority is sent, the remaining threads or network resources need to be used to give priority to the sending of other priority messages in the time period. In this way, the interface's own priority data is added to the data packet header, so that the bottom layer can adjust the priority order of packet sending, and then focus on ensuring the stability and response time of the high-priority interface. This prevents some low-priority message packets from being queued indefinitely, resulting in packet sending delays.

[0038] For example: 4. First, request the high interface once, the middle interface once, and the low interface once. This is one stage, and each of the three queues stores 10 data packets. When the high, middle, and low interfaces are requested again, 30 data packets will be regenerated to the queues. This is the second stage. In the data packet sending function, the high data of the first stage is sent first, followed by the middle and low data. It is necessary to wait for the data packets of the first stage to be sent before sending the data of the second stage. At this time, even if there are resources available in the first stage, the data of the second stage will not be sent first to prevent the low-priority data packets from being occupied by resources indefinitely, which will cause the message to be delayed.

[0039] See also Figure 2 As shown, the present invention also provides a flow control optimization system, the system comprising a priority arrangement module, a data packet splitting module, a data packet queuing module and a queue data packet sending module;

[0040] The priority arrangement module: uniformly arranges the priorities of the interfaces in the project, and divides the interfaces into high priority, medium priority and low priority according to the priorities defined in the business;

[0041] For example: 1. Assume there are 3 types of interfaces, 2 interfaces for each type of interface, and 6 interfaces with 3 priorities: high, medium, and low. Assume each interface has 10K data volume.

[0042] The data packet splitting module provides a universal external request SDK, which splits the requested data packets within the SDK package. After splitting, the priority information corresponding to its own interface needs to be added to the corresponding data packet; all external request functions of the system, including those of the http protocol or the rpc protocol, are forwarded and processed by the SDK package.

[0043] The data packet splitting is further as follows: when an interface request needs to transfer a kb of data, the bottom layer automatically splits the data into b data packets, and sets the priority data of the corresponding interface in the header of each data packet.

[0044] After the splitting, the priority information corresponding to the own interface needs to be added in the corresponding data packet, further comprising: recording the priority service information of the corresponding interface in the request header block of each data packet.

[0045] For example: 2. When each interface data arrives at the SDK package, the 10K interface data will be split into 10 data packets, each of which is about 1K.

[0046] The data packet queuing module: when the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues according to the priority in the packet header information, namely the high queue, the middle queue, and the low queue;

[0047] For example, there are three queues, corresponding to high, medium, and low queues, and each queue stores 20 data packets.

[0048] The queue data packet sending module: prioritizes sending high queue messages, followed by medium queue messages, and finally low queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait for all queue messages in one stage to be sent before sending the next stage of packets. A certain time interval needs to obtain this interval data according to different business stress tests. Generally speaking, a 10 millisecond execution interval is generally set; the stage here refers to a certain time period, and it is necessary to wait for all data packets in this stage to be sent. When the high priority is sent, the remaining threads or network resources need to be used to give priority to the sending of other priority messages in this time period. In this way, the interface's own priority data is added to the data packet header, so that the bottom layer can adjust the priority order of packet sending, thereby focusing on ensuring the stability and response time of the high priority interface. This prevents some low-priority message packets from being queued indefinitely, resulting in packet sending delays.

[0049] For example: 4. First, request the high interface once, the middle interface once, and the low interface once. This is one stage, and each of the three queues stores 10 data packets. When the high, middle, and low interfaces are requested again, 30 data packets will be regenerated to the queues. This is the second stage. In the data packet sending function, the high data of the first stage is sent first, followed by the middle and low data. It is necessary to wait for the data packets of the first stage to be sent before sending the data of the second stage. At this time, even if there are resources available in the first stage, the data of the second stage will not be sent first to prevent the low-priority data packets from being occupied by resources indefinitely, which will cause the message to be delayed.

[0050] In summary, the present invention provides a general request forwarding layer function by setting the priority of the interface for each interface in the project. When the upper layer protocol is converted into the lower layer protocol, the generated data packet header carries the priority of the interface. When the underlying TCP performs data transmission, certain rules can be used to sort the data packets, give priority to high-priority data packets, and then process low-priority data packets. In this way, the interface's own priority data is added to the data packet header, and the underlying layer can adjust the priority order of packet sending, thereby focusing on ensuring the stability and response time of the high-priority interface.

[0051] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A method for optimizing flow control, characterized in that: The method comprises the following steps: Step S1: uniformly arrange the priorities of the interfaces in the project, and classify the interfaces into high priority, medium priority and low priority according to the priorities defined in the business; Step S2: Provide a universal external request SDK, split the requested data packet within the SDK package, and add the priority information corresponding to the own interface in the corresponding data packet after splitting; Step S3: When the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues, namely the high queue, the middle queue, and the low queue, according to the priority in the packet header information; Step S4: high queue messages are sent first, followed by medium queue messages, and finally low queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait until all queue messages of one stage are sent before sending the next stage package.

2. The method for optimizing flow control according to claim 1, characterized in that: The data packet splitting is further as follows: when an interface request needs to transfer a kb of data, the bottom layer automatically splits the data into b data packets, and sets the priority data of the corresponding interface in the header of each data packet.

3. The method for optimizing flow control according to claim 1, characterized in that: After the splitting, the priority information corresponding to the own interface needs to be added in the corresponding data packet, further comprising: recording the priority service information of the corresponding interface in the request header block of each data packet.

4. A flow control optimization system, characterized in that: The system includes a priority arrangement module, a data packet splitting module, a data packet queuing module and a queue data packet sending module; The priority arrangement module: uniformly arranges the priorities of the interfaces in the project, and divides the interfaces into high priority, medium priority and low priority according to the priorities defined in the business; The data packet splitting module provides a universal external request SDK, which splits the requested data packets within the SDK package, and after splitting, it is necessary to add the priority information corresponding to its own interface in the corresponding data packets; The data packet queuing module: when the bottom layer of TCP receives a data packet, it first reads the packet header information of all received packets, and sends the corresponding packets to the corresponding three new queues according to the priority in the packet header information, namely the high queue, the middle queue, and the low queue; The queue data packet sending module: first sends high queue messages, then medium queue messages, and finally low queue messages. At the same time, a certain time interval needs to be set. It is necessary to wait until all queue messages of one stage are sent before sending the next stage packet.

5. A flow control optimization system according to claim 4, characterized in that: The data packet splitting is further as follows: when an interface request needs to transfer a kb of data, the bottom layer automatically splits the data into b data packets, and sets the priority data of the corresponding interface in the header of each data packet.

6. A flow control optimization system according to claim 4, characterized in that: After the splitting, the priority information corresponding to the own interface needs to be added in the corresponding data packet, further comprising: recording the priority service information of the corresponding interface in the request header block of each data packet.