A tunnel management method

By periodically detecting and managing CPU usage, the problem of system resource fluctuations caused by a surge in the number of tunnels was solved, achieving stable system operation and optimized tunnel management.

CN119382946BActive Publication Date: 2025-11-21BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411415521.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-11-21
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

In IoT and industrial control systems, when the number of tunnels surges, the consumption of system resources fluctuates dramatically, which can affect the normal operation of the system or even cause it to crash. Existing technologies are difficult to effectively manage the tunnel construction and dismantling process.

Method used

By periodically detecting the expected CPU utilization of the target CPU and determining whether it is less than the preset maximum fluctuation value, tunnel establishment, dismantling, and keep-alive processes are performed. Combined with CPU utilization array recording and calculation, tunnel management is optimized.

Benefits of technology

This effectively avoids large fluctuations in system load, ensures stable system operation, and optimizes the tunnel management process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119382946B_ABST
    Figure CN119382946B_ABST
Patent Text Reader

Abstract

The application provides a tunnel management method, an electronic device, a readable storage medium and a computer program product. The method comprises: periodically detecting a CPU expected usage of a target CPU according to a preset detection period; determining whether the CPU expected usage is less than a preset maximum CPU fluctuation value; and if yes, performing tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing by the target CPU. It can be seen that the method can optimize tunnel management, avoid the problem of a large fluctuation in system load caused by the establishment and removal of a large number of tunnels at one time, and ensure stable operation of the system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a tunnel management method, an electronic device, a readable storage medium and a computer program product. BACKGROUND

[0002] At present, with the increasing popularity of Internet of Things and industrial control, its application scenarios are increasingly widespread, and the importance of Internet of Things security and industrial control security is increasingly prominent. In actual application, in order to guarantee the security and efficiency of data transmission, a large number of network devices in Internet of Things and industrial control system widely adopt tunnel technology for interconnection. Especially on the central network device and key node device, a large number of tunnels are usually established to communicate and exchange data with other devices. However, when the number of tunnels increases sharply, a large number of tunnel establishment and removal operations in a short time will consume a large amount of CPU computing resources. Such resource consumption not only causes the dramatic fluctuation of system resource load, but also may seriously affect the normal operation of the system, and even cause system crash or performance degradation. SUMMARY

[0003] The purpose of the present application is to provide a tunnel management method, an electronic device, a readable storage medium and a computer program product, which can optimize tunnel management, avoid the problem of large fluctuation of system load caused by establishing and removing a large number of tunnels at one time, and ensure the stable operation of the system.

[0004] The first aspect of the present application provides a tunnel management method, comprising:

[0005] Periodically detecting the CPU expected usage rate of a target CPU according to a preset detection period;

[0006] Determining whether the CPU expected usage rate is less than a preset CPU maximum fluctuation value;

[0007] If yes, performing tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing through the target CPU.

[0008] In the above implementation process, the method can periodically detect the usage rate of the CPU, so as to ensure that the CPU usage rate is not too high, and then ensure that the CPU can stably perform tunnel establishment, removal and keep-alive processing, thereby avoiding the problem of large fluctuation of load caused by instantaneous mass tunnel processing.

[0009] Further, a CPU usage rate array corresponding to each CPU is created in a tunnel management system applying the tunnel management method, and the method further comprises:

[0010] Recording the CPU expected usage rate into the CPU usage rate array matched with the target CPU.

[0011] In the implementation process, the method can record the usage of all CPUs through an array, thereby facilitating subsequent inquiry, analysis and resource allocation process.

[0012] Further, the method further comprises:

[0013] According to the first CPU usage, the second CPU usage, the third CPU usage, the first number, the second number and the third number, the CPU expected usage of the target CPU is calculated.

[0014] The first CPU usage is the CPU usage consumed by establishing a tunnel, the second CPU usage is the CPU usage consumed by removing a tunnel, the third CPU usage is the CPU usage consumed by keeping alive a tunnel, the first number is the number of tunnels to be established, the second number is the number of tunnels to be removed, and the third number is the number of tunnels to be kept alive.

[0015] In the implementation process, the method can calculate the expected CPU usage based on the expected situation of tunnel establishment, removal and keeping alive, thereby quantifying the expected CPU usage and facilitating tunnel management.

[0016] Further, before periodically detecting the CPU expected usage of the target CPU according to the preset detection period, the method further comprises:

[0017] In the case of CPU empty load, the first CPU usage consumed by establishing a tunnel, the second CPU usage consumed by removing a tunnel and the third CPU usage consumed by keeping alive a tunnel are calculated.

[0018] In the implementation process, the method can accurately calculate the CPU single usage of tunnel establishment, removal and keeping alive, thereby helping to optimize the implementation of more refined CPU usage management.

[0019] Further, in the case of CPU empty load, the first CPU usage consumed by establishing a tunnel, the second CPU usage consumed by removing a tunnel and the third CPU usage consumed by keeping alive a tunnel are calculated, comprising:

[0020] The number of tunnels established per second is tested from the case of empty load to the case of CPU full load, and the first CPU usage consumed by establishing a tunnel is calculated according to the number of tunnels established per second.

[0021] the number of tunnels torn down per second when the CPU is from empty load to full load; and calculating the second CPU usage rate consumed by tearing down a tunnel according to the number of tunnels torn down per second;

[0022] the total number of all alive tunnels when the CPU is from empty load to full load; and calculating the third CPU usage rate consumed by keeping a tunnel alive according to the total number of all alive tunnels.

[0023] In the implementation process, the method can more accurately determine the real-time CPU usage rate of establishing and tearing down a single tunnel and the real-time CPU usage rate occupied by keeping a single tunnel alive, thereby improving the calculation accuracy of the CPU expected usage rate.

[0024] Further, the calculation formula of the CPU expected usage rate is:

[0025] rate1=b*α+c*β+b*γ-c*γ+d*γ;

[0026] wherein, rate1 is the CPU expected usage rate;

[0027] b is the first number;

[0028] c is the second number;

[0029] d is the third number;

[0030] α is the first CPU usage rate;

[0031] β is the second CPU usage rate;

[0032] γ is the third CPU usage rate.

[0033] In the implementation process, the formula can increase or decrease the number of alive tunnels in real time on the basis of establishing and tearing down tunnels, so that the CPU usage rate required for tunnel alive processing can be more accurately calculated, thereby improving the calculation accuracy of the CPU expected usage rate.

[0034] Further, the method further comprises:

[0035] If not, the method further comprises:

[0036] In the implementation process, the method can delay the processing process to the next period when determining that the CPU expected usage rate is too high, thereby avoiding large fluctuations in the CPU usage rate in this period.

[0037] The second aspect of the present application provides a tunnel management system, the tunnel management system comprising:

[0038] a detection unit configured to periodically detect a CPU expected usage of a target CPU according to a preset detection period;

[0039] a judgment unit configured to judge whether the CPU expected usage is less than a preset CPU maximum fluctuation value;

[0040] a management unit configured to, when the judgment result of the judgment unit is yes, perform a tunnel establishment processing, a tunnel removal processing and / or a tunnel keep-alive processing by the target CPU.

[0041] Further, a tunnel management system applying the tunnel management method has a CPU usage array corresponding to each CPU created therein, and the tunnel management system further comprises:

[0042] a recording unit configured to record the CPU expected usage into the CPU usage array matched with the target CPU.

[0043] Further, the detection unit is specifically configured to calculate the CPU expected usage of the target CPU according to a first CPU usage, a second CPU usage, a third CPU usage, a first number, a second number and a third number;

[0044] wherein the first CPU usage is a CPU usage consumed by establishing a tunnel, the second CPU usage is a CPU usage consumed by removing a tunnel, the third CPU usage is a CPU usage consumed by keeping alive a tunnel, the first number is a number of tunnels to be established at present, the second number is a number of tunnels to be removed at present, and the third number is a number of tunnels to be kept alive at present.

[0045] Further, the tunnel management system further comprises:

[0046] a calculation unit configured to, before the detection unit periodically detects the CPU expected usage of the target CPU according to the preset detection period, calculate the first CPU usage consumed by establishing a tunnel, the second CPU usage consumed by removing a tunnel and the third CPU usage consumed by keeping alive a tunnel under a CPU empty load condition.

[0047] Further, the calculation unit is specifically configured to test a number of tunnels established per second from the empty load condition of the CPU to the full load condition of the CPU, and calculate the first CPU usage consumed by establishing a tunnel according to the number of tunnels established per second;

[0048] The computing unit is specifically further configured to test the number of tunnels torn down per second when the CPU is from an empty load to a full load; and calculate a second CPU usage rate consumed for tearing down a tunnel according to the number of tunnels torn down per second.

[0049] The computing unit is specifically further configured to test the total number of all keep-alive tunnels when the CPU is from an empty load to a full load; and calculate a third CPU usage rate consumed for keeping alive a tunnel according to the total number of all keep-alive tunnels.

[0050] Further, the calculation formula of the CPU expected usage rate is:

[0051] rate1 = b*α + c*β + b*γ - c*γ + d*γ;

[0052] wherein, rate1 is the CPU expected usage rate;

[0053] b is the first number;

[0054] c is the second number;

[0055] d is the third number;

[0056] α is the first CPU usage rate;

[0057] β is the second CPU usage rate;

[0058] γ is the third CPU usage rate.

[0059] Further, the detecting unit is further configured to periodically detect the CPU expected usage rate of the target CPU according to a preset detection period when the result of the judging unit is no.

[0060] The third aspect of the present application provides an electronic device, comprising a memory and a processor, the memory is used for storing a computer program, and the processor runs the computer program to make the electronic device execute the tunnel management method in any one of the first aspect of the present application.

[0061] The fourth aspect of the present application provides a computer readable storage medium, the readable storage medium stores computer program instructions, and the computer program instructions are read and run by a processor to execute the tunnel management method in any one of the first aspect of the present application.

[0062] The fifth aspect of the present application provides a computer program product, the computer program product comprises a computer program, and the computer program is run by a processor to execute the tunnel management method in any one of the first aspect of the present application. BRIEF DESCRIPTION OF DRAWINGS

[0063] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly introduced as follows. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0064] Figure 1 A flowchart of a tunnel management method provided by the embodiment of the present application is shown in the figure.

[0065] Figure 2 A flowchart of another tunnel management method provided by the embodiment of the present application is shown in the figure.

[0066] Figure 3 A flowchart of a tunnel establishment, removal and keep-alive CPU usage rate quantitative calculation and storage provided by the embodiment of the present application is shown in the figure.

[0067] Figure 4 An example flowchart of a tunnel management method provided by the embodiment of the present application is shown in the figure.

[0068] Figure 5 A structural diagram of a tunnel management system provided by the embodiment of the present application is shown in the figure.

[0069] Figure 6 A structural diagram of another tunnel management system provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0070] The technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings in the embodiments of the present application.

[0071] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used for distinguishing description, and cannot be understood as indicating or implying relative importance.

[0072] Embodiment 1

[0073] Please refer to Figure 1 , Figure 1 A flowchart of a tunnel management method provided by the embodiment is shown in the figure. The tunnel management method includes:

[0074] S101, periodically detecting the CPU expected usage rate of the target CPU according to a preset detection period.

[0075] In this embodiment, the detection period is usually an integer multiple of seconds, and the shorter the interval time, the more accurate.

[0076] Implementing this embodiment can quantitatively calculate the CPU load for establishing, removing and keeping alive of the tunnel between industrial control or Internet of Things devices.

[0077] S102, determine whether the expected CPU usage rate is less than the preset maximum CPU fluctuation value, if yes, execute step S103; if no, end the process.

[0078] In this embodiment, the expected CPU usage rate is represented by rate1, and the maximum CPU fluctuation value can be considered as 80% in general. Based on this, the premise of step S103 in real time is rate1<80%.

[0079] In this embodiment, the method can periodically detect the CPU load, calculate the fluctuation redundancy, and based on the fluctuation redundancy, give the number of tunnels that can be established and removed, and perform the corresponding tunnel establishment and removal; otherwise, delay and re-detect.

[0080] In this embodiment, the CPU fluctuation value can also refer to the change rate of the CPU usage rate. In this case, the method can determine whether the change rate of the CPU usage rate and the expected CPU usage rate at the previous time is less than the preset CPU fluctuation value.

[0081] In this embodiment, the CPU can also perform other work in addition to tunnel management, so that it occupies part of the CPU usage rate. In this case, the expected CPU usage rate should be equal to the sum of the occupied CPU usage rate and the expected CPU usage rate of the tunnel management.

[0082] S103, perform tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing through the target CPU.

[0083] In this embodiment, "and / or" is used because the processing requirements of tunnel establishment, tunnel removal and tunnel keep-alive do not necessarily exist at the same time, so this step needs to manage the tunnel based on the actual situation.

[0084] In this embodiment, the method performs tunnel establishment, removal and keep-alive processing within the allowed load range of the CPU usage rate.

[0085] In this embodiment, the method can further determine whether the tunnel management can be performed through quantity comparison when or after the maximum CPU fluctuation value is determined. Specifically, the method can determine the total number of tunnel management that can be performed in advance, and determine whether the number of tunnels that need to be established, removed and kept alive is less than the total number, if yes, perform the corresponding action; if no, skip and trigger the periodic detection action.

[0086] As an optional implementation, the method further comprises:

[0087] When the CPU expected usage is not less than the preset CPU maximum fluctuation value, the CPU expected usage of other CPUs is detected, and step S102 is performed; wherein the current usage of the other CPUs and the CPU expected usage of the target CPU are detected at the same time.

[0088] Implementing this implementation enables the method to automatically switch work between multiple CPUs, thereby facilitating the tunnel processing not to be delayed and also ensuring the work stability of the system.

[0089] In this embodiment, the execution subject of the method can be a computer, a server or other computing system, and the embodiment is not limited in this regard.

[0090] In this embodiment, the execution subject of the method can also be a smart phone, a tablet computer or other smart device, and the embodiment is not limited in this regard.

[0091] It can be seen that implementing the tunnel management method described in this embodiment can optimize tunnel management, avoid the problem of large fluctuation of system load caused by the establishment and removal of a large number of tunnels at one time, and ensure the stable operation of the system.

[0092] Embodiment 2

[0093] Please refer to Figure 2 , Figure 2 A flowchart of a tunnel management method provided in this embodiment is shown. The tunnel management method comprises:

[0094] S201, in the case of CPU empty load, calculating the first CPU usage consumed for establishing a tunnel, the second CPU usage consumed for removing a tunnel and the third CPU usage consumed for keeping a tunnel alive.

[0095] As an optional implementation, in the case of CPU empty load, calculating the first CPU usage consumed for establishing a tunnel, the second CPU usage consumed for removing a tunnel and the third CPU usage consumed for keeping a tunnel alive comprises:

[0096] Testing the number of tunnels established per second from the case of CPU empty load to the case of CPU full load; and calculating the first CPU usage consumed for establishing a tunnel according to the number of tunnels established per second;

[0097] The test CPU establishes tunnels from an empty load to a full load of the CPU, and the number of tunnels torn down per second; and according to the number of tunnels torn down per second, the second CPU usage rate consumed for tearing down a tunnel is calculated.

[0098] The test CPU establishes tunnels from an empty load to a full load of the CPU, and the total number of all alive tunnels is calculated; and according to the total number of all alive tunnels, the third CPU usage rate consumed for keeping alive a tunnel is calculated.

[0099] For example, the method can establish tunnels from a CPU load of 0 to a CPU load of 100%, and the CPU resources consumed for establishing each tunnel (the first CPU usage rate) at this time is 1 / the number of tunnels established per second, denoted as a.

[0100] The method can also tear down tunnels from a CPU load of 0 to a CPU load of 100%, and the CPU resources consumed for tearing down each tunnel (the second CPU usage rate) at this time is 1 / the number of tunnels torn down per second, denoted as b.

[0101] The method can also increase the number of alive tunnels from a CPU load of 0 to a CPU load of 100%, and the CPU resources consumed for keeping alive each tunnel (the third CPU usage rate) at this time is 1 / the total number of all alive tunnels, denoted as g.

[0102] S202, according to a preset detection period, periodically calculate the CPU expected usage rate of the target CPU according to the first CPU usage rate, the second CPU usage rate, the third CPU usage rate, the first number of currently to-be-established tunnels, the second number of currently to-be-removed tunnels, and the third number of currently to-be-kept-alive tunnels.

[0103] In this embodiment, the first CPU usage rate is the CPU usage rate consumed for establishing a tunnel, the second CPU usage rate is the CPU usage rate consumed for tearing down a tunnel, the third CPU usage rate is the CPU usage rate consumed for keeping alive a tunnel, the first number is the number of currently to-be-established tunnels, the second number is the number of currently to-be-removed tunnels, and the third number is the number of currently to-be-kept-alive tunnels.

[0104] In this embodiment, the calculation formula of the CPU expected usage rate is:

[0105] rate1=b*α+c*β+b*γ-c*γ+d*γ;

[0106] Wherein, rate1 is the CPU expected usage rate;

[0107] b is the first number;

[0108] c is the second number;

[0109] d is a third number;

[0110] a is a first CPU usage rate;

[0111] b is a second CPU usage rate;

[0112] c is a third CPU usage rate.

[0113] For example, the current CPU needs to establish the number of tunnels b, the number of tunnels to be removed c, and the number of tunnels to be kept alive d, and the CPU usage rates corresponding to tunnel establishment, tunnel removal and tunnel keep-alive are obtained, and the CPU usage rate rate1 is calculated according to the following calculation method: rate1 = b* a (CPU resources required for creation) + c* b (CPU resources consumed for removal) + b* g (CPU resources consumed for keep-alive of newly created tunnels) - c* g (CPU resources released by tunnels removed) + d* g (CPU resources consumed by tunnels to be kept alive).

[0114] As an optional implementation, a CPU usage rate array corresponding to each CPU is created in a tunnel management system applying the tunnel management method, and the method further comprises:

[0115] Recording the expected CPU usage rate into the CPU usage rate array matched with the target CPU.

[0116] In this embodiment, when the expected CPU usage rate is not less than the maximum fluctuation value of the CPU, the real-time usage rate of the current CPU can be detected and stored in the corresponding CPU usage rate array.

[0117] In this embodiment, the method can periodically detect the CPU usage rate and record it into the CPU usage rate array, for example, the expected usage rate of CPU0 detected is 60%, and a[0] = 60% is set. The detection period is usually an integer multiple of seconds, and the shorter the interval time is, the more accurate it is.

[0118] Please refer to Figure 3 , Figure 3 a flowchart showing the quantitative calculation and storage of tunnel establishment, removal and keep-alive CPU usage rate. When the method is applied in a multi-CPU scenario, the array can be marked as a[0], a[1], a[2]… based on the id of the CPU (such as 0, 1, 2, etc.).

[0119] S203, determining whether the expected CPU usage rate is less than the preset maximum fluctuation value of the CPU, if yes, executing step S203; if no, executing step S202.

[0120] In this embodiment, the method can perform tunnel establishment, removal and keep-alive processing when the expected CPU usage rate rate1 is less than the maximum CPU fluctuation value (generally considered to be 80%); otherwise, no operation is performed, and the operation of periodically detecting the CPU usage rate is triggered.

[0121] S204, performing tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing by the target CPU.

[0122] Please refer to Figure 4 , Figure 4 An example flowchart of a tunnel management method is shown.

[0123] As an optional implementation, the method further comprises:

[0124] When the expected CPU usage rate is not less than the preset maximum CPU fluctuation value, the first number of tunnel establishment is set to zero, the expected CPU usage rate is recalculated, and the step S203 is executed again.

[0125] Implementing this implementation enables the removal of part of the tunnel when the CPU usage rate meets the expectation, freeing up CPU usage rate for keep-alive tunnel, thereby leaving more resource space for subsequent tunnel processing.

[0126] In this embodiment, the number of established tunnels, removed tunnels and keep-alive tunnels can be freely set, thereby better managing tunnels when the CPU usage rate meets the expectation.

[0127] Implementing this implementation enables the tunnel establishment, removal and keep-alive to not cause a significant fluctuation in the CPU usage rate, thereby avoiding affecting the business.

[0128] In this embodiment, the execution subject of the method can be a computer, a server or other computing system, which is not limited in this embodiment.

[0129] In this embodiment, the execution subject of the method can also be a smart phone, a tablet computer or other smart device, which is not limited in this embodiment.

[0130] As can be seen, implementing the tunnel management method described in this embodiment can optimize tunnel management and avoid the problem of a significant fluctuation in system load caused by the establishment and removal of a large number of tunnels at one time, thereby ensuring stable operation of the system.

[0131] Embodiment 3

[0132] Please refer to Figure 5 , Figure 5 A structure diagram of a tunnel management system provided in this embodiment is shown. As shown in Figure 5 , the tunnel management system comprises:

[0133] The detection unit 310 is configured to periodically detect the expected CPU usage of the target CPU according to a preset detection period.

[0134] The judgment unit 320 is configured to judge whether the expected CPU usage is less than a preset maximum CPU fluctuation value.

[0135] The management unit 330 is configured to perform tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing through the target CPU when the judgment result of the judgment unit 320 is yes.

[0136] In this embodiment, the explanation and description of the tunnel management system can refer to the description in Embodiment 1 or Embodiment 2, and the tunnel management system in this embodiment will not be described again.

[0137] It can be seen that the tunnel management system described in this embodiment can optimize tunnel management, avoid the problem of large fluctuation of system load caused by the establishment and removal of a large number of tunnels at one time, and ensure the stable operation of the system.

[0138] Embodiment 4

[0139] Please refer to Figure 6 , Figure 6 The tunnel management system provided in this embodiment is shown in a structural schematic diagram. As shown in the diagram, Figure 6 The tunnel management system comprises:

[0140] The detection unit 310 is configured to periodically detect the expected CPU usage of the target CPU according to a preset detection period.

[0141] The judgment unit 320 is configured to judge whether the expected CPU usage is less than a preset maximum CPU fluctuation value.

[0142] The management unit 330 is configured to perform tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing through the target CPU when the judgment result of the judgment unit 320 is yes.

[0143] As an optional implementation, a CPU usage array corresponding to each CPU is created in the tunnel management system applying the tunnel management method, and the tunnel management system further comprises:

[0144] The recording unit 340 is configured to record the expected CPU usage into the CPU usage array matched with the target CPU.

[0145] As an optional implementation, the detection unit 310 is specifically configured to calculate the expected CPU usage of the target CPU according to the first CPU usage, the second CPU usage, the third CPU usage, the first number, the second number and the third number.

[0146] wherein the first CPU usage rate is a CPU usage rate consumed by establishing a tunnel, the second CPU usage rate is a CPU usage rate consumed by removing a tunnel, the third CPU usage rate is a CPU usage rate consumed by keeping alive a tunnel, the first number is a number of tunnels to be established at present, the second number is a number of tunnels to be removed at present, and the third number is a number of tunnels to be kept alive at present.

[0147] As an optional implementation, the tunnel management system further comprises:

[0148] The computing unit 350 is configured to, before the detecting unit 310 periodically detects the CPU expected usage rate according to a preset detection period, calculate the first CPU usage rate consumed by establishing a tunnel, the second CPU usage rate consumed by removing a tunnel, and the third CPU usage rate consumed by keeping alive a tunnel in a case that the CPU is in an empty load.

[0149] As an optional implementation, the computing unit 350 is specifically configured to test a number of tunnels established per second from a case that the CPU is in an empty load to a case that the CPU is in a full load, and calculate the first CPU usage rate consumed by establishing a tunnel according to the number of tunnels established per second.

[0150] The computing unit 350 is specifically further configured to test a number of tunnels removed per second from a case that the CPU is in an empty load to a case that the CPU is in a full load, and calculate the second CPU usage rate consumed by removing a tunnel according to the number of tunnels removed per second.

[0151] The computing unit 350 is specifically further configured to test a total number of tunnels kept alive from a case that the CPU is in an empty load to a case that the CPU is in a full load, and calculate the third CPU usage rate consumed by keeping alive a tunnel according to the total number of tunnels kept alive.

[0152] In the embodiment, the calculation formula of the CPU expected usage rate is as follows:

[0153] rate1=b*α+c*β+b*γ-c*γ+d*γ;

[0154] wherein rate1 is the CPU expected usage rate;

[0155] b is the first number;

[0156] c is the second number;

[0157] d is the third number;

[0158] α is the first CPU usage rate;

[0159] β is a second CPU usage rate;

[0160] γ is a third CPU usage rate.

[0161] As an optional implementation, the detection unit 310 is further configured to periodically detect the expected CPU usage rate of the target CPU according to a preset detection period when the determination result of the determination unit 320 is negative.

[0162] In this embodiment, the tunnel management system is explained and described in Embodiment 1 or Embodiment 2, and the description will not be repeated in this embodiment.

[0163] It can be seen that the tunnel management system described in this embodiment can optimize tunnel management, avoid the problem of large fluctuations in system load caused by the establishment and removal of a large number of tunnels at one time, and ensure stable operation of the system.

[0164] The electronic device provided in the embodiment of the present application includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to make the electronic device execute the tunnel management method in Embodiment 1 or Embodiment 2 of the present application.

[0165] The computer readable storage medium provided in the embodiment of the present application stores computer program instructions, and when the computer program instructions are read and run by a processor, the tunnel management method in Embodiment 1 or Embodiment 2 of the present application is executed.

[0166] The computer program product provided in the embodiment of the present application includes a computer program, and when the computer program is run by a processor, the tunnel management method in Embodiment 1 or Embodiment 2 of the present application is executed.

[0167] In several embodiments provided in the present application, it should be understood that the disclosed system and method can also be implemented by other means. The system embodiments described above are only illustrative, for example, the flowcharts and block diagrams in the drawings show the possible implementation architecture, function and operation of the system, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders from that shown in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0168] In addition, the functional modules in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0169] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

[0170] The above merely provides an example of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.

[0171] The above merely provides an example of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.

[0172] It should be noted that the relational terms herein such as first and second and the like are used solely to distinguish one entity or action from another, without necessarily requiring or implying any actual relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

Claims

1. A tunnel management method characterized by comprising: The method comprises: Periodically detecting the CPU expected usage rate of the target CPU according to a preset detection period; Determining whether the CPU expected usage rate is less than a preset CPU maximum fluctuation value; If yes, performing tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing through the target CPU; The detection of the CPU expected usage rate of the target CPU comprises: Calculating the CPU expected usage rate of the target CPU according to a first CPU usage rate, a second CPU usage rate, a third CPU usage rate, a first number, a second number and a third number; The first CPU usage rate is the CPU usage rate consumed by establishing a tunnel, the second CPU usage rate is the CPU usage rate consumed by removing a tunnel, the third CPU usage rate is the CPU usage rate consumed by keeping alive a tunnel, the first number is the number of tunnels to be established at present, the second number is the number of tunnels to be removed at present, and the third number is the number of tunnels to be kept alive at present.

2. The tunnel management method according to claim 1, characterized by, A tunnel management system applying the tunnel management method has a CPU usage rate array corresponding to each CPU, and the method further comprises: Recording the CPU expected usage rate into the CPU usage rate array matched with the target CPU.

3. The tunnel management method according to claim 1, characterized by, Before the periodic detection of the CPU expected usage rate of the target CPU according to a preset detection period, the method further comprises: In the case of CPU empty load, calculating the first CPU usage rate consumed by establishing a tunnel, the second CPU usage rate consumed by removing a tunnel and the third CPU usage rate consumed by keeping alive a tunnel.

4. The tunnel management method according to claim 3, characterized by, In the case of CPU empty load, calculating the first CPU usage rate consumed by establishing a tunnel, the second CPU usage rate consumed by removing a tunnel and the third CPU usage rate consumed by keeping alive a tunnel comprises: Testing the number of tunnels established per second from the case of CPU empty load to the case of CPU full load, and calculating the first CPU usage rate consumed by establishing a tunnel according to the number of tunnels established per second; Testing the number of tunnels removed per second from the case of CPU empty load to the case of CPU full load, and calculating the second CPU usage rate consumed by removing a tunnel according to the number of tunnels removed per second; Testing the total number of tunnels kept alive from the case of CPU empty load to the case of CPU full load, and calculating the third CPU usage rate consumed by keeping alive a tunnel according to the total number of tunnels kept alive.

5. The tunnel management method according to claim 1, wherein The calculation formula of the CPU expected usage rate is: rate1 = b*α + c*β + b*γ - c*γ + d*γ; Wherein, rate1 is the CPU expected usage rate; b is the first number; c is the second number; d is the third number; α is the first CPU usage rate; β is the second CPU usage rate; γ is the third CPU usage rate.

6. The tunnel management method according to claim 1, wherein The method further comprises: If not, the CPU expected usage rate of the target CPU is periodically detected according to a preset detection period.

7. An electronic device, comprising: The electronic device includes a memory for storing a computer program and a processor for running the computer program to make the electronic device execute the tunnel management method of any one of claims 1 to 6.

8. A readable storage medium, characterized by, The readable storage medium stores computer program instructions, and the computer program instructions are read and run by a processor to execute the tunnel management method of any one of claims 1 to 6.

9. A computer program product, characterised in that, The computer program product includes a computer program, and the computer program is run by a processor to execute the tunnel management method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Flow forwarding control method and device based on VXLAN network

    CN106411607A

  • Data communication method and data communication device

    CN108063819A