Tunnel management method
Through the expected usage rate of CPUs and conducting tunnel management, it solves the problem of resource load fluctuations caused by the increase in the number of tunnels in the Internet of Things and industrial control systems, and ensure the stable operation of the system.
Patent Information
- Application Number
- CN202411415521.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-11
AI Technical Summary
In the Internet of Things and industrial control systems, as the number of tunnels surges, the system resource load will fluctuate violently, causing the normal operation of the system to be affected, and may even cause system crashes or performance to decline significantly.
Through the periodic detection target CPU's CPU's expected usage rate, it is determined whether it is less than the preset CPU maximum volatility. If so, the tunnel establishment, demolition and/or tunnel keeping treatment is performed to avoid significant resource load fluctuations.
This method can effectively avoid the significant fluctuation of loads caused by massive tunnel treatment, ensuring the stable operation of the system and the reasonable distribution of resources.
Smart Images

Figure CN119382946A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a tunnel management method, an electronic device, a readable storage medium, and a computer program product. Background Art
[0002] At present, with the increasing popularity of the Internet of Things and industrial control, their application scenarios are becoming more and more extensive, and the importance of Internet of Things security and industrial control security is becoming increasingly prominent. In practical applications, in order to ensure the security and efficiency of data transmission, a large number of network devices in the Internet of Things and industrial control systems widely use tunnel technology for interconnection. Especially on central network devices and key node devices, a large number of tunnels are usually established to communicate and exchange data with other devices. However, when the number of tunnels surges, a large number of tunnel establishment and removal operations in a short period of time will consume a huge amount of CPU computing resources. This resource consumption not only causes drastic fluctuations in system resource load, but may also have a serious impact on the normal operation of the system, and even cause system crashes or significant performance degradation. Summary of the invention
[0003] The purpose of this application is to provide a tunnel management method, electronic device, readable storage medium and computer program product, which can optimize tunnel management, avoid the problem of large fluctuations in system load caused by the system establishing and dismantling massive 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, including:
[0005] According to a preset detection period, the expected CPU usage of the target CPU is periodically detected;
[0006] Determine whether the expected CPU usage is less than a preset CPU maximum fluctuation value;
[0007] If so, the target CPU performs tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing.
[0008] In the above implementation process, the method can periodically detect the CPU usage to ensure that the CPU usage is not too high, thereby ensuring that the CPU can stably establish, dismantle and keep tunnels alive, thereby avoiding the problem of large load fluctuations caused by instantaneous massive tunnel processing.
[0009] Furthermore, a CPU usage array corresponding to each CPU is created in the tunnel management system to which the tunnel management method is applied, and the method further includes:
[0010] The expected CPU usage is recorded in a CPU usage array that matches the target CPU.
[0011] In the above implementation process, the method can record the usage of all CPUs through an array, thereby facilitating subsequent review, analysis and resource allocation processing.
[0012] Further, the detecting the expected CPU usage of the target CPU includes:
[0013] 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 quantity, the second quantity, and the third quantity;
[0014] Among them, the first CPU usage is the CPU usage consumed by establishing a tunnel, the second CPU usage is the CPU usage consumed by dismantling a tunnel, the third CPU usage is the CPU usage consumed by keeping a tunnel alive, the first number is the number of tunnels to be established currently, the second number is the number of tunnels to be dismantled currently, and the third number is the number of tunnels to be kept alive currently.
[0015] In the above implementation process, the method can calculate the expected CPU usage based on the expected situations of tunnel establishment, removal and keep alive, thereby completing the quantification of the expected CPU usage and facilitating the judgment of tunnel management.
[0016] Furthermore, before periodically detecting the expected CPU usage of the target CPU according to a preset detection period, the method further includes:
[0017] In the case of no CPU load, a first CPU usage rate consumed for establishing a tunnel, a second CPU usage rate consumed for removing a tunnel, and a third CPU usage rate consumed for keeping a tunnel alive are calculated.
[0018] In the above implementation process, the method can calculate the single CPU usage rate of tunnel establishment, removal and keep alive in advance and accurately, thereby helping to optimize and achieve more refined CPU usage management.
[0019] Further, in the case of no CPU load, calculating a first CPU usage rate consumed by establishing a tunnel, a second CPU usage rate consumed by removing a tunnel, and a third CPU usage rate consumed by keeping a tunnel alive includes:
[0020] Testing the number of tunnels established per second when the CPU is under no load and continues to establish tunnels until the CPU is under full load; and calculating the first CPU usage rate consumed in establishing a tunnel based on the number of tunnels established per second;
[0021] Test the number of tunnels removed per second when the CPU establishes tunnels from no load to full load; and calculate the second CPU usage rate consumed by removing one tunnel based on the number of tunnels removed per second;
[0022] The total number of tunnels kept alive is tested from when the CPU establishes tunnels all the time from no-load state to when the CPU is fully loaded; and the third CPU usage rate consumed for keeping one tunnel alive is calculated based on the total number of tunnels kept alive.
[0023] In the above implementation process, the method can more accurately determine the real-time CPU usage of establishing and dismantling a single tunnel and the real-time CPU usage occupied when a single tunnel is kept alive, thereby improving the calculation accuracy of the expected CPU usage.
[0024] Furthermore, the calculation formula of the expected CPU usage is:
[0025] rate1=b*α+c*β+b*γ-c*γ+d*γ;
[0026] Wherein, rate1 is the expected CPU usage rate;
[0027] b is the first quantity;
[0028] c is the second number;
[0029] d is the third quantity;
[0030] α is the first CPU usage rate;
[0031] β is the usage rate of the second CPU;
[0032] γ is the third CPU usage rate.
[0033] In the above implementation process, the formula can increase or decrease the number of keep-alive tunnels in real time based on the establishment and removal of tunnels, so that the CPU usage required for tunnel keep-alive processing can be calculated more accurately, thereby improving the calculation accuracy of the expected CPU usage.
[0034] Furthermore, the method further comprises:
[0035] If not, the method of periodically detecting the expected CPU usage of the target CPU according to the preset detection period is performed.
[0036] In the above implementation process, when the method determines that the expected CPU usage is too high, the processing process can be postponed to the next cycle, thereby avoiding large fluctuations in the CPU usage during this cycle.
[0037] A second aspect of the present application provides a tunnel management system, the tunnel management system comprising:
[0038] A detection unit, used for periodically detecting the expected CPU usage of the target CPU according to a preset detection period;
[0039] A judging unit, used to judge whether the expected CPU usage is less than a preset CPU maximum fluctuation value;
[0040] The management unit is used 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 is yes.
[0041] Furthermore, a CPU usage array corresponding to each CPU is created in a tunnel management system to which the tunnel management method is applied, and the tunnel management system further includes:
[0042] The recording unit is used to record the expected CPU usage into a CPU usage array that matches the target CPU.
[0043] Further, the detection unit is specifically used 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 quantity, the second quantity and the third quantity;
[0044] Among them, the first CPU usage is the CPU usage consumed by establishing a tunnel, the second CPU usage is the CPU usage consumed by dismantling a tunnel, the third CPU usage is the CPU usage consumed by keeping a tunnel alive, the first number is the number of tunnels to be established currently, the second number is the number of tunnels to be dismantled currently, and the third number is the number of tunnels to be kept alive currently.
[0045] Furthermore, the tunnel management system further includes:
[0046] The calculation unit is used to calculate the first CPU usage consumed by establishing a tunnel, the second CPU usage consumed by dismantling a tunnel, and the third CPU usage consumed by keeping a tunnel alive under CPU no-load conditions before the detection unit periodically detects the expected CPU usage of the target CPU according to a preset detection cycle.
[0047] Furthermore, the calculation unit is specifically used to test the number of tunnels established per second when the CPU establishes tunnels from no load to full load; and calculate the first CPU usage rate consumed in establishing a tunnel based on the number of tunnels established per second;
[0048] The calculation unit is further used to test the number of tunnels removed per second when the CPU establishes tunnels from no load to full load; and calculate the second CPU usage rate consumed by removing a tunnel according to the number of tunnels removed per second;
[0049] The calculation unit is specifically used to test the total number of tunnels kept alive when the CPU establishes tunnels from no load to full load; and calculate the third CPU usage rate consumed by keeping one tunnel alive based on the total number of tunnels kept alive.
[0050] Furthermore, the calculation formula of the expected CPU usage is:
[0051] rate1=b*α+c*β+b*γ-c*γ+d*γ;
[0052] Wherein, rate1 is the expected CPU usage rate;
[0053] b is the first quantity;
[0054] c is the second number;
[0055] d is the third quantity;
[0056] α is the first CPU usage rate;
[0057] β is the usage rate of the second CPU;
[0058] γ is the third CPU usage rate.
[0059] Furthermore, the detection unit is further configured to periodically detect the expected CPU usage of the target CPU according to a preset detection cycle when the judgment result of the judgment unit is no.
[0060] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the tunnel management method described in any one of the first aspects of the present application.
[0061] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions. When the computer program instructions are read and executed by a processor, the tunnel management method described in any one of the first aspects of the present application is executed.
[0062] A fifth aspect of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the tunnel management method described in any one of the first aspects of the present application is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0064] Figure 1 A schematic diagram of a flow chart of a tunnel management method provided in an embodiment of the present application;
[0065] Figure 2 A flowchart of another tunnel management method provided in an embodiment of the present application;
[0066] Figure 3 A schematic diagram of a process for quantitative calculation and storage of CPU usage for tunnel establishment, removal and keep-alive provided in an embodiment of the present application;
[0067] Figure 4 A schematic diagram of an example flow of a tunnel management method provided in an embodiment of the present application;
[0068] Figure 5 A schematic diagram of the structure of a tunnel management system provided in an embodiment of the present application;
[0069] Figure 6 A schematic diagram of the structure of another tunnel management system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The technical solutions in the embodiments of the present application will be described below in conjunction with 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, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0072] Example 1
[0073] Please see Figure 1 , Figure 1 A schematic diagram of a tunnel management method provided in this embodiment. The tunnel management method includes:
[0074] S101. Periodically detect an expected CPU usage rate of a 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, the more accurate it is.
[0076] By implementing this implementation method, it is possible to perform quantitative CPU load calculation on the establishment, removal and keep alive of tunnels between industrial control or IoT devices.
[0077] S102, determining whether the expected CPU usage is less than a preset CPU maximum fluctuation value, if so, executing step S103; if not, terminating the process.
[0078] In this embodiment, the expected CPU usage rate is represented by rate1, and the maximum CPU fluctuation value can usually be considered to be designated as 80%. Based on this, the premise of step S103 is that rate1 < 80%.
[0079] In this embodiment, the method can periodically detect the CPU load, calculate the fluctuation redundancy, and based on the fluctuation redundancy, provide the number of tunnels that can be established and removed, and perform corresponding tunnel establishment and removal; otherwise, re-detection is postponed.
[0080] In this embodiment, the CPU fluctuation value may also refer to the change rate of the CPU usage rate. In this case, the method may determine whether the change rate of the CPU usage rate at the last moment and the CPU expected usage rate is less than the preset CPU fluctuation value.
[0081] In this embodiment, the CPU can also perform other tasks besides tunnel management, so that it occupies part of the CPU usage. In this case, the expected CPU usage should be equal to the sum of the occupied CPU usage and the expected CPU usage of 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 may 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 allowable load range of CPU usage.
[0085] In this embodiment, the method can further determine whether tunnel management can be performed by comparing the number when or after determining the maximum fluctuation value of the CPU. Specifically, the method can predetermine the total number of tunnels that can be managed, and determine whether the number of tunnels that currently need to be established, removed, and kept alive is less than the total number. If so, perform the corresponding action; if not, skip and trigger the periodic detection action.
[0086] As an optional implementation, the method further includes:
[0087] When the expected CPU usage is not less than the preset maximum CPU fluctuation value, the expected CPU usage of other CPUs is detected, and step S102 is executed; wherein the current usage of other CPUs and the expected CPU usage of the target CPU are detected at the same time.
[0088] By implementing this implementation mode, the method can automatically switch operations between multiple CPUs, thereby eliminating the need to delay tunnel processing and ensuring the operating stability of the system.
[0089] In this embodiment, the execution subject of the method may be a computing system such as a computer or a server, and no limitation is made in this embodiment.
[0090] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.
[0091] It can be seen that the implementation of the tunnel management method described in this embodiment can optimize tunnel management, avoid the problem of large fluctuations in system load caused by the system establishing and dismantling a large number of tunnels at one time, and ensure the stable operation of the system.
[0092] Example 2
[0093] Please see Figure 2 , Figure 2 A schematic diagram of a tunnel management method provided in this embodiment. The tunnel management method includes:
[0094] S201. Under a CPU no-load condition, calculate a first CPU usage rate consumed by establishing a tunnel, a second CPU usage rate consumed by dismantling a tunnel, and a third CPU usage rate consumed by keeping a tunnel alive.
[0095] As an optional implementation manner, under the CPU no-load condition, calculating a first CPU usage rate consumed by establishing a tunnel, a second CPU usage rate consumed by removing a tunnel, and a third CPU usage rate consumed by keeping a tunnel alive includes:
[0096] Test the number of tunnels established per second when the CPU is under no load and continues to establish tunnels until the CPU is under full load; and calculate the first CPU usage rate consumed by establishing a tunnel based on the number of tunnels established per second;
[0097] Test the number of tunnels removed per second when the CPU is under no load and continues to establish tunnels until the CPU is under full load; and calculate the second CPU usage rate consumed by removing a tunnel based on the number of tunnels removed per second;
[0098] The total number of tunnels kept alive is tested from the time when the CPU establishes tunnels under no load to the time when the CPU is fully loaded; and the third CPU usage rate consumed in keeping one tunnel alive is calculated based on the total number of tunnels kept alive.
[0099] For example, the method can establish tunnels when the CPU load is 0 until the CPU load reaches 100%. At this time, the CPU resources consumed by establishing each tunnel (first CPU usage rate) is: 1 / the number of tunnels established per second, recorded as α.
[0100] This method can also remove tunnels when the CPU load is 0 until the CPU load reaches 100%. At this time, the CPU resources consumed by removing each tunnel (the second CPU usage rate) is: 1 / the number of tunnels removed per second, recorded as β.
[0101] This method can also increase the number of keep-alive tunnels when the CPU load is 0 until the CPU load is 100%. At this time, the CPU resource consumed by keeping each tunnel alive (the third CPU usage rate) is: 1 / the total number of all keep-alive tunnels, recorded as γ.
[0102] S202. According to a preset detection cycle, periodically calculate the expected CPU usage of the target CPU based on the first CPU usage, the second CPU usage, the third CPU usage, the first number of tunnels to be established, the second number of tunnels to be removed, and the third number of tunnels to be kept alive.
[0103] In this embodiment, the first CPU usage is the CPU usage consumed to establish a tunnel, the second CPU usage is the CPU usage consumed to dismantle a tunnel, the third CPU usage is the CPU usage consumed to keep a tunnel alive, the first number is the number of tunnels currently to be established, the second number is the number of tunnels currently to be dismantled, and the third number is the number of tunnels currently to be kept alive.
[0104] In this embodiment, the calculation formula of the expected CPU usage is:
[0105] rate1=b*α+c*β+b*γ-c*γ+d*γ;
[0106] Among them, rate1 is the expected CPU usage rate;
[0107] b is the first quantity;
[0108] c is the second quantity;
[0109] d is the third quantity;
[0110] α is the first CPU usage;
[0111] β is the second CPU usage;
[0112] γ is the third CPU usage.
[0113] For example, obtain the number b of tunnels that the current CPU needs to establish, the number c of tunnels that need to be dismantled, and the number d of tunnels that need to be kept alive, as well as the CPU usage corresponding to tunnel establishment, tunnel dismantling, and tunnel keeping alive, and calculate according to the following method: CPU usage rate1 = b*α (CPU resources required for creation) + c*β (CPU resources consumed by dismantling) + b*γ (CPU resources consumed by keeping the newly created tunnel alive) - c*γ (CPU resources released by the dismantled tunnel) + d*γ (CPU resources consumed by the tunnel that needs to be kept alive).
[0114] As an optional implementation manner, a CPU usage array corresponding to each CPU is created in a tunnel management system applying the tunnel management method, and the method further includes:
[0115] Record the expected CPU usage into the CPU usage array that matches the target CPU.
[0116] In this embodiment, when the expected CPU usage is not less than the maximum CPU fluctuation value, the real-time usage of the current CPU can be detected and stored in the corresponding CPU usage array.
[0117] In this embodiment, the method can periodically detect the usage of each CPU and record it in the CPU usage array. For example, if the expected usage of CPU0 detected is 60%, a[0] is set to 60%. The above detection period is usually an integer multiple of seconds, and the shorter the interval, the more accurate it is.
[0118] Please see Figure 3 , Figure 3 A schematic diagram of the process of quantitative calculation and storage of CPU usage for tunnel establishment, removal and keep alive is shown. 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 CPU ID (such as 0, 1, 2, etc.)
[0119] S203, determining whether the expected CPU usage is less than a preset CPU maximum fluctuation value, if so, executing step S203; if not, executing step S202.
[0120] In this embodiment, the method can perform tunnel establishment, removal and keep-alive processing when the expected CPU usage rate1 is less than the maximum CPU fluctuation value (usually considered to be specified as 80%); otherwise, no operation is performed and the operation of periodically detecting the CPU usage is triggered.
[0121] S204: Perform tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing through the target CPU.
[0122] Please refer to Figure 4 , Figure 4 An example flow chart of a tunnel management method is shown.
[0123] As an optional implementation, the method further includes:
[0124] When the expected CPU usage is not less than the preset maximum CPU fluctuation value, the first number of tunnels established is set to zero, and the expected CPU usage is recalculated, and step S203 is executed again.
[0125] By implementing this implementation mode, some tunnels can be removed when the CPU usage rate meets expectations, freeing up the CPU usage rate used to keep the tunnels alive, 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, so that the tunnels can be better managed when the CPU usage rate meets expectations.
[0127] By implementing this implementation method, tunnel establishment, removal and keep alive will not cause significant fluctuations in CPU usage, thereby avoiding impact on services.
[0128] In this embodiment, the execution subject of the method may be a computing system such as a computer or a server, and no limitation is made in this embodiment.
[0129] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.
[0130] It can be seen that the implementation of the tunnel management method described in this embodiment can optimize tunnel management, avoid the problem of large fluctuations in system load caused by the system establishing and dismantling a large number of tunnels at one time, and ensure the stable operation of the system.
[0131] Example 3
[0132] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a tunnel management system provided in this embodiment. Figure 5 As shown, the tunnel management system includes:
[0133] The detection unit 310 is used to periodically detect the expected CPU usage of the target CPU according to a preset detection period;
[0134] The judging unit 320 is used to judge whether the expected CPU usage is less than a preset CPU maximum fluctuation value;
[0135] The management unit 330 is used 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 of the tunnel management system can refer to the description in Example 1 or Example 2, and will not be further elaborated in this embodiment.
[0137] It can be seen that the implementation of the tunnel management system described in this embodiment can optimize tunnel management, avoid the problem of large fluctuations in system load caused by the system establishing and dismantling a large number of tunnels at one time, and ensure the stable operation of the system.
[0138] Example 4
[0139] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a tunnel management system provided in this embodiment. Figure 6 As shown, the tunnel management system includes:
[0140] The detection unit 310 is used to periodically detect the expected CPU usage of the target CPU according to a preset detection period;
[0141] The judging unit 320 is used to judge whether the expected CPU usage is less than a preset CPU maximum fluctuation value;
[0142] The management unit 330 is used 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 manner, a CPU usage array corresponding to each CPU is created in a tunnel management system that applies the tunnel management method, and the tunnel management system further includes:
[0144] The recording unit 340 is used to record the expected CPU usage into a CPU usage array that matches 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 quantity, the second quantity, and the third quantity;
[0146] Among them, the first CPU usage is the CPU usage consumed by establishing a tunnel, the second CPU usage is the CPU usage consumed by dismantling a tunnel, and the third CPU usage is the CPU usage consumed by keeping a tunnel alive. The first number is the number of tunnels to be established, the second number is the number of tunnels to be dismantled, and the third number is the number of tunnels to be kept alive.
[0147] As an optional implementation manner, the tunnel management system further includes:
[0148] The calculation unit 350 is used to calculate the first CPU usage consumed by establishing a tunnel, the second CPU usage consumed by dismantling a tunnel, and the third CPU usage consumed by keeping a tunnel alive under CPU no-load conditions before the detection unit 310 periodically detects the expected CPU usage of the target CPU according to a preset detection cycle.
[0149] As an optional implementation, the calculation unit 350 is specifically used to test the number of tunnels established per second when the CPU establishes tunnels from an empty load state to a full load state; and calculate the first CPU usage rate consumed in establishing a tunnel according to the number of tunnels established per second;
[0150] The calculation unit 350 is further used to test the number of tunnels removed per second when the CPU establishes tunnels from no load to 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 calculation unit 350 is further specifically used to test the total number of tunnels kept alive when the CPU establishes tunnels from no load to full load; and calculate the third CPU usage rate consumed by keeping one tunnel alive based on the total number of tunnels kept alive.
[0152] In this embodiment, the calculation formula of the expected CPU usage is:
[0153] rate1=b*α+c*β+b*γ-c*γ+d*γ;
[0154] Among them, rate1 is the expected CPU usage rate;
[0155] b is the first quantity;
[0156] c is the second quantity;
[0157] d is the third quantity;
[0158] α is the first CPU usage;
[0159] β is the second CPU usage;
[0160] γ is the third CPU usage.
[0161] As an optional implementation, the detection unit 310 is further configured to periodically detect the expected CPU usage of the target CPU according to a preset detection cycle when the judgment result of the judgment unit 320 is no.
[0162] In this embodiment, the explanation of the tunnel management system can refer to the description in Example 1 or Example 2, and will not be further elaborated in this embodiment.
[0163] It can be seen that the implementation of the tunnel management system described in this embodiment can optimize tunnel management, avoid the problem of large fluctuations in system load caused by the system establishing and dismantling a large number of tunnels at one time, and ensure the stable operation of the system.
[0164] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the tunnel management method in embodiment 1 or embodiment 2 of the present application.
[0165] An embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the tunnel management method in Embodiment 1 or Embodiment 2 of the present application is executed.
[0166] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed 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 in other ways. The system embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0168] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may 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 solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0170] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0171] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0172] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A tunnel management method, characterized in that: The method comprises: According to a preset detection period, the expected CPU usage of the target CPU is periodically detected; Determine whether the expected CPU usage is less than a preset CPU maximum fluctuation value; If so, the target CPU performs tunnel establishment processing, tunnel removal processing and / or tunnel keep-alive processing.
2. The tunnel management method according to claim 1, characterized in that: A CPU usage array corresponding to each CPU is created in the tunnel management system to which the tunnel management method is applied. The method further includes: The expected CPU usage is recorded in a CPU usage array that matches the target CPU.
3. The tunnel management method according to claim 1, characterized in that: The detecting of the expected CPU usage of the target CPU includes: 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 quantity, the second quantity, and the third quantity; Among them, the first CPU usage is the CPU usage consumed by establishing a tunnel, the second CPU usage is the CPU usage consumed by dismantling a tunnel, the third CPU usage is the CPU usage consumed by keeping a tunnel alive, the first number is the number of tunnels to be established currently, the second number is the number of tunnels to be dismantled currently, and the third number is the number of tunnels to be kept alive currently.
4. The tunnel management method according to claim 3, characterized in that: Before periodically detecting the expected CPU usage of the target CPU according to the preset detection cycle, the method further includes: In the case of no CPU load, a first CPU usage rate consumed for establishing a tunnel, a second CPU usage rate consumed for removing a tunnel, and a third CPU usage rate consumed for keeping a tunnel alive are calculated.
5. The tunnel management method according to claim 4, characterized in that: In the case of no CPU load, the first CPU usage rate consumed by establishing a tunnel, the second CPU usage rate consumed by tearing down a tunnel, and the third CPU usage rate consumed by keeping a tunnel active are calculated, including: Testing the number of tunnels established per second when the CPU is under no load and continues to establish tunnels until the CPU is under full load; and calculating the first CPU usage rate consumed in establishing a tunnel based on the number of tunnels established per second; Test the number of tunnels removed per second when the CPU establishes tunnels from no load to full load; and calculate the second CPU usage rate consumed by removing one tunnel based on the number of tunnels removed per second; The total number of tunnels kept alive is tested from when the CPU establishes tunnels all the time from no-load state to when the CPU is fully loaded; and the third CPU usage rate consumed for keeping one tunnel alive is calculated based on the total number of tunnels kept alive.
6. The tunnel management method according to claim 3, characterized in that: The calculation formula of the expected CPU usage is: rate1=b*α+c*β+b*γ-c*γ+d*γ; Wherein, rate1 is the expected CPU usage rate; b is the first quantity; c is the second number; d is the third quantity; α is the first CPU usage rate; β is the usage rate of the second CPU; γ is the third CPU usage rate.
7. The tunnel management method according to claim 1, characterized in that: The method further comprises: If not, the method of periodically detecting the expected CPU usage of the target CPU according to the preset detection period is performed.
8. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the tunnel management method according to any one of claims 1 to 7.
9. A readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the tunnel management method according to any one of claims 1 to 7 is executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the tunnel management method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Flow forwarding control method and device based on VXLAN network
CN106411607A
Data communication method and data communication device
CN108063819A
Controller cluster node management method and device
CN113535517A
End-to-end traffic encryption method and device, electronic equipment and storage medium
CN118713889A
Mechanism for efficiently transmitting tunnel keep-alive messages
US20140056203A1