Connection tracking management method, device and equipment and computer readable storage medium
By implementing the connection tracking management method on the Openstack platform, the connection tracking restrictions are dynamically adjusted according to the specific situation of the host and the business needs of the virtual machine, the problem of not being able to reasonably set connection tracking restrictions when creating a virtual machine is solved, and the maximum utilization of resources and the stable operation of the host system is achieved.
Patent Information
- Application Number
- CN202411864253.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-07
AI Technical Summary
When configuring a virtual machine, the Openstack platform cannot reasonably set connection tracking restrictions based on the specific situation of the host and the business needs of the virtual machine, which may affect the stable operation of the host and waste of resources.
It provides a connection tracking management method, which determines the target network to which the virtual machine to be created by receiving a virtual machine creation request, and determines whether to execute a virtual machine creation request based on the current host's port limit, the number of existing ports, the total number of connection tracking restrictions, etc., to achieve reasonable connection tracking management.
It realizes more reasonable and effective management of connection tracking within the host system, maximizes the utilization of host resources, and ensures the stable operation of the host system.
Smart Images

Figure CN119576482A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of virtual machine technology, and in particular to a connection tracking management method, and also to a connection tracking management device, an electronic device, and a computer-readable storage medium. Background Art
[0002] The virtual machines of Openstack (open source cloud computing platform management platform project) use openvswitch (virtual machine switch management software) to forward traffic. It will record connection tracking according to demand and traffic information and save it to the main network namespace of the host machine for configuring security group rules. Generally, the main network namespace of the host machine will limit the total number of connection tracking to control resource consumption. However, for the Openstack platform, it can only uniformly limit the limit value during deployment, and cannot make reasonable settings based on the specific situation of the host machine, the business needs of the virtual machine, etc. In actual application scenarios, it may not only affect the stable operation of the host machine, but also cause unnecessary waste of host machine resources.
[0003] Therefore, how to effectively manage the connection tracking within the host system to maximize the utilization of host resources while ensuring the stable operation of the host system is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0004] The purpose of the present application is to provide a connection tracking management method, which can manage the connection tracking within the host system more reasonably and effectively, maximize the utilization of host resources, and ensure the stable operation of the host system; another purpose of the present application is to provide a connection tracking management device, electronic device, computer-readable storage medium and computer program product, all of which have the above-mentioned beneficial effects.
[0005] In a first aspect, the present application provides a connection tracking management method, comprising:
[0006] Receive a virtual machine creation request, and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request;
[0007] Determine the port limit number of the current host machine for the target network, and determine the number of existing ports of the target network in the current host machine;
[0008] When the existing number of ports is lower than the port limit, determining the total number of connection tracking limits of the current host machine and the total number of existing port connection tracking, and the single-port connection tracking number of the target network;
[0009] When the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the connection tracking limit total number, the virtual machine creation request is executed.
[0010] Optionally, when the number of existing ports is lower than the port limit, determining the total number of existing port connection tracking of the current host includes:
[0011] When the number of existing ports is lower than the port limit, determining existing networks in the current host machine, and determining existing ports of each of the existing networks in the current host machine;
[0012] The sum of the connection tracking numbers of all the existing ports is taken as the total number of connection tracking numbers of the existing ports of the current host machine.
[0013] Optionally, when the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the connection tracking limit total number, executing the virtual machine creation request includes:
[0014] When the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed a preset ratio of the total number of connection tracking limits, executing the virtual machine creation request;
[0015] When the sum of the total number of existing port connection tracking and the single-port connection tracking number exceeds a preset ratio of the total number of connection tracking limits, the virtual machine creation request is executed and a preset prompt is output.
[0016] Optionally, the connection tracking management method further includes:
[0017] When receiving a port adding request, determining a network to which the newly added port belongs according to the port adding request;
[0018] In the host set, a recommended host set is obtained by filtering according to the network to which the newly added port belongs;
[0019] A target host is selected from the set of recommendable hosts, and the newly added port is constructed on the target host.
[0020] Optionally, in the host set, a recommended host set is obtained by filtering according to the network to which the newly added port belongs, including:
[0021] Selecting a host machine that supports the network to which the newly added port belongs from the host machine set to obtain a first host machine set;
[0022] Selecting, from the first host machine set, a host machine whose existing number of ports of the network to which the newly added port belongs does not reach the port limit number of the network to which the newly added port belongs, to obtain a second host machine set;
[0023] In the second host set, select a host whose sum of the total number of connection tracking of existing ports and the number of connection tracking of a single port of the network to which the newly added port belongs does not exceed the total number of connection tracking limits, to obtain a third host set;
[0024] For each host in the third host set, calculating the remaining number of connection tracking of the host for the network to which the newly added port belongs according to the connection tracking limit number and the existing connection tracking number of the host for the network to which the newly added port belongs;
[0025] Sorting all hosts in the third host set in descending order according to the connection tracking remaining numbers to obtain the recommendable host set;
[0026] Accordingly, selecting a target host from the set of recommendable hosts and constructing the newly added port on the target host includes:
[0027] The first host machine in the recommendable host machine set is used as the target host machine, and the newly added port is constructed on the target host machine.
[0028] Optionally, the connection tracking management method further includes:
[0029] When receiving a single-port connection tracking number update request for the target network, determining an updated single-port connection tracking number according to the single-port connection tracking number update request;
[0030] If the updated single-port connection tracking number is greater than the single-port connection tracking number, the total number of connection tracking limits of the target network is calculated according to the port limit number of the target network and the updated single-port connection tracking number;
[0031] When the total number of connection tracking limits of the target network does not exceed the total number of connection tracking limits of the current host machine, the updated single-port connection tracking number replaces the single-port connection tracking number.
[0032] Optionally, the connection tracking management method further includes:
[0033] When receiving a port limit number update request for the target network, determining an updated port limit number according to the port limit number update request;
[0034] If the updated port limit number is lower than the port limit number, determining the total number of port limits of the current host machine;
[0035] When the total number of port restrictions of the current host machine is not less than the original number of ports of the current host machine, the updated number of port restrictions replaces the number of port restrictions.
[0036] In a second aspect, the present application further discloses a connection tracking management device, including:
[0037] A first determination module is used to receive a virtual machine creation request and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request;
[0038] A second determination module is used to determine the port limit number of the current host machine for the target network, and determine the number of existing ports of the target network in the current host machine;
[0039] A third determination module is used to determine the total number of connection tracking limits of the current host machine and the total number of existing port connection tracking, and the single-port connection tracking number of the target network when the existing number of ports is lower than the port limit number;
[0040] The execution module is used to execute the virtual machine creation request when the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the connection tracking limit total number.
[0041] In a third aspect, the present application further discloses an electronic device, comprising:
[0042] Memory for storing computer programs;
[0043] A processor is used to implement the steps of any one of the connection tracking management methods described above when executing the computer program.
[0044] In a fourth aspect, the present application further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the connection tracking management methods described above are implemented.
[0045] In a fifth aspect, the present invention further discloses a computer program product, including a computer program / instruction, which implements the steps of any one of the connection tracking management methods described above when executed by a processor.
[0046] The present application provides a connection tracking management method, including: receiving a virtual machine creation request, determining a target network to which the virtual machine to be created belongs according to the virtual machine creation request; determining the port limit number of the current host machine for the target network, and determining the number of existing ports of the target network in the current host machine; when the number of existing ports is lower than the port limit number, determining the total number of connection tracking limits of the current host machine and the total number of existing port connection tracking, and the number of single-port connection tracking of the target network; when the sum of the total number of existing port connection tracking and the single-port connection tracking does not exceed the total number of connection tracking limits, executing the virtual machine creation request.
[0047] By applying the technical solution provided by this application, for any host machine, the supported network types, the number of port connections supported by each network type, and the number of connection tracking supported by each network type port are pre-defined. Therefore, when it is necessary to create a virtual machine on the host machine, this information can be referred to, and combined with the network type to which the virtual machine to be created belongs, it can be determined whether the current host machine is suitable for creating a virtual machine. It can be seen that this technical solution realizes more reasonable and effective management of connection tracking within the host system, further realizes the maximum utilization of host resources, and can effectively ensure the stable operation of the host machine.
[0048] In one embodiment of the present application, when it is necessary to add a network port in the current host cluster, the host cluster that is most suitable for creating the network port can be screened in the current host cluster according to the network type to which the network port belongs, that is, a host set can be recommended, and thus, a target host to which a network port can be added can be selected from the recommended host set to achieve network port access. It can be seen that this implementation method helps to screen the host that is most suitable for creating a port of a specified network type, so as to further ensure the stable operation of the host cluster system.
[0049] The connection tracking management device, electronic device, computer-readable storage medium and computer program product provided in this application also have the above-mentioned technical effects, and this application will not repeat them here. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.
[0051] Figure 1A flow chart of a connection tracking management method provided by this application;
[0052] Figure 2 A schematic diagram of a connection tracking restriction within a host provided by this application;
[0053] Figure 3 A schematic diagram of a process flow of a host screening method provided in this application;
[0054] Figure 4 A schematic diagram of the structure of a connection tracking management device provided by this application;
[0055] Figure 5 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0056] The core of the present application is to provide a connection tracking management method, which can manage the connection tracking within the host system more reasonably and effectively, maximize the utilization of host resources, and ensure the stable operation of the host system; another core of the present application is to provide a connection tracking management device, electronic device, computer-readable storage medium and computer program product, all of which have the above-mentioned beneficial effects.
[0057] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0058] An embodiment of the present application provides a connection tracking management method.
[0059] Please refer to Figure 1 , Figure 1 This is a flow chart of a connection tracking management method provided in the present application. The connection tracking management method may include the following S101 to S104.
[0060] S101: Receive a virtual machine creation request, and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request.
[0061] This step is intended to determine the network type to which the virtual machine to be created belongs. For any host machine, the network types it can support, the number of ports that each network type can support, and the number of connection tracking that each network type port can support can be pre-set. Thus, when a virtual machine creation request is received, the network type to which the virtual machine to be created belongs, i.e., the target network mentioned above, can be determined first, so as to determine whether the current host machine supports the target network. If the target network is supported, S102 can be continued to be executed, otherwise the virtual machine creation request can be directly rejected.
[0062] S102: Determine the port limit number of the current host machine for the target network, and determine the existing port number of the target network in the current host machine.
[0063] This step aims to determine the port creation status in the current host. On the one hand, determine the port limit number of the current host for the target network, that is, the number of ports that the current host can support for the target network; on the other hand, determine the number of existing ports of the target network in the current host, that is, the number of ports of the target network type that already exist in the current host. Thus, it is possible to determine whether the current host can continue to create new ports for the virtual machine to be created by comparing the number of ports. Obviously, if the number of existing ports of the current host for the target network is lower than the port limit number, S103 can be continued to be executed, otherwise the virtual machine creation request can be directly rejected.
[0064] S103: When the number of existing ports is lower than the port limit, determine the total number of connection tracking limits of the current host machine, the total number of existing port connection tracking, and the single-port connection tracking number of the target network.
[0065] This step aims to determine the connection tracking creation status in the current host. On the one hand, determine the total number of connection tracking limits and the total number of existing port connection tracking of the current host. The former refers to the maximum number of connection tracking that the current host can support (regardless of network type), and the latter refers to the number of connection tracking of network ports that have been created in the current host (regardless of network type). On the other hand, determine the number of single-port connection tracking of the target network, that is, the number of connection tracking that the current host can support for any port under the target network. Therefore, the number of connection tracking can be compared to determine whether the current host can continue to create new ports for the virtual machine to be created.
[0066] Among them, regarding the setting of the total number of connection tracking limits for the host, one possible implementation method is:
[0067] The total number of connection tracking limits = host memory size × number of connection tracking per unit memory + number of reserved connection tracking.
[0068] For example, if the memory size of a host is 500G, the number of connection tracking per unit memory is less than 10,000, and the number of reserved tracking is 1 million, then the total number of connection tracking limits for the host = 500 × 10,000 + 1 million = 6 million.
[0069] In one embodiment of the present application, when the number of existing ports is lower than the port limit, determining the total number of existing port connection tracking of the current host may include:
[0070] When the number of existing ports is lower than the port limit, determining existing networks in the current host machine, and determining existing ports of each existing network in the current host machine;
[0071] The sum of the connection tracking numbers of all existing ports is taken as the total number of connection tracking numbers of existing ports on the current host.
[0072] The embodiment of the present application provides an implementation method for determining the total number of existing port connection tracking in the current host. As described above, the total number of existing port connection tracking of the current host refers to the number of connection tracking of the network ports that have been created in the current host (regardless of the network type). Therefore, the type of network that has been established in the current host, that is, the existing network, can be determined first, and the ports that have been created in the current host for each existing network, that is, the existing ports, can be determined; on this basis, since the host limits the number of connection tracking for each network type port, the sum of the number of connection tracking for all existing ports in the current host is the total number of existing port connection tracking of the current host.
[0073] S104: When the sum of the total number of existing port connection tracking and the single-port connection tracking does not exceed the total number of connection tracking limits, execute the virtual machine creation request.
[0074] This step is intended to determine whether to execute the virtual machine creation request by comparing the number of connection tracking. It can be understood that if the sum of the total number of existing port connection tracking of the current host machine and the number of single-port connection tracking of the target network does not exceed the total number of connection tracking limits of the current host machine, the virtual machine creation request can be executed and the virtual machine can be created on the current host machine; otherwise, the virtual machine creation request can be directly rejected.
[0075] In one embodiment of the present application, when the sum of the total number of existing port connection tracking and the number of single-port connection tracking does not exceed the total number of connection tracking limits, executing the virtual machine creation request may include:
[0076] When the sum of the total number of existing port connection tracking and the number of single-port connection tracking does not exceed a preset ratio of the total number of connection tracking limits, executing the virtual machine creation request;
[0077] When the sum of the total number of existing port connection tracking and the number of single-port connection tracking exceeds a preset ratio of the total number of connection tracking limits, a virtual machine creation request is executed and a preset prompt is output.
[0078] It is understandable that in any host machine, if the total number of connection tracking actually created is close to the total number of connection tracking limits, although it will not affect the normal operation of the host machine, it will still affect the stability of the host machine because the host machine is in a high-load state at this time. Therefore, a preset ratio (such as one-third) of the total number of connection tracking limits in the host machine can be set as the upper limit threshold of the total number of connection tracking that can actually be created. If this preset ratio is exceeded, a corresponding high-load prompt can be output, that is, the above-mentioned preset prompt, which can be used to remind technicians to focus on this host machine to avoid abnormal situations. Of course, the value of the above-mentioned preset ratio does not affect the implementation of the present technical solution, and can be set by technicians according to the actual performance of the host machine, and this application does not limit this.
[0079] It can be seen that the connection tracking management method provided in the embodiment of the present application predefines the network types that can be supported, the number of port connections that each network type can support, and the number of connection tracking that each network type port can support for any host machine. Therefore, when it is necessary to create a virtual machine on the host machine, this information can be referred to, and combined with the network type to which the virtual machine to be created belongs, it can be determined whether the current host machine is suitable for creating a virtual machine. It can be seen that the technical solution realizes more reasonable and effective management of connection tracking within the host system, further realizes the maximum utilization of host resources, and can effectively ensure the stable operation of the host machine.
[0080] Based on the above embodiments:
[0081] In one embodiment of the present application, the connection tracking management method may further include:
[0082] When receiving a port adding request, determining the network to which the newly added port belongs according to the port adding request;
[0083] In the host set, filter the recommended host set based on the network to which the newly added port belongs;
[0084] Select a target host from the recommended host set, and create a new port on the target host.
[0085] Specifically, when it is necessary to add a network port in the current host cluster, the host cluster that is most suitable for creating the network port can be screened in the current host cluster (host set) according to the network type to which the network port belongs (the network to which the new port belongs), that is, the above-mentioned recommended host set. Thus, the target host that can build the new port can be selected from the recommended host set to realize the construction of the new port. Obviously, this implementation method helps to screen the host that is most suitable for creating a port of a specified network type, so as to further ensure the stable operation of the host cluster system.
[0086] Among them, in the host set, the recommended host set is obtained by filtering according to the network to which the newly added port belongs, which may include:
[0087] In the host set, select a host that supports the network to which the newly added port belongs, and obtain a first host set;
[0088] In the first host machine set, a host machine whose existing port number of the network to which the newly added port belongs does not reach the port limit number of the network to which the newly added port belongs is selected to obtain a second host machine set;
[0089] In the second host set, select a host whose total number of connection tracking of existing ports and the number of connection tracking of a single port of the network to which the newly added port belongs does not exceed the total number of connection tracking limits, to obtain a third host set;
[0090] For each host in the third host set, the remaining number of connection tracking of the host for the network to which the newly added port belongs is calculated according to the connection tracking limit number of the host for the network to which the newly added port belongs and the existing connection tracking number;
[0091] All hosts in the third host set are sorted in descending order according to the number of connection tracking remaining, to obtain a recommended host set;
[0092] Accordingly, selecting a target host from the set of recommended hosts and constructing a new port on the target host may include:
[0093] The first host in the recommendable host set is used as the target host, and a new port is constructed on the target host.
[0094] An embodiment of the present application provides an implementation method for screening a set of recommendable host machines in a host machine cluster. In the implementation process, the screening of recommendable host machines can be achieved by referring in turn to whether the host machine supports the network type of the network to which the newly added port belongs, whether the number of ports of the network to which the newly added port belongs exceeds the limit after the port is added, and whether the total number of connection tracking established after the port is added exceeds the limit; further, in order to ensure that the optimal host machine is recommended, the various recommendable host machines can also be sorted in combination with the remaining number of connection tracking in all recommendable host machines to obtain a final set of recommendable host machines. In the recommendable host machine set, each recommendable host machine is arranged in descending order according to the remaining number of connection tracking. Therefore, the first recommendable host machine in the recommendable host machine set is the optimal host machine corresponding to the newly added port, that is, the above-mentioned target host machine.
[0095] In one embodiment of the present application, the connection tracking management method may further include:
[0096] When receiving a single-port connection tracking number update request for the target network, determining an updated single-port connection tracking number according to the single-port connection tracking number update request;
[0097] If the updated single-port connection tracking number is greater than the single-port connection tracking number, the total number of connection tracking limits for the target network is calculated based on the port limit number of the target network and the updated single-port connection tracking number;
[0098] When the total number of connection tracking limits of the target network does not exceed the total number of connection tracking limits of the current host, the updated single-port connection tracking number will replace the single-port connection tracking number.
[0099] The connection tracking management method provided in the embodiment of the present application can further implement the update setting of the single-port connection tracking number of any network type in the host machine. It can be understood that for any network type in the host machine, no matter how its single-port connection tracking number is updated and changed, it should be ensured that the total number of connection tracking limits under the network type (that is, the sum of the number of connection tracking of all ports under the network type) does not exceed the total number of connection tracking limits of the host machine, so as to effectively ensure the stable operation of the host machine, otherwise, the update setting of the single-port connection tracking number of the network type is not allowed.
[0100] In one embodiment of the present application, the connection tracking management method may further include:
[0101] When receiving a port limit number update request for the target network, determining an updated port limit number according to the port limit number update request;
[0102] If the updated port limit number is lower than the port limit number, the total number of port limits of the current host is determined;
[0103] When the total number of port limits of the current host is not less than the original number of ports of the current host, the updated number of port limits will replace the number of port limits.
[0104] The connection tracking management method provided in the embodiment of the present application can further implement the update setting of the port limit number of any network type in the host machine. It can be understood that for any network type in the host machine, no matter how its port limit number changes, it should be ensured that the total number of port limits in the host machine (regardless of network type) is not less than the original number of ports of the current host machine (the number of ports when the host machine leaves the factory, and the ports are expandable) to effectively ensure the actual performance structure of the host machine, otherwise, the update setting of the port limit number of the network type is not allowed.
[0105] In one embodiment of the present application, the connection tracking management method may further include:
[0106] When receiving a port binding request for the current host, determining the number of existing ports of the network to which the bound port belongs in the current host;
[0107] When the number of existing ports of the network to which the bound port belongs in the current host machine does not reach the port limit number of the current host machine for the network to which the bound port belongs, determining the single-port connection tracking number of the network to which the bound port belongs;
[0108] When the sum of the total number of existing port connection tracking of the current host and the single-port connection tracking number of the network to which the bound port belongs does not exceed the total number of connection tracking limits of the current host, port binding is performed on the current host.
[0109] The connection tracking management method provided in the embodiment of the present application can further implement the judgment process for port binding for a specified host. Specifically, for any host, if it is necessary to bind a new network port on the host, it can also refer to whether the host supports the network type of the network to which the newly bound port belongs, whether the number of ports of the network to which the newly bound port belongs exceeds the limit after binding the port, and whether the total number of connection tracking established after binding the port exceeds the limit to determine whether the host allows to continue port binding. Obviously, only when all the above three conditions are met can port binding be allowed on the current host, otherwise the port binding request can be directly rejected.
[0110] Based on the above embodiments, an embodiment of the present application provides another connection tracking management method.
[0111] First, set connection tracking limits according to your network settings.
[0112] Please refer to Figure 2 , Figure 2A schematic diagram of connection tracking restrictions within a host provided for this application, assuming that the total connection tracking limit of the host is 15 million, the limit of network A is 1.5 million, and a single host allows up to 3 ports of network A; the limit of network B is 1 million, and a single host allows up to 2 ports of network B; the limit of network C is 5 million, and a single host allows up to 2 ports of network C; the limit of network D is 7 million, and a single host allows up to 1 port of network D. In the current host, assuming that a virtual machine has one port, there is already a virtual machine vmA1 of network A, virtual machines vmB1 and vmB2 of network B, and virtual machine vmC1 of network C. Then, whether the virtual machine is allowed to continue to be created is as follows:
[0113] 1. Create a virtual machine vmA2 in network A. The creation is allowed. Currently, network A limits a single host to 3 ports. There is already 1 vmA1 on the host, and one more port is allowed. The current total number of connection tracking is 150+100+100+500=8.5 million, plus vmA2's 1.5 million, which is 10 million, not exceeding the host's limit of 15 million.
[0114] 2. Create a virtual machine vmB3 of network B, but it is not allowed to create. The current host already has two virtual machines of network B, vmB1 and vmB2, but network B limits a single host to 2 ports and does not allow any more.
[0115] 3. Create a virtual machine vmC2 for network C. Creation is allowed but not recommended. After adding vmC2, the total number of connection tracking does not exceed the host limit, but the host already has a vmC1 that occupies 5 million, which is one-third of the total limit. If you create it directly, it will be allowed, but a reminder will be given.
[0116] 4. Creating a virtual machine vmD1 for network D is not allowed. The current host machine has occupied 8.5 million connection tracking numbers, and network D is limited to 7 million. 8.5 million + 7 million = 15.5 million, which exceeds the host machine's total limit of 15 million.
[0117] Further, referring to the above-mentioned scenarios, the specific implementation process of the embodiment of the present application is as follows:
[0118] 1. Refer to Table 1 and Table 2. Table 1 is a connection tracking record table provided in the present application, and Table 2 is a port binding record table provided in the present application.
[0119] Table 1 A connection tracking record table
[0120]
[0121] Table 2 A port binding record table
[0122]
[0123] 2. Update operation of restriction scheme:
[0124] (1) The total connection tracking limit for a host is preset to the default value, and the number of ports allowed to be created on a single network on the same host is preset to the default value.
[0125] (2) When creating and updating a network, add the ct_limit and per_node_ports parameters. ct_limit indicates the single-port connection tracking limit for the network; per_node_ports indicates the number of ports that a single network is allowed to create on the same host.
[0126] (3) ct_limit can be left unset when creating a new value. If not set, the default value will be used.
[0127] (4) per_node_ports can be left unset when creating a new node. If not set, the default value will be used. If set, it cannot be less than 1.
[0128] (5) When updating the network, ct_limit is allowed to be updated. When the value of ct_limit becomes larger, it is necessary to check whether the total number of connection tracking after the change exceeds the connection tracking limit of the host machine. If it exceeds, the modification is not allowed.
[0129] (6) When updating the network, per_node_ports is allowed to be updated. When the value of per_node_ports becomes smaller, it is necessary to check whether the total number of ports after the change is less than the initial number of ports of the host machine. If so, modification is not allowed.
[0130] (7) Update the client code ovn-client for interaction between neutron and ovn-nb. When updating the network and creating the network, set the other_config:ct-zone-limit of Logical_Switch according to ct_limit.
[0131] 3. About adding binding ports on the host:
[0132] (1) If the host is not bound or the host has not changed, the binding is allowed and the judgment is not continued. Otherwise, the processing continues.
[0133] (2) Based on the bound host, query the number of the same network bound to the host and the maximum number of ports allowed by the network. If the existing number is equal to the allowed number, the binding is rejected and the judgment is not continued. Otherwise, the processing continues.
[0134] (3) Based on the bound host, calculate the total number of connection tracking occupied by the currently bound port, and add the number of connection tracking occupied by the port. If it is not greater than the total limit of the host, the binding is allowed, otherwise the binding is rejected.
[0135] 4. About adding new ports in the host cluster:
[0136] Please refer to Figure 3 , Figure 3 A schematic diagram of a process flow of a host screening method provided in this application, the implementation process of which may include:
[0137] (1) Get a list of all hosts to form List 1.
[0138] (2) Obtain the number of single host ports restricted by the network to which the newly added port belongs.
[0139] (3) According to the network limit on the number of ports for a single host, the nodes whose network ports on the host have reached the limit are filtered out from List 1 to form List 2.
[0140] (4) Calculate the total number of connection tracking for all bound ports in List 2, and filter out hosts whose total number of connection tracking limits on the host plus the number of connection tracking limits for the port exceeds the total number of connection tracking limits on the host, to form List 3.
[0141] (5) Based on whether the number of connection trackings occupied by the port exceeds one-third of the total connection tracking limit on the host, split List 3 into List 4 (not exceeded) and List 5 (exceeded).
[0142] (6) Sort list 4 according to the number of remaining connection tracking numbers of the nodes. The more remaining connections, the higher the ranking, forming list 6.
[0143] (7) Split List 5 into List 7 (not present) and List 8 (present) based on whether there are ports that exceed one-third of the host machine's limit.
[0144] (8) Sort lists 7 and 8 according to the number of remaining connection tracking numbers of the nodes. The more remaining connections, the higher the sorting, forming lists 9 and 10.
[0145] (9) Return lists 6, 9, and 10 as interfaces. The hosts in list 6 are recommended hosts, the hosts in list 9 are bindable hosts, and the hosts in list 10 are not recommended hosts.
[0146] 5. Setting the total number of connection tracking limits based on the host's own resources:
[0147] (1) When each host starts the SDN distributed controller (ovn-controller), it obtains the total memory of the current host. For every 1G of memory, the total number of connection tracking increases by 10,000, and 1 million is reserved for the host.
[0148] (2) Set the total number of connection tracking limits for the host: sysctl –w net.nf_conntrack_max=6000000.
[0149] (3) Set the connection tracking limit that the host cloud platform can use. Set the limit to the chassis_private external_ids registered with the host through the command: chassis_private external_ids:ct_limits=5000000.
[0150] (4) In the neutron service, by obtaining external_ids:ct_limits in the chassis_private information, the total number of connection tracking is limited for each host.
[0151] It can be seen that the connection tracking management method provided in the embodiment of the present application predefines the network types that can be supported, the number of port connections that each network type can support, and the number of connection tracking that each network type port can support for any host machine. Therefore, when it is necessary to create a virtual machine on the host machine, this information can be referred to, and combined with the network type to which the virtual machine to be created belongs, it can be determined whether the current host machine is suitable for creating a virtual machine. It can be seen that the technical solution realizes more reasonable and effective management of connection tracking within the host system, further realizes the maximum utilization of host resources, and can effectively ensure the stable operation of the host machine.
[0152] An embodiment of the present application provides a connection tracking management device.
[0153] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of a connection tracking management device provided by the present application. The connection tracking management device may include:
[0154] A first determination module 1 is used to receive a virtual machine creation request and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request;
[0155] The second determination module 2 is used to determine the port limit number of the current host machine for the target network and determine the existing port number of the target network in the current host machine;
[0156] The third determination module 3 is used to determine the total number of connection tracking limits of the current host machine and the total number of connection tracking of existing ports and the number of single-port connection tracking of the target network when the number of existing ports is lower than the port limit;
[0157] The execution module 4 is used to execute the virtual machine creation request when the sum of the total number of existing port connection tracking and the single-port connection tracking does not exceed the total number of connection tracking limits.
[0158] It can be seen that the connection tracking management device provided in the embodiment of the present application predefines the network types that can be supported, the number of port connections that each network type can support, and the number of connection tracking that each network type port can support for any host machine. Therefore, when it is necessary to create a virtual machine on the host machine, this information can be referred to, and combined with the network type to which the virtual machine to be created belongs, it can be determined whether the current host machine is suitable for creating a virtual machine. It can be seen that the technical solution realizes more reasonable and effective management of connection tracking within the host system, further realizes the maximum utilization of host resources, and can effectively ensure the stable operation of the host machine.
[0159] In one embodiment of the present application, the third determination module 3 can be specifically used to determine the existing networks in the current host machine and the existing ports of each existing network in the current host machine when the number of existing ports is lower than the port limit number; and the sum of the connection tracking numbers of all existing ports is used as the total number of existing port connection tracking numbers of the current host machine.
[0160] In one embodiment of the present application, the above-mentioned execution module 4 can be specifically used to execute a virtual machine creation request when the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the preset ratio of the total number of connection tracking limits; when the sum of the total number of existing port connection tracking and the single-port connection tracking number exceeds the preset ratio of the total number of connection tracking limits, execute the virtual machine creation request and output a preset prompt.
[0161] In one embodiment of the present application, the connection tracking management device may also include a recommendation module, which is used to determine the network to which the newly added port belongs based on the port addition request when a port addition request is received; in the host machine set, obtain a recommended host machine set based on the network to which the newly added port belongs; select a target host machine from the recommended host machine set, and build a new port on the target host machine.
[0162] In one embodiment of the present application, the above-mentioned recommendation module can be specifically used to select a host machine that supports the network to which the newly added port belongs from a host machine set to obtain a first host machine set; in the first host machine set, select a host machine whose existing number of ports of the network to which the newly added port belongs does not reach the port limit number of the network to which the newly added port belongs to obtain a second host machine set; in the second host machine set, select a host machine whose total number of existing port connection tracking and the sum of the single-port connection tracking number of the network to which the newly added port belongs does not exceed the total number of connection tracking limit to obtain a third host machine set; for each host machine in the third host machine set, calculate the remaining number of connection tracking of the host machine for the network to which the newly added port belongs based on the connection tracking limit number and the existing connection tracking number of the host machine for the network to which the newly added port belongs; sort all the hosts in the third host machine set in order of the remaining number of connection tracking from large to small to obtain a recommendable host machine set; take the first host machine in the recommendable host machine set as the target host machine, and construct a new port on the target host machine.
[0163] In one embodiment of the present application, the connection tracking management device may also include a first update module, which is used to determine the updated single-port connection tracking number according to the single-port connection tracking number update request when a single-port connection tracking number update request for the target network is received; if the updated single-port connection tracking number is greater than the single-port connection tracking number, the total connection tracking limit of the target network is calculated according to the port limit number of the target network and the updated single-port connection tracking number; when the total connection tracking limit of the target network does not exceed the total connection tracking limit of the current host machine, the updated single-port connection tracking number replaces the single-port connection tracking number.
[0164] In one embodiment of the present application, the connection tracking management device may also include a second update module, which is used to determine the updated port restriction number according to the port restriction number update request when receiving a port restriction number update request regarding the target network; if the updated port restriction number is lower than the port restriction number, determine the total number of port restrictions of the current host machine; when the total number of port restrictions of the current host machine is not lower than the original number of ports of the current host machine, replace the port restriction number with the updated port restriction number.
[0165] For an introduction to the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0166] An embodiment of the present application provides an electronic device.
[0167] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application, and the electronic device may include:
[0168] A memory 11, used for storing computer programs;
[0169] The processor 10 can implement the steps of any one of the above connection tracking management methods when executing a computer program.
[0170] like Figure 5 , which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.
[0171] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.
[0172] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in an embodiment of the connection tracking management method.
[0173] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:
[0174] Receive a virtual machine creation request, and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request;
[0175] Determine the port limit of the current host machine for the target network, and determine the number of existing ports of the target network in the current host machine;
[0176] When the number of existing ports is lower than the port limit, determine the total number of connection tracking limits of the current host machine and the total number of connection tracking of existing ports, and the number of single-port connection tracking of the target network;
[0177] When the sum of the total number of existing port connection tracking and the number of single-port connection tracking does not exceed the total number of connection tracking limits, the virtual machine creation request is executed.
[0178] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.
[0179] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0180] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.
[0181] Of course, it should be noted that Figure 5 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include Figure 5 More or fewer components than shown, or combinations of certain components.
[0182] An embodiment of the present application provides a computer-readable storage medium.
[0183] The computer-readable storage medium provided in the embodiment of the present application stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned connection tracking management methods can be implemented.
[0184] Among them, the computer-readable storage medium can be any available medium that can be stored in a computer or a data storage device such as a server or data center that includes one or more available media integrated. For example, it can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk) and other media that can store computer program codes.
[0185] For an introduction to the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0186] An embodiment of the present application provides a computer program product.
[0187] The computer program product provided in the embodiments of the present application includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of any one of the above-mentioned connection tracking management methods can be implemented.
[0188] Specifically, in the above embodiments, all or part of them can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of them can be implemented in the form of a computer program product.
[0189] Among them, the computer program product may include one or more computer programs / instructions, and when the computer program / instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application may be generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line, etc.) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0190] For an introduction to the computer program product provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0191] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0192] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0193] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0194] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A connection tracking management method, characterized in that: include: Receive a virtual machine creation request, and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request; Determine the port limit number of the current host machine for the target network, and determine the number of existing ports of the target network in the current host machine; When the existing number of ports is lower than the port limit, determining the total number of connection tracking limits of the current host machine and the total number of existing port connection tracking, and the single-port connection tracking number of the target network; When the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the connection tracking limit total number, the virtual machine creation request is executed.
2. The connection tracking management method according to claim 1, characterized in that: When the number of existing ports is lower than the port limit, determining the total number of existing port connection tracking of the current host includes: When the number of existing ports is lower than the port limit, determining existing networks in the current host machine, and determining existing ports of each of the existing networks in the current host machine; The sum of the connection tracking numbers of all the existing ports is taken as the total number of connection tracking numbers of the existing ports of the current host machine.
3. The connection tracking management method according to claim 1, characterized in that: When the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the connection tracking limit total number, executing the virtual machine creation request includes: When the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed a preset ratio of the total number of connection tracking limits, executing the virtual machine creation request; When the sum of the total number of existing port connection tracking and the single-port connection tracking number exceeds a preset ratio of the total number of connection tracking limits, the virtual machine creation request is executed and a preset prompt is output.
4. The connection tracking management method according to any one of claims 1 to 3, characterized in that: Also includes: When receiving a port adding request, determining a network to which the newly added port belongs according to the port adding request; In the host set, a recommended host set is obtained by filtering according to the network to which the newly added port belongs; A target host is selected from the set of recommendable hosts, and the newly added port is constructed on the target host.
5. The connection tracking management method according to claim 4, characterized in that: In the host set, a recommended host set is obtained by filtering according to the network to which the newly added port belongs, including: Selecting a host machine that supports the network to which the newly added port belongs from the host machine set to obtain a first host machine set; Selecting, from the first host machine set, a host machine whose existing number of ports of the network to which the newly added port belongs does not reach the port limit number of the network to which the newly added port belongs, to obtain a second host machine set; In the second host machine set, select a host machine whose sum of the total number of connection tracking of existing ports and the number of connection tracking of a single port of the network to which the newly added port belongs does not exceed the total number of connection tracking limits, to obtain a third host machine set; For each host in the third host set, calculating the remaining number of connection tracking of the host for the network to which the newly added port belongs according to the connection tracking limit number and the existing connection tracking number of the host for the network to which the newly added port belongs; Sorting all hosts in the third host set in descending order according to the connection tracking remaining numbers to obtain the recommendable host set; Accordingly, selecting a target host from the set of recommendable hosts and constructing the newly added port on the target host includes: The first host machine in the recommendable host machine set is used as the target host machine, and the newly added port is constructed on the target host machine.
6. The connection tracking management method according to claim 1, characterized in that: Also includes: When receiving a single-port connection tracking number update request for the target network, determining an updated single-port connection tracking number according to the single-port connection tracking number update request; If the updated single-port connection tracking number is greater than the single-port connection tracking number, the total number of connection tracking limits of the target network is calculated according to the port limit number of the target network and the updated single-port connection tracking number; When the total number of connection tracking limits of the target network does not exceed the total number of connection tracking limits of the current host machine, the updated single-port connection tracking number replaces the single-port connection tracking number.
7. The connection tracking management method according to claim 1, characterized in that: Also includes: When receiving a port limit number update request for the target network, determining an updated port limit number according to the port limit number update request; If the updated port limit number is lower than the port limit number, determining the total number of port limits of the current host machine; When the total number of port restrictions of the current host machine is not less than the original number of ports of the current host machine, the updated number of port restrictions replaces the number of port restrictions.
8. A connection tracking management device, characterized in that: include: A first determination module is used to receive a virtual machine creation request and determine a target network to which the virtual machine to be created belongs according to the virtual machine creation request; A second determination module is used to determine the port limit number of the current host machine for the target network, and determine the number of existing ports of the target network in the current host machine; A third determination module is used to determine the total number of connection tracking limits of the current host machine and the total number of connection tracking of existing ports, and the number of single-port connection tracking of the target network when the number of existing ports is lower than the port limit number; The execution module is used to execute the virtual machine creation request when the sum of the total number of existing port connection tracking and the single-port connection tracking number does not exceed the connection tracking limit total number.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the connection tracking management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the connection tracking management method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Early warning event execution method and device, storage medium and electronic equipment
CN120825418A
Tracking connection number control method and device of virtual machine, equipment and medium
CN120929194A