Virtual machine neighbor discovery method and device in cluster environment

By allocating databases and servers for each virtual machine in the cluster environment, dynamically adjust the cache parameters and real -time update mapping relationships, solving the problem of low efficiency in the large -scale cluster environment in large -scale cluster environment Virtual machine neighbors discovered.

CN119011529BActive Publication Date: 2025-01-21TIANJIN ZHUOLANG KUNLUN CLOUD SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In large-scale cluster environments, traditional NDP is inefficient, waste of resources and degraded network performance, especially when virtual machines are frequently created, destroyed, migrated or replaced IPv6 addresses.

Method used

By allocating the corresponding database and servers for each virtual machine, the mapping relationship between the IPv6 address of the storage and the neighbor and the MAC address, and the cache parameters dynamically adjust the cache parameters according to the performance of the cluster environment and the network parameter, in real time The life cycle event of the virtual machine.

Benefits of technology

Effectively reduce the waste of cache resources, realize the real -time update of neighbor's address information, improve the performance and stability of the virtual machine network, and reduce the data flow of the neighbors' discovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119011529B_ABST
    Figure CN119011529B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for discovering neighbors of virtual machines in a cluster environment, which obtains performance parameters and network parameters of the cluster environment, and adjusts cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and network parameters; for a target virtual machine, the timestamp of the data contained in the first target mapping relationship in the corresponding database is updated based on the corresponding cache parameters, and the second target mapping relationship in the corresponding server cache is updated based on the timestamp; when a life cycle event occurs, the first target mapping relationship and the second target mapping relationship are respectively changed based on the life cycle event; when communication with neighbors is required, the target IPv6 address is obtained, and the target MAC address corresponding to the target IPv6 address is obtained based on the second target mapping relationship. The present invention can alleviate the problems of low efficiency of neighbor discovery, waste of resources, and decreased network performance existing in traditional NDP in a large-scale cluster environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data communication technology, and in particular to a method and device for discovering neighbors of virtual machines in a cluster environment. Background Art

[0002] With the continuous development and progress of network technology, IPv6 protocol has become an important part of the Internet protocol stack. As a key protocol of IPv6, Neighbor Discovery Protocol (NDP) is used to manage neighbor relationships, including discovering neighbors, resolving the mapping of neighbor IPv6 addresses to MAC addresses, etc., and storing the mapping of IPv6 addresses to MAC addresses of virtual machines and their neighbors (such as other virtual machines, routers, physical devices, etc.) through the Neighbor Cache. These mappings are crucial to the efficiency of network communications. In a virtual machine environment, the actual packet forwarding of virtual machines using IPv6 networks is achieved through MAC addresses. Virtual machines can use NDP to resolve the mapping of target IPv6 addresses to corresponding MAC addresses, thereby ensuring that data packets can be correctly delivered from virtual machines to target devices.

[0003] However, in large-scale cluster scenarios, there are a large number of virtual machines, and virtual machines may frequently create, destroy, migrate, and change IPv6 addresses or network cards. Traditional NDP has problems of low efficiency and resource waste in large-scale cluster environments. Specifically, since traditional NDP uses broadcast messages to discover neighbor devices, hundreds of virtual machines sending broadcast messages at the same time will cause broadcast storms, consume a lot of network bandwidth, and cause network congestion; and each virtual machine independently performs the neighbor discovery process in the same network, which will cause resource competition between physical network devices and virtual machines; a large number of messages need to be processed and forwarded, which will occupy a lot of CPU and memory, causing resource waste and reducing virtual network performance; the neighbor address cache management in traditional NDP technology is usually static, and the data in the neighbor cache table cannot be dynamically adjusted, resulting in cache resource waste; once encountering large-scale migration of virtual machines or replacement of networks, traditional NDP technology cannot effectively maintain neighbor address information, and there will be problems of network interruption and performance degradation, which will reduce the efficiency of neighbor discovery and affect the user experience. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a virtual machine neighbor discovery method and device in a cluster environment to alleviate the problems of low neighbor discovery efficiency, resource waste, and network performance degradation existing in traditional NDP in a large-scale cluster environment.

[0005] In the first aspect, an embodiment of the present invention provides a method for discovering neighbors of virtual machines in a cluster environment, wherein each virtual machine in the cluster environment corresponds to a corresponding database and server, and each virtual machine stores the mapping relationship between the IPv6 address and the MAC address corresponding to the corresponding neighbor through its corresponding database, and each virtual machine caches the corresponding mapping relationship through its corresponding server; the method comprises: obtaining performance parameters and network parameters of the cluster environment, and adjusting the cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters; updating the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameters corresponding to the target virtual machine, and updating the second target mapping relationship cached by the server corresponding to the target virtual machine based on the timestamp of the data contained in the first target mapping relationship; when a life cycle event of the target virtual machine occurs, changing the first target mapping relationship and the second target mapping relationship respectively based on the life cycle event; when the target virtual machine needs to communicate with its neighbor, obtaining the target IPv6 address of the neighbor of the target virtual machine, and obtaining the target MAC address corresponding to the target IPv6 address based on the second target mapping relationship.

[0006] In a second aspect, an embodiment of the present invention further provides a virtual machine neighbor discovery device in a cluster environment, wherein each virtual machine in the cluster environment corresponds to a corresponding database and server, each virtual machine stores the mapping relationship between the IPv6 address and the MAC address corresponding to the corresponding neighbor through its corresponding database, and each virtual machine caches the corresponding mapping relationship through its corresponding server; the device includes: an adjustment module, used to obtain performance parameters and network parameters of the cluster environment, and adjust the cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters; an update module, used to update the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameters corresponding to the target virtual machine, and update the second target mapping relationship cached by the server corresponding to the target virtual machine based on the timestamp of the data contained in the first target mapping relationship; a change module, used to change the first target mapping relationship and the second target mapping relationship respectively based on the life cycle event when a life cycle event of the target virtual machine occurs; an acquisition module, used to obtain the target IPv6 address of the neighbor of the target virtual machine when the target virtual machine needs to communicate with its neighbor, and obtain the target MAC address corresponding to the target IPv6 address based on the second target mapping relationship.

[0007] An embodiment of the present invention provides a method and device for discovering neighbors of virtual machines in a cluster environment, which obtain performance parameters and network parameters of the cluster environment, and adjust the cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters; for a target virtual machine, the timestamp of the data contained in the first target mapping relationship in the corresponding database is updated based on the corresponding cache parameters, and the second target mapping relationship in the corresponding server cache is updated based on the timestamp; when a lifecycle event occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event; when communication with neighbors is required, the target IPv6 address is obtained, and the target MAC address corresponding to the target IPv6 address is obtained based on the second target mapping relationship. By adopting the above technology, the server cache data of the neighbor address mapping relationship can be dynamically adjusted according to the performance of the cluster environment and the network to reduce the waste of cache resources. The neighbor address mapping relationship stored in the corresponding database and the neighbor address mapping relationship cached by the corresponding server can also be automatically changed when a life cycle event of the virtual machine occurs to realize real-time update of the neighbor address information, thereby facilitating the virtual machine to use its IPv6 address and the neighbor address mapping relationship cached by the corresponding server to quickly and accurately obtain the neighbor's MAC address for communication between the virtual machine and its neighbors. Compared with the broadcast method adopted by the traditional NDP, it can effectively reduce the data traffic required for neighbor discovery, improve the performance and stability of the virtual machine network, thereby alleviating the problems of low neighbor discovery efficiency, resource waste and network performance degradation existing in the traditional NDP in a large-scale cluster environment.

[0008] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0009] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0011] Figure 1 A schematic diagram of a flow chart of a method for discovering neighbors of virtual machines in a cluster environment in an embodiment of the present invention;

[0012] Figure 2 This is an example diagram of a functional module implementation of a virtual machine neighbor discovery method in a cluster environment according to an embodiment of the present invention;

[0013] Figure 3 This is an example diagram of a virtual machine obtaining required data from a neighbor cache table in an embodiment of the present invention;

[0014] Figure 4 This is an example diagram of the working principle of the neighbor cache table maintenance module in an embodiment of the present invention;

[0015] Figure 5 This is an example diagram of a process of virtual machine neighbor discovery in an embodiment of the present invention;

[0016] Figure 6 It is a structural schematic diagram of a virtual machine neighbor discovery device in a cluster environment in an embodiment of the present invention. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0018] At present, traditional NDP has problems of low efficiency and waste of resources in large-scale cluster environments. Specifically, since traditional NDP uses broadcast messages to discover neighbor devices, hundreds of virtual machines sending broadcast messages at the same time will cause broadcast storms, consume a lot of network bandwidth, and cause network congestion; and each virtual machine independently performs the neighbor discovery process in the same network, which will cause resource competition between physical network devices and virtual machines; a large number of messages need to be processed and forwarded, which will take up a lot of CPU and memory, causing resource waste and reducing virtual network performance; the neighbor address cache management in traditional NDP technology is usually static, and the data in the neighbor cache table cannot be dynamically adjusted, resulting in cache resource waste; once encountering large-scale migration of virtual machines or replacement of networks, traditional NDP technology cannot effectively maintain neighbor address information, there will be problems of network interruption and performance degradation, which will reduce the efficiency of neighbor discovery and affect the user experience.

[0019] Based on this, the present invention provides a method and device for discovering neighbors of virtual machines in a cluster environment, which can alleviate the above-mentioned problems existing in traditional NDP in a large-scale cluster environment.

[0020] To facilitate understanding of this embodiment, a virtual machine neighbor discovery method in a cluster environment disclosed in an embodiment of the present invention is first described in detail. Each virtual machine in the cluster environment has a corresponding database and server. Each virtual machine stores the mapping relationship between the IPv6 address and the MAC address corresponding to the corresponding neighbor through its corresponding database, and each virtual machine caches the corresponding mapping relationship through its corresponding server; see Figure 1 As shown, the method may include the following steps:

[0021] Step S102: acquiring performance parameters and network parameters of the cluster environment, and adjusting cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters.

[0022] Among them, performance parameters may refer to CPU utilization, memory utilization, etc. of the cluster environment, and network parameters may refer to network bandwidth utilization, network delay, packet loss rate, etc. of the cluster environment. The specific contents of performance parameters and network parameters are not limited here.

[0023] The cache parameter may refer to a parameter that characterizes the capacity of the corresponding server cache mapping relationship, and there is no limitation on this.

[0024] Step S104, updating the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameters corresponding to the target virtual machine, and updating the second target mapping relationship cached by the server corresponding to the target virtual machine based on the timestamp of the data contained in the first target mapping relationship.

[0025] For a virtual machine in a cluster environment, the mapping relationship between the IPv6 address and the MAC address corresponding to the corresponding neighbor is stored in the database corresponding to the virtual machine, and the mapping relationship is cached by the server corresponding to the virtual machine. The cache parameters of the corresponding mapping relationship cached by the server corresponding to the virtual machine can be adjusted in real time according to the performance parameters and network parameters of the cluster environment obtained by real-time monitoring. Since the cache parameters represent the capacity of the server cache mapping relationship, in order to ensure that the mapping relationship cached by the server is within the capacity of the server cache mapping relationship, the timestamp of the data contained in the mapping relationship in the database can be updated in real time according to the cache parameters adjusted in real time, and then the mapping relationship cached by the server is processed according to the real-time updated timestamp to realize real-time update of the mapping relationship, thereby avoiding the mapping relationship cached by the server exceeding the capacity of the server cache mapping relationship.

[0026] Step S106: When a lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are respectively changed based on the lifecycle event.

[0027] The life cycle event may refer to an important event of a virtual machine that may change neighbor relationships during its life cycle, such as creation, deletion, address change, network card replacement, migration, etc. of a virtual machine, and there is no limitation on this.

[0028] Step S108, when the target virtual machine needs to communicate with its neighbor, obtain the target IPv6 address of the neighbor of the target virtual machine, and obtain the target MAC address corresponding to the target IPv6 address based on the second target mapping relationship.

[0029] Continuing with the previous example, when a virtual machine needs to communicate with its neighbor, since the IPv6 address of the neighbor to be communicated is known, the virtual machine only needs to find the MAC address corresponding to the known IPv6 address from the mapping relationship cached by its corresponding server and can use the found MAC address to achieve data communication with the neighbor.

[0030] An embodiment of the present invention provides a method for discovering neighbors of virtual machines in a cluster environment, which obtains performance parameters and network parameters of the cluster environment, and adjusts cache parameters of server cache mapping relationships corresponding to each virtual machine based on the performance parameters and network parameters; for a target virtual machine, updates the timestamp of data contained in a first target mapping relationship in a corresponding database based on its corresponding cache parameters, and updates the second target mapping relationship in the corresponding server cache based on the timestamp; when a lifecycle event occurs, changes the first target mapping relationship and the second target mapping relationship based on the lifecycle event, respectively; when communication with neighbors is required, obtains the target IPv6 address, and obtains the target MAC address corresponding to the target IPv6 address based on the second target mapping relationship. By adopting the above technology, the server cache data of the neighbor address mapping relationship can be dynamically adjusted according to the performance of the cluster environment and the network to reduce the waste of cache resources. The neighbor address mapping relationship stored in the corresponding database and the neighbor address mapping relationship cached by the corresponding server can also be automatically changed when a life cycle event of the virtual machine occurs to realize real-time update of the neighbor address information, thereby facilitating the virtual machine to use its IPv6 address and the neighbor address mapping relationship cached by the corresponding server to quickly and accurately obtain the neighbor's MAC address for communication between the virtual machine and its neighbors. Compared with the broadcast method adopted by the traditional NDP, it can effectively reduce the data traffic required for neighbor discovery, improve the performance and stability of the virtual machine network, thereby alleviating the problems of low neighbor discovery efficiency, resource waste and network performance degradation existing in the traditional NDP in a large-scale cluster environment.

[0031] As a possible implementation, the cache parameters may include at least one of the following: validity period of cache data, size of cache data, and concurrent processing number of cache data; the size of cache data may represent the maximum number of cache data entries supported by the server corresponding to the corresponding virtual machine, and the concurrent processing number of cache data may represent the maximum number of concurrent processing data entries supported by the server corresponding to the corresponding virtual machine; based on this, the cache parameters for adjusting the cache mapping relationship of the server corresponding to each virtual machine based on the performance parameters and the network parameters in the above step S102 may include:

[0032] Step 1: Determine the load status of the cluster environment based on performance parameters and network parameters.

[0033] The load state can be divided into a high load state and a low load state.

[0034] The system resource data and network status data of the cluster environment can be collected regularly and stored in a preset monitoring database. The data in the monitoring database can be called to analyze the performance parameters of the cluster environment such as CPU utilization and memory utilization that characterize the resource usage of the cluster environment, as well as network parameters such as network bandwidth utilization, network delay, and packet loss rate that characterize the network status of the cluster environment, and each parameter obtained can be compared with its corresponding preset threshold to determine whether the cluster environment is in a high-load state or a low-load state. For example, the high-load threshold and low-load threshold of the CPU utilization are preset to 80% and 50% respectively. When the CPU utilization exceeds 80%, the cluster environment can be determined to be in a high-load state, and when the CPU utilization is less than 50%, the cluster environment can be determined to be in a low-load state.

[0035] Step 2: If the cluster environment is in a high-load state, the validity period of the cached data in the server corresponding to each virtual machine is set to a first duration, the scale of the cached data in the server corresponding to each virtual machine is set to a first scale, and the concurrent processing number of the cached data in the server corresponding to each virtual machine is set to a first number.

[0036] Continuing with the previous example, for a certain virtual machine, when it is determined that the cluster environment is in a high-load state, the validity period of the entries cached in the server corresponding to the virtual machine can be shortened from the standard duration to the first duration to reduce CPU usage and thereby ensure a quick system response, and the maximum number of cache entries supported by the server corresponding to the virtual machine can be reduced from the standard value to the first value to save memory resources, and the number of concurrent processing entries supported by the server corresponding to the virtual machine can be reduced from the standard number to the first number to prevent resource overload.

[0037] Step 3, if the cluster environment is in a low load state, set the validity period of the cached data in the server corresponding to each virtual machine to the second duration, set the scale of the cached data in the server corresponding to each virtual machine to the second scale, and set the concurrent processing number of the cached data in the server corresponding to each virtual machine to the second number.

[0038] Among them, the second duration is greater than the first duration, the second scale is greater than the first scale, and the second quantity is greater than the first quantity.

[0039] Continuing with the previous example, when it is determined that the cluster environment is in a low-load state, the validity period of the entries cached in the server corresponding to the virtual machine can be extended from the standard duration to the second duration to reduce repeated calculations and the frequency of data updates, and the maximum number of entries supported by the server corresponding to the virtual machine can be increased from the standard value to the second value to improve the cache hit rate, and the number of concurrent processing entries supported by the server corresponding to the virtual machine can be increased from the standard number to the second number to improve resource utilization.

[0040] As a possible implementation, if the lifecycle event includes the creation of a target virtual machine, the above-mentioned step S106 (i.e., when a lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event) may include: when creating the target virtual machine, adding the network configuration information of the target virtual machine to the first target mapping relationship, setting an initial timestamp for the network configuration information, and then adding the network configuration information to the second target mapping relationship.

[0041] The network configuration information may include virtual machine ID, MAC address, IPv6 address, physical network device information, server information, etc.

[0042] As a possible implementation, if the lifecycle event includes the deletion of the target virtual machine, the above-mentioned step S106 (i.e., when a lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event) may include: when deleting the target virtual machine, setting the timestamp of the data contained in the first target mapping relationship to zero, and deleting the second target mapping relationship.

[0043] As a possible implementation, if the lifecycle event includes a change in the IPv6 address of the target virtual machine, the above-mentioned step S106 (i.e., when a lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event) may include: when changing the IPv6 address of the target virtual machine, obtaining the first original mapping relationship between the IPv6 address before the change and its corresponding original MAC address from the first target mapping relationship based on the network configuration information, and setting the timestamp of the first original mapping relationship to zero, then adding the first new mapping relationship between the changed IPv6 address and the original MAC address to the first target mapping relationship, and setting a first new timestamp for the first new mapping relationship, then deleting the data corresponding to the first original mapping relationship in the second target mapping relationship, and adding the first new mapping relationship to the second target mapping relationship; wherein the first new mapping relationship includes the changed IPv6 address, the original MAC address and the first new timestamp.

[0044] As a possible implementation, if the lifecycle event includes a change in the MAC address of the target virtual machine, the above-mentioned step S106 (i.e., when a lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event) may include: when the MAC address of the target virtual machine is changed, the second original mapping relationship between the MAC address before the change and its corresponding original IPv6 address is obtained from the first target mapping relationship based on the network configuration information, and the timestamp of the second original mapping relationship is set to zero, and then the second new mapping relationship between the changed MAC address and the original IPv6 address is added to the first target mapping relationship, and a second new timestamp is set for the second new mapping relationship, and then the data corresponding to the second original mapping relationship in the second target mapping relationship is deleted, and the second new mapping relationship is added to the second target mapping relationship.

[0045] The second new mapping relationship includes the original IPv6 address, the changed MAC address and the second new timestamp.

[0046] As a possible implementation, if the lifecycle event includes the migration of the target virtual machine, the above-mentioned step S106 (i.e., when the lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event) may include: when migrating the target virtual machine, the pre-migration server information and the post-migration server information corresponding to the target virtual machine, and setting the timestamp of the data contained in the first target mapping relationship to zero, and then migrating the second target mapping relationship from the pre-migration server to the post-migration server for caching based on the pre-migration server information and the post-migration server information, and setting a third new timestamp for the first target mapping relationship.

[0047] As a possible implementation, each server corresponding to each virtual machine may be provided with a corresponding hot cache area and a cold cache area, and the cache capacity of the hot cache area in the same server is smaller than the cache capacity of the cold cache area; based on this, for each server corresponding to each virtual machine, the cache of the mapping relationship may include:

[0048] Step A1: Count the access frequency of each data entry in the cached mapping relationship within a preset time period, and divide the data entries included in the cached mapping relationship into first category entries and second category entries according to the access frequency.

[0049] The access frequency of the first category of entries exceeds a preset frequency threshold, and the access frequency of the second category of entries does not exceed the preset frequency threshold.

[0050] Step A2: caching the first type of entries into the hot cache area, and caching the second type of entries into the cold cache area.

[0051] Step A3: If the number of data entries currently cached reaches the size of the currently cached data, the LRU algorithm is used to process the data entries currently cached so that the number of data entries currently cached is smaller than the size of the currently cached data.

[0052] For a certain virtual machine, when the number of entries currently cached by its corresponding server reaches the set upper limit (that is, the maximum number of entries supported by the server for caching), the LRU (Least Recently Used) algorithm is used to manage the cached entries of the server, that is, to delete the earliest written or least used entries to make room for writing new address mapping relationships, thereby ensuring that the number of entries cached by the server is within a reasonable range.

[0053] As a possible implementation, updating the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameters corresponding to the target virtual machine in the above-mentioned step S104 may include: scanning the first target mapping relationship according to a preset first period to update the timestamp of the data contained in the first target mapping relationship based on the scanning time and the cache parameters corresponding to the target virtual machine.

[0054] Continuing with the previous example, for a virtual machine in a cluster environment, the mapping relationship stored in the database corresponding to the virtual machine is periodically scanned according to a preset first period. Each time the mapping relationship is scanned, the lifetime of each data item is calculated based on the current scanning time and the timestamp of the data item contained in the mapping relationship, and then the timestamp of the data item whose lifetime exceeds the validity period of the cache entry in the corresponding server is set to zero.

[0055] As a possible implementation, updating the second target mapping relationship of the server cache corresponding to the target virtual machine based on the timestamp of the data contained in the first target mapping relationship in the above step S104 may include: scanning the first target mapping relationship according to a preset second period to classify the data contained in the first target mapping relationship according to the timestamp and updating the second target mapping relationship based on the classification result.

[0056] Exemplarily, in the process of scanning the first target mapping relationship according to a preset second period, for each scan, the following operation method can be adopted: the data contained in the first target mapping relationship is divided into invalid data with a timestamp of zero and / or valid data with a timestamp not zero according to the timestamp; if the first target mapping relationship contains invalid data, the data corresponding to the invalid data in the second target mapping relationship is deleted.

[0057] Continuing with the previous example, the mapping relationship stored in the database corresponding to the virtual machine is periodically scanned according to the preset second period. Each time the mapping relationship is scanned, for each data item, if the timestamp of the data item is zero, the data item can be determined as an invalid data item, and the entry corresponding to the data item cached in the corresponding server is deleted, and then the data item is cleared from the mapping relationship in which it is located. If the timestamp of the data item is not zero, the data item can be determined as a valid data item, and it is checked whether there is a corresponding entry corresponding to the data item in the mapping relationship cached in the corresponding server. If there is no corresponding entry corresponding to the data item in the corresponding server, a new entry is added to the mapping relationship cached by the corresponding server as the entry corresponding to the data item.

[0058] As a possible implementation, the virtual machine neighbor discovery method in the cluster environment may further include: when concurrently accessing the first target mapping relationship stored in the target virtual machine, using a distributed lock mechanism to concurrently access the first target mapping relationship.

[0059] In order to facilitate understanding of the virtual machine neighbor discovery method in the above cluster environment, an exemplary description is given below taking a specific application as an example.

[0060] See also Figure 2As shown, the virtual machine neighbor discovery method in the above-mentioned cluster environment can be implemented by a physical server in the cluster environment. The physical server may include an environment monitoring and parameter configuration module 201, a virtual machine life cycle monitoring module 202, a virtual machine address maintenance module 203, and a neighbor cache table maintenance module 204 to implement it. The physical server manages multiple virtual machines in the cluster environment through a virtual machine management system. Each virtual machine stores a corresponding address mapping relationship table through its corresponding database (recording the mapping relationship between the IPv6 address and the MAC address corresponding to the corresponding neighbor in the form of a data item), and each virtual machine caches the corresponding neighbor cache table through its corresponding server (recording the data in the corresponding mapping relationship table in the form of an entry).

[0061] The environment monitoring and parameter configuration module 201 is mainly used to achieve the following two functions:

[0062] (1) Dynamic monitoring: Regularly collect relevant data on system resources and network status and store them in the monitoring database. Real-time analysis of resource usage such as CPU utilization, memory utilization, and network bandwidth utilization, as well as network performance data such as network latency and packet loss rate, is performed to determine the current status of system resources and the network.

[0063] (2) Parameter adjustment: Determine whether the current resource utilization and network status require parameter adjustment based on the preset threshold. If new parameter values ​​need to be calculated to adjust the parameter configuration, then dynamically configure the validity period, entry size, and number of concurrent processing of entries in the neighbor cache table based on the current server performance and network load. The preset threshold is the key to dynamically adjusting parameter configuration. It determines when and how parameter configuration adjustment is required. The configuration of the preset threshold needs to consider server performance and resource limitations. First, the key indicators of the monitored resources should be determined as CPU / memory / network bandwidth. The default high load threshold is set to 80% and the low load threshold is set to 50%. When the CPU utilization rate exceeds 80%, it is determined to be a high load situation. The validity period of the entries in the neighbor cache table is shortened to 10 minutes to reduce CPU usage and ensure rapid system response. When the CPU utilization rate is less than 50%, it is determined to be a low load situation. The validity period of the entries in the neighbor cache table is extended to 30 minutes to reduce repeated calculations and data update frequency. The upper limit of the number of entries in the neighbor cache table (i.e., the entry size) is determined based on the current memory load situation. Specifically, when the memory utilization rate exceeds 80%, it is determined that the memory is full. In high-load situations, the entry size is limited to 10,000 to save memory resources. When the memory utilization is lower than 50%, the memory is judged to be under low load, and the entry size is increased to 50,000, thereby improving the cache hit rate. The maximum number of concurrent processing entries in the neighbor cache table allowed is set based on the current network bandwidth load (i.e., the number of concurrent processing). Specifically, if the network bandwidth utilization exceeds 80%, it is judged that the network bandwidth is under high load, then the number of concurrent processing is reduced to 5 to prevent resource overload. If the network bandwidth utilization is lower than 50%, it is judged that the network bandwidth is under low load, and the number of concurrent processing is increased to 20 to improve resource utilization.

[0064] The virtual machine address maintenance module 203 is mainly used to monitor and update the virtual machine address mapping relationship table, and mainly includes the following two functions:

[0065] (1) Maintain an independent address mapping table corresponding to each virtual machine in the database, centrally manage the network configuration information of each virtual machine, provide global virtual machine network configuration, and facilitate the management and optimization of virtual machine address mapping relationships. The address mapping table uses the virtual machine ID as an index. The address mapping table contains: virtual machine ID, IPv6 address, MAC address, physical network device information, server node information, and the timestamp corresponding to the data update time. In a large-scale cluster environment, there are often multiple transactions accessing and updating the address mapping table at the same time. The data content contained in the same address mapping table needs to be coordinated and updated between multiple nodes, which may cause data conflicts and consistency problems. In order to ensure the consistency and accuracy of the data contained in the address mapping table, a distributed lock mechanism can be used to manage concurrent access and data updates of the address mapping table to ensure the consistency and synchronization of the data contained in the address mapping table between different nodes. The distributed lock mechanism is a mechanism that can coordinate multiple nodes' access to shared resources (i.e., the same address mapping table) in a distributed system. Distributed locks can ensure that only one node can operate on shared resources at the same time. Before accessing the address mapping table, each transaction must first try to obtain a distributed lock, then check the current data status in the address mapping table to confirm whether there is a data conflict with other transactions; if it is a write operation, the distributed lock will be released immediately after updating the address mapping table; if it is a read operation, the distributed lock will be released after reading the data in the address mapping table; if the lock is already held by other transactions, the current transaction will enter a waiting state until the distributed lock is released; when the transaction completes the operation on the address mapping table, the distributed lock will be released immediately, so that other waiting transactions can obtain the distributed lock and proceed to the next step. Managing concurrent access to the address mapping table through a distributed lock mechanism can ensure the consistency of the data contained in the address mapping table between different nodes to maintain the validity period of the address mapping table.

[0066] (2) For each data item in the address mapping table, there will be a timestamp corresponding to the update time. The address mapping table in the database is maintained and updated according to the network configuration information of the virtual machine. The validity period of the data item in the address mapping table is determined by the network configuration information. The address mapping table is scanned every 60 seconds, and the survival time of the data item is calculated according to the current scanning time. As long as the data item in the address mapping table exceeds the validity period of the entry in the neighbor cache table, the timestamp of the data item is set to zero. The data item with a timestamp set to zero will be judged as expired data.

[0067] The virtual machine lifecycle monitoring module 202 is mainly used to implement the following two functions:

[0068] (1) Manage virtual machine addresses: Capture virtual machine lifecycle events in real time through virtual machine API callbacks to monitor the entire process of virtual machine creation, operation, suspension, and destruction in real time. When a virtual machine issues a creation command, the event is captured immediately, and the network configuration information of the newly created virtual machine (including virtual machine ID, IPv6 address, MAC address, physical network device information, and server node information) is obtained. The obtained network configuration information is added to the address mapping table in the database and the initial timestamp of the added data item is set; when the IPv6 address or MAC address of the virtual machine changes, the change event is captured, resource allocation and recycling operations are triggered immediately, the timestamp of the old address mapping relationship is set to zero, and the new address mapping relationship is written to the address mapping table in the database. The new address mapping relationship written in the address mapping table includes the new IPv6 address or new MAC address and the latest timestamp; when the virtual machine is destroyed, the event is captured and the timestamps of all data items in the address mapping table are set to zero. The capture of lifecycle events can instantly perceive changes in the network information status of the virtual machine so that corresponding processing and feedback can be made quickly.

[0069] (2) After the virtual machine is started, it will obtain network configuration information (including IPv6 address and MAC address). The obtained network configuration information is initialized into the address mapping table when the virtual machine is created, and is synchronized to the neighbor cache table of the server where it is located. Then, when the virtual machine is running, if it wants to communicate with virtual machines on different servers, it will use the following steps to establish a neighbor relationship: First, it must send a neighbor request. Virtual machine A sends a neighbor request (NS, Neighbor Solicitation) message to the IPv6 address of virtual machine B to inquire about the MAC address of virtual machine B. After receiving the NS message, the server where virtual machine B is located will query the MAC address of virtual machine B from the address mapping table in the database and encapsulate the MAC address of virtual machine B in a neighbor advertisement (NA, Neighbor Advertisement) message and return it to virtual machine A. After receiving the NA message, the server where virtual machine A is located will add the mapping relationship between virtual machine B's IPv6 address and MAC address to the address mapping table and neighbor cache table corresponding to virtual machine A. The server where virtual machine B is located will also add the mapping relationship between virtual machine A's IPv6 address and MAC address to the address mapping table and neighbor cache table corresponding to virtual machine B.

[0070] The neighbor cache table maintenance module 204 is mainly used to implement the following two functions:

[0071] (1) Maintain the neighbor cache table stored in the server memory: The neighbor cache table records the data entries of the mapping relationship between the IPv6 address and MAC address of the virtual machine, and other related network information, so that the virtual machine can quickly search the neighbor cache table to obtain the required address information and quickly respond to network requests during communication, accelerating the process of network packet transmission and neighbor discovery. Scan the data in the address mapping table in the database every 30 seconds to classify the data items according to the scanning time and the timestamp of the data items, and then process the data items according to the classification. Specifically, if the timestamp of the data item is zero, it means that the data item is invalid, delete the entry corresponding to the data item from the neighbor cache table, and then clear the data item from the address mapping table; if the timestamp of the data item is not zero, it means that the data item is valid, check whether there is an entry corresponding to the data item in the neighbor cache table, and if not, add a new entry to the neighbor cache table.

[0072] (2) Hierarchical cache optimization of neighbor cache table: According to the access frequency and importance of each entry in the neighbor cache table, the cache is divided into hot cache layer and cold cache layer to improve cache efficiency. The hot cache layer has a relatively small storage capacity but provides fast access, and is mainly used to store entries with high access frequency; the cold cache layer has a relatively large storage capacity and a relatively slow access speed, and is mainly used to store entries with low access frequency that are eliminated from the hot cache. The created hot cache layer and cold cache layer will control the maximum capacity of the neighbor cache table according to the entry scale set in the parameter configuration. When the number of entries reaches the set upper limit (i.e., entry scale), the LRU (Least Recently Used) strategy is used to manage cache entries, that is, the earliest written or least used entries in the neighbor cache table are deleted to make room for writing new address mapping relationships to ensure that the neighbor cache table is within a reasonable entry scale.

[0073] See also Figure 3 As shown, through the hierarchical cache optimization of the neighbor cache table, when a virtual machine initiates a communication request to its neighbor, the neighbor's IPv6 address is used to search for the required MAC address from the hot cache layer of the neighbor cache table in the server to determine whether the required MAC address exists in the hot cache layer. If the required MAC address exists in the hot cache layer, the required MAC address is returned to the virtual machine that initiated the communication request. If the required MAC address does not exist in the hot cache layer, the required MAC address is searched from the cold cache layer of the neighbor cache table in the server, and the required MAC address is returned to the virtual machine that initiated the communication request.

[0074] In addition, see Figure 2 and Figure 4As shown, the neighbor cache table maintenance module 204 can also be provided with a hot cache layer monitoring module 403 to monitor the status of the hot cache layer 401, and a cold cache layer monitoring module 404 to monitor the status of the cold cache layer 402; when the memory of the server where the virtual machine is located needs to cache a new address mapping relationship, the server where the virtual machine is located can give priority to adding new entries to the hot cache layer 401 of the neighbor cache table. If the cache layer monitoring module 403 detects that the hot cache layer 401 is full, the least used entries in the hot cache layer 401 are migrated to the cold cache layer 402.

[0075] In addition, see Figure 4 As shown, when a virtual machine accesses a cache entry, it will first search for the entry in the hot cache layer 401. If the entry is found, the access information of the entry will be updated. If the entry is not found, the entry will be searched in the cold cache layer 402. The entry will also be migrated back and forth between the hot cache layer 401 and the cold cache layer 402 according to the access frequency. When the cold cache layer monitoring module 404 detects that an entry in the cold cache layer 402 is frequently accessed, the entry can be migrated to the hot cache layer 401. When the hot cache layer monitoring module 403 detects that the hot cache layer 401 reaches the capacity limit, the least used entry in the hot cache layer 401 is migrated to the cold cache layer 402 using the LRU strategy. Expired or no longer needed entries in the hot cache layer 401 and the cold cache layer 402 can also be regularly cleaned up. The number of concurrent processing set in the parameter configuration can be used to control the number of concurrent new address mapping relationships written to the neighbor cache table at one time.

[0076] See also Figures 2 to 5 As shown in the figure, the main steps of virtual machine neighbor discovery are as follows:

[0077] The first step is to create a virtual machine.

[0078] In the second step, after the virtual machine lifecycle monitoring module 202 captures the event, it will initialize the network configuration information into the address mapping table of the database.

[0079] When creating a virtual machine, the virtual machine management system will issue a virtual machine creation instruction. After capturing the event, the virtual machine lifecycle monitoring module 202 will obtain the network configuration information of the created virtual machine (including the initial MAC address of the created virtual machine and the IPv6 address assigned to it, as well as the virtual machine ID, physical network device information, and server node information) and initialize the obtained network configuration information into the address mapping table of the database. Specifically, the virtual machine lifecycle monitoring module 202 queries the address mapping table according to the obtained network configuration information to obtain the mapping relationship between the neighbor's MAC address and the IPv6 address. If there is no relevant mapping relationship in the address mapping table, the obtained network configuration information and the obtained mapping relationship are written into the address mapping table together. The server to which the virtual machine belongs will write the obtained address mapping relationship into the neighbor cache table to ensure that the neighbor cache table can contain the latest neighbor information. If there is already a relevant mapping relationship in the neighbor cache table, the existing old data will be deleted and then the obtained address mapping relationship will be written into the neighbor cache table to avoid duplicate data.

[0080] When the IPv6 address or MAC address of the virtual machine changes or the network card is replaced, the virtual machine management system will issue a corresponding instruction. After capturing the event, the virtual machine lifecycle monitoring module 202 will obtain the updated IPv6 address or MAC address in the virtual machine network configuration information, obtain the data item in the address mapping table according to the virtual machine ID, and update the updated data (IPv6 address or MAC address) to the address mapping table, and update the timestamp of the data item in the mapping table. The server to which the virtual machine belongs will clear the old address mapping relationship of the virtual machine in the neighbor cache table and write the mapping relationship between the new IPv6 address and MAC address of the virtual machine into the neighbor cache table.

[0081] When a virtual machine is deleted, the virtual machine management system will issue a virtual machine deletion instruction. After the virtual machine lifecycle monitoring module 202 captures the event, it will obtain the data item in the address mapping relationship table based on the virtual machine ID and set the timestamp of the data item related to the virtual machine to zero. Then, the neighbor cache table maintenance module 204 will periodically clear the relevant entries of the virtual machine address mapping relationship in the neighbor cache table of the server to which the virtual machine belongs.

[0082] When virtual machine migration occurs, the virtual machine management system will issue a virtual machine migration instruction. After capturing the event, the virtual machine lifecycle monitoring module 202 will obtain the server node information before and after the migration, and set the timestamp of the virtual machine address mapping related data item in the address mapping relationship table corresponding to the source server node (i.e., the server node before migration) to zero according to the ID of the virtual machine, while keeping the mapping relationship between the IPv6 address and the MAC address of the virtual machine in the address mapping relationship table unchanged. According to the server node information before and after the migration, the virtual machine address mapping related entries in the neighbor cache table of the source server node are migrated to the target server node (i.e., the server node after the migration). After the migration is completed, the neighbor cache table maintenance module 204 will clear the virtual machine address mapping related entries in the neighbor cache table of the source server node and write the address mapping relationship of the virtual machine into the neighbor cache table of the target server node in time to ensure that the virtual machine can communicate normally after the migration is completed to avoid network interruption and delay.

[0083] In the third step, the virtual machine address maintenance module 203 checks the data in the address mapping table according to the configuration parameters every 60 seconds.

[0084] The virtual machine address maintenance module 203 scans the address mapping table every 60 seconds to calculate the lifetime of the data items in the address mapping table according to the current scanning time, and sets the timestamp of the data items in the address mapping table whose lifetime exceeds the validity period of the entries in the neighbor cache table set in the configuration parameters to zero.

[0085] In the fourth step, the neighbor cache table maintenance module 204 reads data from the address mapping table every 30 seconds to update the neighbor cache table.

[0086] The neighbor cache table maintenance module 204 scans the data in the address mapping table every 30 seconds to treat the data items in the address mapping table whose timestamps are set to zero as invalid data (i.e., expired data) and the data items whose timestamps are not set to zero as valid data, delete the entries corresponding to the valid data in the neighbor cache table, clear the valid data in the address mapping table, and update the valid data to the neighbor cache table.

[0087] In step 5, the neighbor cache table maintenance module 204 writes the new data entry into the hot cache layer 401 of the neighbor cache table.

[0088] In step 6, the neighbor cache table maintenance module 204 moves the data entries with lower access frequency from the hot cache layer 401 to the cold cache layer 402 .

[0089] The virtual machine neighbor discovery method in the cluster environment described above is used to automatically update the address mapping table by real-time monitoring of the life cycle of the virtual machine and to timely maintain the neighbor cache table, which has the following advantages:

[0090] 1) Improve the system's response speed and processing capabilities and reduce unnecessary broadcast traffic by fine-tuning the management of the address mapping table and neighbor cache table.

[0091] 2) Ensure the accuracy and timeliness of the neighbor cache table: Improve the efficiency of neighbor discovery, directly solve the problem of low efficiency of neighbor discovery in large-scale cluster environments, avoid unnecessary neighbor address requests, repeated data parsing and cache occupation of virtual machines, improve the utilization of server resources such as CPU and memory, and enhance the overall performance and stability of the server.

[0092] 3) Improve virtual machine network performance: Reduce network delays caused by virtual machine network information changes and migrations, avoid virtual machine communication interruptions due to failure to update neighbor cache tables in a timely manner, reduce delays in the neighbor discovery process, ensure stable network connections for virtual machines in dynamically changing environments, and optimize the overall communication performance of virtual machines.

[0093] 4) Improve server stability: Avoid system crashes caused by a large number of concurrent neighbor discovery requests exceeding the server's processing capacity.

[0094] 5) By providing dynamic parameter configuration, the cache entry validity period, neighbor address table capacity limit, etc. can be dynamically adjusted based on server performance and network load to prevent the neighbor cache table from occupying too much server memory resources, causing performance degradation of virtual machines and servers.

[0095] Based on the above-mentioned virtual machine neighbor discovery method in a cluster environment, an embodiment of the present invention further provides a virtual machine neighbor discovery device in a cluster environment, see Figure 6 As shown, the device may include the following modules:

[0096] The adjustment module 602 is used to obtain performance parameters and network parameters of the cluster environment, and adjust cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters.

[0097] Update module 604 is used to update the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameters corresponding to the target virtual machine, and update the second target mapping relationship cached by the server corresponding to the target virtual machine based on the timestamp of the data contained in the first target mapping relationship.

[0098] The changing module 606 is used to change the first target mapping relationship and the second target mapping relationship respectively based on the life cycle event when a life cycle event of the target virtual machine occurs.

[0099] The acquisition module 608 is used to acquire the target IPv6 address of the neighbor of the target virtual machine when the target virtual machine needs to communicate with its neighbor, and acquire the target MAC address corresponding to the target IPv6 address based on the second target mapping relationship.

[0100] By adopting the virtual machine neighbor discovery device in the above-mentioned cluster environment, the server cache data of the neighbor address mapping relationship can be adjusted dynamically according to the performance of the cluster environment and the network to reduce the waste of cache resources. The neighbor address mapping relationship stored in the corresponding database and the neighbor address mapping relationship cached by the corresponding server can also be automatically changed when a life cycle event of the virtual machine occurs to realize real-time update of the neighbor address information, thereby facilitating the virtual machine to use its IPv6 address and the neighbor address mapping relationship cached by the corresponding server to quickly and accurately obtain the neighbor's MAC address for communication between the virtual machine and its neighbors. Compared with the broadcast method adopted by the traditional NDP, it can effectively reduce the data traffic required for neighbor discovery, improve the performance and stability of the virtual machine network, thereby alleviating the problems of low neighbor discovery efficiency, resource waste and network performance degradation existing in the traditional NDP in a large-scale cluster environment.

[0101] The above-mentioned change module 606 can also be used for: if the life cycle event includes the creation of a target virtual machine, then when creating the target virtual machine, the network configuration information of the target virtual machine is added to the first target mapping relationship, and an initial timestamp is set for the network configuration information, and then the network configuration information is added to the second target mapping relationship; wherein the network configuration information includes virtual machine ID, MAC address, IPv6 address, physical network device information and server information.

[0102] The change module 606 may also be configured to: if the lifecycle event includes deletion of the target virtual machine, then when the target virtual machine is deleted, set the timestamp of the data included in the first target mapping relationship to zero, and delete the second target mapping relationship.

[0103] The above-mentioned change module 606 can also be used for: if the life cycle event includes a change in the IPv6 address of the target virtual machine, then when the IPv6 address of the target virtual machine is changed, the first original mapping relationship between the IPv6 address before the change and its corresponding original MAC address is obtained from the first target mapping relationship based on the network configuration information, and the timestamp of the first original mapping relationship is set to zero, and then the first new mapping relationship between the changed IPv6 address and the original MAC address is added to the first target mapping relationship, and a first new timestamp is set for the first new mapping relationship, and then the data corresponding to the first original mapping relationship in the second target mapping relationship is deleted, and the first new mapping relationship is added to the second target mapping relationship; wherein the first new mapping relationship includes the changed IPv6 address, the original MAC address and the first new timestamp.

[0104] The above-mentioned change module 606 can also be used for: if the life cycle event includes a change in the MAC address of the target virtual machine, then when the MAC address of the target virtual machine is changed, a second original mapping relationship between the MAC address before the change and its corresponding original IPv6 address is obtained from the first target mapping relationship based on the network configuration information, and the timestamp of the second original mapping relationship is set to zero, and then a second new mapping relationship between the MAC address after the change and the original IPv6 address is added to the first target mapping relationship, and a second new timestamp is set for the second new mapping relationship, and then the data corresponding to the second original mapping relationship in the second target mapping relationship is deleted, and the second new mapping relationship is added to the second target mapping relationship; wherein the second new mapping relationship includes the original IPv6 address, the changed MAC address and the second new timestamp.

[0105] The above-mentioned change module 606 can also be used for: if the life cycle event includes the migration of the target virtual machine, then when migrating the target virtual machine, the pre-migration server information and the post-migration server information corresponding to the target virtual machine are used, and the timestamp of the data contained in the first target mapping relationship is set to zero, and then the second target mapping relationship is migrated from the pre-migration server to the post-migration server for caching based on the pre-migration server information and the post-migration server information, and a third new timestamp is set for the first target mapping relationship.

[0106] The above-mentioned cache parameters may include at least one of the following: the validity period of the cached data, the size of the cached data, and the number of concurrently processed cached data; the size of the cached data represents the maximum number of cached data entries supported by the server corresponding to the corresponding virtual machine, and the number of concurrently processed cached data represents the maximum number of concurrently processed data entries supported by the server corresponding to the corresponding virtual machine; based on this, the above-mentioned adjustment module 602 can also be used to: determine the load state of the cluster environment based on the performance parameters and the network parameters; if the cluster environment is in a high-load state, set the validity period of the cached data in the server corresponding to each virtual machine to a first duration, set the size of the cached data in the server corresponding to each virtual machine to a first scale, and set the number of concurrently processed cached data in the server corresponding to each virtual machine to a first number; if the cluster environment is in a low-load state, set the validity period of the cached data in the server corresponding to each virtual machine to a second duration, set the size of the cached data in the server corresponding to each virtual machine to a second scale, and set the number of concurrently processed cached data in the server corresponding to each virtual machine to a second number; wherein the second duration is greater than the first duration, the second scale is greater than the first scale, and the second number is greater than the first number.

[0107] The server corresponding to each virtual machine can be provided with a corresponding hot cache area and a cold cache area, and the cache capacity of the hot cache area in the same server is smaller than the cache capacity of the cold cache area; based on this, the server corresponding to each virtual machine can be used to: count the access frequency of each data entry in the cached mapping relationship within a preset time period, and divide the data entries contained in the cached mapping relationship into first category entries and second category entries according to the access frequency; wherein the access frequency of the first category entries exceeds the preset frequency threshold, and the access frequency of the second category entries does not exceed the preset frequency threshold; cache the first category entries to the hot cache area, and cache the second category entries to the cold cache area; if the number of data entries currently cached reaches the scale of the current cached data, use the LRU algorithm to process the data entries currently cached so that the number of data entries currently cached is less than the scale of the current cached data.

[0108] The updating module 604 may also be used to: scan the first target mapping relationship according to a preset first period, so as to update the timestamp of the data included in the first target mapping relationship based on the scanning time and the cache parameter corresponding to the target virtual machine.

[0109] The updating module 604 may also be used to: scan the first target mapping relationship according to a preset second period, classify the data included in the first target mapping relationship according to the timestamp, and update the second target mapping relationship based on the classification result.

[0110] The update module 604 can also be used to: divide the data contained in the first target mapping relationship into invalid data with a timestamp of zero and / or valid data with a timestamp not zero according to the timestamp; if the first target mapping relationship contains invalid data, delete the data corresponding to the invalid data in the second target mapping relationship.

[0111] See also Figure 6 As shown, the device may also include:

[0112] The concurrent access module 610 is used to use a distributed lock mechanism to perform concurrent access to the first target mapping relationship stored in the target virtual machine when concurrently accessing the first target mapping relationship.

[0113] The implementation principle and technical effects of the virtual machine neighbor discovery device in a cluster environment provided in the embodiment of the present invention are the same as those of the aforementioned virtual machine neighbor discovery method embodiment in the cluster environment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding contents in the aforementioned method embodiment.

[0114] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present invention.

[0115] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that can be executed by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.

[0116] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0117] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for discovering neighbors of virtual machines in a cluster environment, characterized in that: Each virtual machine in the cluster environment has a corresponding database and server, each virtual machine stores a mapping relationship between an IPv6 address and a MAC address corresponding to a corresponding neighbor through its corresponding database, and each virtual machine caches the corresponding mapping relationship through its corresponding server; the method includes: Acquire performance parameters and network parameters of the cluster environment, and adjust cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters; Based on the cache parameters corresponding to the target virtual machine, the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine is updated, and based on the timestamp of the data contained in the first target mapping relationship, the second target mapping relationship cached by the server corresponding to the target virtual machine is updated; When a life cycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are respectively changed based on the life cycle event; wherein the life cycle event includes creation, deletion, address change, network card replacement and migration of the target virtual machine; When the target virtual machine needs to communicate with its neighbor, obtain the target IPv6 address of the neighbor of the target virtual machine, and obtain the target MAC address corresponding to the target IPv6 address based on the second target mapping relationship; If the lifecycle event includes the creation of a target virtual machine, then when the lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are respectively changed based on the lifecycle event, including: when creating the target virtual machine, adding the network configuration information of the target virtual machine to the first target mapping relationship, setting an initial timestamp for the network configuration information, and then adding the network configuration information to the second target mapping relationship; wherein the network configuration information includes a virtual machine ID, a MAC address, an IPv6 address, physical network device information, and server information; If the lifecycle event includes deletion of the target virtual machine, respectively changing the first target mapping relationship and the second target mapping relationship based on the lifecycle event, including: when deleting the target virtual machine, setting the timestamp of the data included in the first target mapping relationship to zero, and deleting the second target mapping relationship; If the lifecycle event includes a change in the IPv6 address of the target virtual machine, then the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event, including: when changing the IPv6 address of the target virtual machine, obtaining the first original mapping relationship between the IPv6 address before the change and its corresponding original MAC address from the first target mapping relationship based on the network configuration information, and setting the timestamp of the first original mapping relationship to zero, then adding the first new mapping relationship between the changed IPv6 address and the original MAC address to the first target mapping relationship, and setting a first new timestamp for the first new mapping relationship, then deleting the data corresponding to the first original mapping relationship in the second target mapping relationship, and adding the first new mapping relationship to the second target mapping relationship; wherein the first new mapping relationship includes the changed IPv6 address, the original MAC address and the first new timestamp; If the lifecycle event includes a change in the MAC address of the target virtual machine, then the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event, including: when changing the MAC address of the target virtual machine, obtaining the second original mapping relationship between the MAC address before the change and its corresponding original IPv6 address from the first target mapping relationship based on the network configuration information, and setting the timestamp of the second original mapping relationship to zero, then adding the second new mapping relationship between the changed MAC address and the original IPv6 address to the first target mapping relationship, and setting a second new timestamp for the second new mapping relationship, then deleting the data corresponding to the second original mapping relationship in the second target mapping relationship, and adding the second new mapping relationship to the second target mapping relationship; wherein the second new mapping relationship includes the original IPv6 address, the changed MAC address and the second new timestamp; If the lifecycle event includes the migration of the target virtual machine, then when the lifecycle event of the target virtual machine occurs, the first target mapping relationship and the second target mapping relationship are changed respectively based on the lifecycle event, including: when migrating the target virtual machine, the pre-migration server information and the post-migration server information corresponding to the target virtual machine, and setting the timestamp of the data contained in the first target mapping relationship to zero, and then migrating the second target mapping relationship from the pre-migration server to the post-migration server for caching based on the pre-migration server information and the post-migration server information, and setting a third new timestamp for the first target mapping relationship.

2. The method according to claim 1, characterized in that The cache parameters include at least one of the following: validity period of cached data, size of cached data, and concurrent processing quantity of cached data; the size of cached data represents the maximum number of cached data entries supported by the server corresponding to the corresponding virtual machine, and the concurrent processing quantity of cached data represents the maximum number of concurrently processed data entries supported by the server corresponding to the corresponding virtual machine; Adjusting cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameter and the network parameter includes: Determining a load state of a cluster environment based on the performance parameter and the network parameter; If the cluster environment is in a high-load state, the validity period of the cached data in the server corresponding to each virtual machine is set to a first duration, the scale of the cached data in the server corresponding to each virtual machine is set to a first scale, and the number of concurrently processed cached data in the server corresponding to each virtual machine is set to a first number; If the cluster environment is in a low-load state, the validity period of the cached data in the server corresponding to each virtual machine is set to the second duration, the scale of the cached data in the server corresponding to each virtual machine is set to the second scale, and the concurrent processing quantity of the cached data in the server corresponding to each virtual machine is set to the second quantity; Among them, the second duration is greater than the first duration, the second scale is greater than the first scale, and the second number is greater than the first number.

3. The method according to claim 1, characterized in that: The server corresponding to each virtual machine is respectively provided with a corresponding hot cache area and a cold cache area, and the cache capacity of the hot cache area in the same server is smaller than the cache capacity of the cold cache area; For each virtual machine corresponding to the server, the mapping relationship cache includes: Counting the access frequency of each data entry in the cached mapping relationship within a preset time period, and dividing the data entries contained in the cached mapping relationship into first-category entries and second-category entries according to the access frequency; wherein the access frequency of the first-category entries exceeds a preset frequency threshold, and the access frequency of the second-category entries does not exceed the preset frequency threshold; Cache the first type of entries into a hot cache area, and cache the second type of entries into a cold cache area; If the number of data entries in the current cache reaches the size of the current cache data, the LRU algorithm is used to process the data entries in the current cache so that the number of data entries in the current cache is smaller than the size of the current cache data.

4. The method according to claim 1, characterized in that: Updating the timestamp of the data included in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameter corresponding to the target virtual machine includes: Scanning the first target mapping relationship according to a preset first period to update the timestamp of the data included in the first target mapping relationship based on the scanning time and the cache parameter corresponding to the target virtual machine; Updating a second target mapping relationship cached by a server corresponding to the target virtual machine based on the timestamp of the data included in the first target mapping relationship includes: The first target mapping relationship is scanned according to a preset second period to classify the data included in the first target mapping relationship according to the timestamp and update the second target mapping relationship based on the classification result.

5. The method according to claim 4, characterized in that Classifying the data included in the first target mapping relationship according to the timestamp and updating the second target mapping relationship based on the classification result, including: According to the timestamp, the data included in the first target mapping relationship is divided into invalid data with a timestamp of zero and / or valid data with a timestamp of non-zero; If the first target mapping relationship includes invalid data, the data corresponding to the invalid data in the second target mapping relationship is deleted.

6. The method according to claim 1, characterized in that The method further comprises: When concurrently accessing the first target mapping relationship stored in the target virtual machine, a distributed lock mechanism is used to perform concurrent access to the first target mapping relationship.

7. A virtual machine neighbor discovery device in a cluster environment, characterized in that: Each virtual machine in the cluster environment has a corresponding database and server, each virtual machine stores the mapping relationship between the IPv6 address and the MAC address corresponding to the corresponding neighbor through its corresponding database, and each virtual machine caches the corresponding mapping relationship through its corresponding server; the device includes: An adjustment module, used to obtain performance parameters and network parameters of the cluster environment, and adjust cache parameters of the server cache mapping relationship corresponding to each virtual machine based on the performance parameters and the network parameters; An updating module, configured to update the timestamp of the data contained in the first target mapping relationship stored in the database corresponding to the target virtual machine based on the cache parameters corresponding to the target virtual machine, and to update the second target mapping relationship cached in the server corresponding to the target virtual machine based on the timestamp of the data contained in the first target mapping relationship; A change module, used for changing the first target mapping relationship and the second target mapping relationship respectively based on the life cycle event when a life cycle event of the target virtual machine occurs; wherein the life cycle event includes creation, deletion, address change, network card replacement and migration of the target virtual machine; An acquisition module, used for acquiring a target IPv6 address of a neighbor of the target virtual machine when the target virtual machine needs to communicate with its neighbor, and acquiring a target MAC address corresponding to the target IPv6 address based on a second target mapping relationship; The change module is further used for: if the life cycle event includes the creation of a target virtual machine, then when creating the target virtual machine, adding the network configuration information of the target virtual machine to the first target mapping relationship, setting an initial timestamp for the network configuration information, and then adding the network configuration information to the second target mapping relationship; wherein the network configuration information includes a virtual machine ID, a MAC address, an IPv6 address, physical network device information, and server information; The change module is further used for: if the lifecycle event includes the deletion of the target virtual machine, then when the target virtual machine is deleted, setting the timestamp of the data included in the first target mapping relationship to zero, and deleting the second target mapping relationship; The change module is also used for: if the life cycle event includes a change in the IPv6 address of the target virtual machine, then when the IPv6 address of the target virtual machine is changed, a first original mapping relationship between the IPv6 address before the change and its corresponding original MAC address is obtained from the first target mapping relationship based on the network configuration information, and the timestamp of the first original mapping relationship is set to zero, and then a first new mapping relationship between the IPv6 address after the change and the original MAC address is added to the first target mapping relationship, and a first new timestamp is set for the first new mapping relationship, and then the data corresponding to the first original mapping relationship in the second target mapping relationship is deleted, and the first new mapping relationship is added to the second target mapping relationship; wherein the first new mapping relationship includes the IPv6 address after the change, the original MAC address and the first new timestamp; The change module is also used for: if the life cycle event includes a change in the MAC address of the target virtual machine, then when the MAC address of the target virtual machine is changed, a second original mapping relationship between the MAC address before the change and its corresponding original IPv6 address is obtained from the first target mapping relationship based on the network configuration information, and the timestamp of the second original mapping relationship is set to zero, and then a second new mapping relationship between the MAC address after the change and the original IPv6 address is added to the first target mapping relationship, and a second new timestamp is set for the second new mapping relationship, and then the data corresponding to the second original mapping relationship in the second target mapping relationship is deleted, and the second new mapping relationship is added to the second target mapping relationship; wherein the second new mapping relationship includes the original IPv6 address, the MAC address after the change, and the second new timestamp; The change module is also used for: if the lifecycle event includes the migration of the target virtual machine, then when migrating the target virtual machine, the pre-migration server information and the post-migration server information corresponding to the target virtual machine are used, and the timestamp of the data contained in the first target mapping relationship is set to zero; then, based on the pre-migration server information and the post-migration server information, the second target mapping relationship is migrated from the pre-migration server to the post-migration server for caching, and a third new timestamp is set for the first target mapping relationship.

8. The device according to claim 7, characterized in that The update module is also used for: Scanning the first target mapping relationship according to a preset first period to update the timestamp of the data included in the first target mapping relationship based on the scanning time and the cache parameter corresponding to the target virtual machine; The first target mapping relationship is scanned according to a preset second period to classify the data included in the first target mapping relationship according to the timestamp and update the second target mapping relationship based on the classification result.

Citation Information

Patent Citations

  • Method for processing virtual machine cluster and computer system

    CN106302569A

  • Time sequence database cluster and fault processing and operating method and device thereof

    CN113778761A