CN-122027627-A - Channel selection method and related device
Abstract
The application provides a channel selection method and a related device, and relates to the technical field of communication. The method comprises the steps of selecting a first network channel from a plurality of network channels to transmit data based on a smooth weighted polling algorithm under the condition that first data to be transmitted are detected, reducing effective weight of the first network channel if abnormality of the first network channel is detected in the process of transmitting the first data to be transmitted through the first network channel, and selecting the network channel based on the smooth weighted polling algorithm and the adjusted effective weight of the plurality of network channels under the condition that the first data to be transmitted fails to be transmitted or second data to be transmitted is detected. The technical scheme provided by the application can solve the problem of how to better realize load balancing for a plurality of network channels in the prior art.
Inventors
- HUO PING
- Mai Canwen
Assignees
- 顺丰恒通支付有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251230
Claims (10)
- 1. A method of channel selection, the method comprising: Under the condition that first data to be transmitted is detected, selecting a first network channel from a plurality of network channels to transmit the data based on a smooth weighted polling algorithm, wherein each network channel is correspondingly provided with an effective weight and a current weight, the current weight is determined based on the effective weight, and the network channel selection is realized based on the current weight; In the process of transmitting the first data to be transmitted through the first network channel, if the first network channel is detected to be abnormal, the effective weight of the first network channel is reduced; And when the first data to be transmitted fails to be transmitted or second data to be transmitted is detected, selecting a network channel based on the smooth weighted polling algorithm and the effective weights adjusted by the plurality of network channels, wherein the second data to be transmitted is new data to be transmitted after the first data to be transmitted.
- 2. The channel selection method according to claim 1, characterized in that the method further comprises: Periodically detecting connectivity of each network channel through a heartbeat detection mechanism; and under the condition that the second network channel is detected to be in an interruption state, disabling the second network channel, wherein the second network channel is the same as or different from the first network channel.
- 3. The channel selection method according to claim 2, wherein after said disabling said second network channel, said method further comprises: Under the condition that the second network channel is detected to restore the communication state, if the second network channel is different from the first network channel, reducing the effective weight of the second network channel, and gradually restoring the effective weight of the second network channel to the original value according to the response condition of the second network channel transmitting data; And under the condition that the second network channel is detected to restore the connected state, if the second network channel is the same as the first network channel, gradually restoring the effective weight of the second network channel to the original value directly according to the response condition of transmitting data by using the second network channel.
- 4. The channel selection method of claim 1, wherein the reducing the effective weight of the first network channel comprises: determining a corresponding weight reduction value according to the abnormal type of the first network channel; and reducing the effective weight of the first network channel according to the weight reduction value.
- 5. The channel selection method according to claim 1 or 4, wherein said reducing the effective weight of the first network channel comprises: And reducing the effective weight of the first network channel under the condition that the effective weights of other network channels are kept unchanged.
- 6. The channel selection method according to claim 1 or 4, wherein said reducing the effective weight of the first network channel comprises: And reducing the effective weight of the first network channel, and distributing the reduced effective weight value of the first network channel to other network channels according to a preset distribution rule.
- 7. The channel selection method of claim 1, wherein after said reducing the effective weight of the first network channel, the method further comprises: and in the process of reusing the first network channel to transmit data, if abnormal elimination of the first network channel is detected, gradually recovering the effective weight of the first network channel to an initial value.
- 8. An electronic device is characterized by comprising a memory and a processor; the memory is connected with the processor and used for storing programs; The processor is configured to implement the channel selection method according to any one of claims 1 to 7 by running a program in the memory.
- 9. A storage medium having stored thereon a computer program which, when executed by a processor, implements the channel selection method according to any of claims 1 to 7.
- 10. A computer program product, characterized in that the computer program product has stored thereon a computer program which, when being executed by a processor, implements the channel selection method according to any of claims 1 to 7.
Description
Channel selection method and related device Technical Field The present application relates to the field of communications technologies, and in particular, to a channel selection method and a related device. Background In data transmission, in order to ensure continuity of transmission service, a plurality of network channels are generally constructed, that is, redundant network channels are constructed, so as to prevent interruption of the data transmission service caused by failure of a certain network channel. For multiple network channels, load balancing is needed, so how to perform load balancing better becomes a technical problem to be solved urgently. Disclosure of Invention Based on the defects and shortcomings of the prior art, the application provides a channel selection method and a related device, which can solve the problem of how to better realize load balancing for a plurality of network channels in the prior art. According to a first aspect of an embodiment of the present application, there is provided a channel selection method, the method including: The method comprises the steps of selecting a first network channel from a plurality of network channels to transmit data based on a smooth weighted polling algorithm under the condition that first data to be transmitted are detected, reducing effective weight of the first network channel if abnormality of the first network channel is detected in the process of transmitting the first data to be transmitted through the first network channel, selecting the network channel based on the smooth weighted polling algorithm and the adjusted effective weight of the plurality of network channels under the condition that the first data to be transmitted fails or second data to be transmitted is detected, wherein each network channel is correspondingly provided with the effective weight and the current weight, the current weight is determined based on the effective weight, and the network channel selection is realized based on the current weight, and the second data to be transmitted is new data to be transmitted after the first data to be transmitted. According to a second aspect of an embodiment of the present application, there is provided a channel selection device, the device comprising: and the first selection module is used for selecting a first network channel from the plurality of network channels to transmit data based on a smooth weighted polling algorithm under the condition that the first data to be transmitted is detected. Each network channel is correspondingly provided with an effective weight and a current weight, the current weight is determined based on the effective weight, and network channel selection is realized based on the current weight. And the first weight processing module is used for reducing the effective weight of the first network channel if the first network channel is detected to be abnormal in the process of transmitting the first data to be transmitted through the first network channel. And the second selection module is used for selecting the network channel based on the smooth weighted polling algorithm and the adjusted effective weights of the plurality of network channels under the condition that the first data to be transmitted fails to be transmitted or the second data to be transmitted is detected. The second data to be transmitted is new data to be transmitted after the first data to be transmitted. According to a third aspect of an embodiment of the present application, there is provided an electronic device including a memory and a processor; the memory is connected with the processor and used for storing programs; the processor is configured to implement the channel selection method according to the first aspect by running a program in the memory. According to a fourth aspect of embodiments of the present application, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the channel selection method according to the first aspect. According to a fifth aspect of embodiments of the present application, there is provided a computer program product or computer program, the computer program product comprising the computer program, which when executed by a processor implements the steps of the channel selection method according to the first aspect. In the technical scheme provided by the application, under the condition that the data to be transmitted is generated, the target channel can be selected from a plurality of network channels for data transmission based on the smooth weighted polling algorithm. In the process of transmitting data by using the target channel, whether the target channel is abnormal or not can be detected according to the channel response condition. If the target channel is abnormal, the effective weight of the target channel is reduced. The effective weight of the network channel is reduced, and the current weight for deci