Memory adjustment method, switch, storage medium and electronic equipment
By introducing load type identification module and memory dynamic scheduling module in CXL switches, dynamically adjusting the memory resources of the host, solving the problem of lack of targeted resource allocation in the existing technology, and improving the utilization rate and allocation efficiency of memory resources.
Patent Information
- Application Number
- CN202411899230.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-08
AI Technical Summary
Existing CXL switches cannot automatically distinguish the load type of the host, and lack dynamic identification and adjustment mechanisms for memory data access frequency, resulting in a lack of targeted resource allocation strategies and it is difficult to optimize resource allocation, especially in high concurrency and multi-task operation environments.
By introducing a load type identification module and a memory dynamic scheduling module into the switch, the workload type of the target host is determined and memory adjustment operations are performed according to this type, including adding memory devices or migrating data, to improve the allocation efficiency and utilization of memory resources.
Dynamic adjustment of memory devices is realized, the allocation efficiency and utilization of memory resources are improved, and the problem of low memory resource allocation efficiency is solved due to the inability to dynamically adjust the host.
Smart Images

Figure CN119781975A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a memory adjustment method, a switch, a storage medium, and an electronic device. Background Art
[0002] With the rapid development of next-generation interconnection technology, the performance bottleneck of computing systems has gradually shifted from computing power to memory access and data transmission efficiency. Computer memory architecture is evolving towards higher performance, larger capacity and lower latency. In recent years, memory expansion technology based on Compute Express Link (CXL) has become the focus of the industry. CXL technology provides a flexible memory connection method, allowing the host to connect to a multi-layer memory architecture through a CXL switch, including high-performance low-latency memory and high-capacity high-latency memory.
[0003] Although CXL technology provides a new means for memory management, current CXL switches are usually unable to automatically distinguish the load type of the host computer, and lack a dynamic identification and adjustment mechanism for the frequency of memory data access, resulting in a lack of pertinence in resource allocation strategies and difficulty in optimizing resource allocation according to actual application scenarios. This defect is particularly evident in high-concurrency, multi-tasking environments, which can lead to low memory resource utilization and system performance fluctuations. In addition, existing CXL switches lack dynamic perception and optimization of memory bandwidth bottlenecks. The allocation of memory bandwidth resources is usually static. When bandwidth becomes a performance bottleneck, it is impossible to provide greater bandwidth resource support for critical tasks through dynamic adjustment strategies.
[0004] In view of the problem in the related art that the host memory cannot be adjusted dynamically, resulting in low efficiency in memory resource allocation, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a memory adjustment method, a switch, a storage medium, and an electronic device to at least solve the problem that the memory adjustment operation cannot be dynamically performed on the host, resulting in low efficiency in memory resource allocation.
[0006] According to an embodiment of the present application, a memory adjustment method is provided, which is applied to a switch, wherein the switch is used to realize a communication connection between a host and a memory device in a memory pool; comprising: determining a workload type of a target host to obtain a target workload type, wherein the workload type comprises: a first workload type and / or a second workload type, and when the target host operates in a working mode of the first workload type and a communication delay is lower than a preset delay, a ratio of a change amplitude of the workload of the target host to a change amplitude of the communication delay is greater than a first preset threshold, and when the target host operates in a working mode of the second workload type and a communication bandwidth is lower than a preset bandwidth, a ratio of a change amplitude of the workload of the target host to a change amplitude of the communication bandwidth is greater than a second preset threshold; the host comprises the target host; and performing a memory adjustment operation on the target host according to the target workload type, wherein the memory adjustment operation comprises: adding a memory device to the target host, and / or migrating data in the memory device allocated to the target host.
[0007] In an exemplary embodiment, determining the workload type of the target host to obtain the target workload type includes: determining the number of times the target host accesses the memory pool within a first preset time to obtain a target number of times; determining the access frequency of the target host accessing the memory pool according to the target number of times and the first preset time; and determining the amount of data accessed by the target host to the memory pool for read and write operations within a second preset time to obtain a target data amount; determining the actual bandwidth of the target host within the second preset time according to the target data amount; determining the ratio of the actual bandwidth of the target host to the bandwidth allowed to be used by the target host to obtain a target ratio; and determining the target ratio of the actual bandwidth of the target host to the bandwidth allowed to be used by the target host when the target host accesses the memory pool. When the access frequency of the memory pool is greater than or equal to the third preset threshold and the target ratio is less than the fourth preset threshold, the target workload type is determined to be the first workload type; when the access frequency of the target host accessing the memory pool is less than the third preset threshold and the target ratio is greater than or equal to the fourth preset threshold, the target workload type is determined to be the second second workload type; when the access frequency of the target host accessing the memory pool is greater than or equal to the third preset threshold and the target ratio is greater than or equal to the fourth preset threshold, the target workload type is determined to be the first workload type and the second second workload type.
[0008] In an exemplary embodiment, performing a memory adjustment operation on the target host according to the target workload type includes: when the target workload type is the first workload type, determining N memory devices allocated to the target host; transferring first data in the first memory device to the second memory device, and transferring second data in the second memory device to the first memory device; wherein the first memory device is a memory device among the N memory devices whose delay is greater than or equal to a fifth preset threshold, the second memory device is a memory device among the N memory devices whose delay is less than the fifth preset threshold, the first data is data used by the target host with a usage frequency greater than or equal to a sixth preset threshold, the second data is data used by the target host with a usage frequency less than the sixth preset threshold, and N is an integer greater than or equal to 1; when the target workload type is the second workload type, In the case of the target workload type, reallocate M memory devices to the target host, wherein the sum of the bandwidth allowed to be used by the target host in the M memory devices and the bandwidth allowed to be used by the target host in the N memory devices meets the bandwidth requirement of the target host, and M is an integer greater than or equal to 1; in the case where the target workload type is the first workload type and the second workload type, reallocate M memory devices to the target host; transfer the first data in the third memory device to the fourth memory device, and transfer the second data in the fourth memory device to the third memory device; wherein the third memory device is a memory device among the N+M memory devices whose delay is greater than or equal to the fifth preset threshold, and the fourth memory device is a memory device among the N+M memory devices whose delay is less than the fifth preset threshold; the N+M memory devices include the N memory devices and the M memory devices.
[0009] In an exemplary embodiment, the method also includes: determining the first data and the second data in the memory device in the following manner: when there are P memory pages in the memory device, determining the data in the memory pages whose mark values are less than a seventh preset threshold among the P memory pages as the first data, and determining the data in the memory pages whose mark values are greater than or equal to the seventh preset threshold among the P memory pages as the second data, where P is an integer greater than or equal to 1; wherein, when the target memory page in the memory device is accessed by the target host, the mark value of the target memory page is updated to zero, and when the target memory page is not accessed by the target host within a third preset time, the mark value of the target memory page is increased by one, and the seventh preset threshold is greater than zero.
[0010] In an exemplary embodiment, the method further includes: determining a target file, wherein the target file records the latency and bandwidth information of all memory devices in the memory pool; determining the latency of each of the N devices from the target file; and reallocating M memory devices to the target host, including: reallocating M memory devices to the target host based on the target file.
[0011] In an exemplary embodiment, the method further includes: upon obtaining a first request sent by a target memory device, sending a second request to the target memory device and recording a first time of sending the second request, wherein the first request is a request sent by the target memory device after joining the memory pool; upon obtaining response information sent by the target memory device in response to the second request, recording a second time of receiving the response information; determining a delay of the target memory device according to the first time and the second time; and upon obtaining the first request sent by the target memory device, performing a bandwidth stress test on the target memory device to obtain a target bandwidth; determining the minimum value of the target bandwidth and a preset bandwidth as the bandwidth of the target memory device, wherein the preset bandwidth is determined according to the topology of the switch; and recording the delay and bandwidth of the target memory device in a target file, wherein the target file records the delay and bandwidth information of all memory devices in the memory pool.
[0012] In an exemplary embodiment, before determining the workload type of the target host and obtaining the target workload type, the method also includes: obtaining a target configuration file, wherein the target configuration file records memory devices corresponding to different hosts; and allocating memory devices to the target host according to the target configuration file.
[0013] According to another embodiment of the embodiment of the present application, a switch is further provided, characterized in that the switch is used to realize a communication connection between a host and a memory device in a memory pool; comprising: a load type identification module, used to determine the workload type of a target host and obtain a target workload type, wherein the workload type comprises: a first workload type and / or a second workload type, and when the target host operates in a working mode of the first workload type and the communication delay is lower than a preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, and when the target host operates in a working mode of the second workload type and the communication bandwidth is lower than a preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host comprises the target host; a memory dynamic scheduling module, used to perform a memory adjustment operation on the target host according to the target workload type, wherein the memory adjustment operation comprises: adding a memory device to the target host, and / or migrating data in the memory device allocated to the target host.
[0014] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0015] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] According to another embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0017] Through the present application, the target host is determined to be of the first workload type and / or the second workload type, so that according to the workload type of the target host, a memory device is added to the target host, and / or the data in the memory device allocated to the target host is migrated, thereby realizing dynamic adjustment of the memory device, improving the allocation efficiency and utilization of memory resources, and further solving the problem of low memory resource allocation efficiency due to the inability to dynamically perform memory adjustment operations on the host. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 It is a hardware structure block diagram of a server device according to a memory adjustment method of an embodiment of the present application;
[0020] Figure 2 is a schematic diagram of an optional switch architecture according to an embodiment of the present application;
[0021] Figure 3 is a flow chart of a memory adjustment method according to an embodiment of the present application;
[0022] Figure 4 is a schematic diagram of an optional switch architecture for implementing the present application according to an embodiment of the present application;
[0023] Figure 5 is a schematic diagram of an optional overall memory adjustment process according to an embodiment of the present application;
[0024] Figure 6 is a schematic diagram of an optional process of recording the latency and bandwidth of a memory device according to an embodiment of the present application;
[0025] Figure 7 is a structural block diagram of a switch according to an embodiment of the present application;
[0026] Figure 8 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0029] The memory adjustment method embodiment provided in the embodiment of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a memory adjustment method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor (Microprocessor Unit, abbreviated as MPU) MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0030] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the memory adjustment method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] In order to better understand the present application, the architecture of the CXL switch is described below. Figure 2 As shown:
[0033] In the existing CXL switch system, the CXL protocol is usually used to implement the hardware link between the CXL memory pools and allocate the pooled memory to the host computer. The design of the CXL switch system in the prior art is relatively basic and usually includes the following two components, namely Figure 2The CXL topology module in it: as a key component for connecting different devices, it allows multiple CXL memory devices to be fully or partially interconnected with multiple host computers, increasing the scalability and flexibility of system memory; and the memory static management module: includes some basic memory management functions, such as static memory allocation and recycling, memory hot swapping, etc.
[0034] but Figure 2 The architecture still has the following defects:
[0035] 1. Limitations of memory management: Memory management systems in existing technologies usually lack the ability to perceive memory heat and cannot dynamically schedule memory based on its usage frequency and importance.
[0036] 2. Lack of adaptive scheduling: Memory migration and scheduling strategies are usually based on static allocation rather than dynamic adjustment. There is a lack of dynamic memory scheduling strategies. In addition, it is impossible to optimize memory resource allocation according to workload characteristics, which may lead to low resource utilization, especially when processing different workloads.
[0037] 3. Scalability limitation: As the system scale expands, the existing CXL switch system may face the problem of link growth, resulting in different CXL memory device delays. Ignoring this aspect will reduce the stability of system application performance, resulting in resource redundancy;
[0038] 4. Cost efficiency: Due to the lack of optimized memory management and scheduling mechanisms, existing technologies may result in high total cost of ownership, especially when large-scale deployment is required.
[0039] In order to solve the above problems existing in the related art, a memory adjustment method is provided in this embodiment, which is applied to a switch, and the switch is used to realize the communication connection between the host and the memory devices in the memory pool, such as Figure 3 As shown, the process includes the following steps S302-S304:
[0040] Step S302: Determine the workload type of the target host and obtain the target workload type, wherein the workload type includes: a first workload type and / or a second workload type, when the target host operates in the working mode of the first workload type and the communication delay is lower than the preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, when the target host operates in the working mode of the second workload type and the communication bandwidth is lower than the preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host includes the target host;
[0041] Optionally, the first workload type is a latency-sensitive workload, and the second workload type is a bandwidth-sensitive workload.
[0042] It should be noted that latency-sensitive workloads are very sensitive to network latency (the time required for data to travel from the sender to the receiver). Such hosts require fast response times and real-time performance to ensure user experience and service quality, while hosts with bandwidth-sensitive workloads have high requirements for network bandwidth and usually require large amounts of data transmission to ensure high-quality content and services. In addition, some hosts may have both latency-sensitive and bandwidth-sensitive workloads, and network performance needs to be considered comprehensively to meet different needs.
[0043] Optionally, in step S302, the switch first needs to monitor and analyze the operating status of the target host, and determine whether the current host is running the first workload type (delay-sensitive) or the second workload type (bandwidth-sensitive) by collecting and processing workload-related information.
[0044] It should be noted that if Figure 4 As shown, there may be multiple hosts (Host), including the target host.
[0045] It should be noted that, through the accurate identification of step S302, the switch can accurately determine the current workload characteristics of the target host, providing key information for subsequent resource optimization and scheduling. By real-time monitoring of changes in host load types, the lag in resource allocation is avoided, providing a basis for resource adjustment in subsequent steps, ensuring that resources can be optimally allocated according to the characteristics of the load, thereby improving the overall performance and efficiency of the system.
[0046] Step S304: performing a memory adjustment operation on the target host according to the target workload type, wherein the memory adjustment operation includes: adding a memory device to the target host, and / or migrating data in the memory device allocated to the target host.
[0047] Optionally, when the workload type of the target host is the first workload type, the switch will migrate the data in the memory device allocated to the target host; when the workload type of the target host is the second workload type, the switch will add a memory device to the target host; when the workload type of the target host is both the first workload type and the second workload type, the switch will add a memory device to the target host and then migrate the data in the memory device allocated to the target host.
[0048] It should be noted that adding additional memory devices to the host of the second workload type can meet high bandwidth requirements and increase data processing speed. Migrating data to the host of the first workload type can reduce communication delays and improve data access efficiency.
[0049] It should be noted that through the above steps, real-time monitoring and dynamic adjustment of memory devices can flexibly respond to load changes, avoid waste of resources, ensure efficient use of memory resources, and enhance the system's adaptability to different application scenarios. Whether it is high-performance computing, big data processing or real-time communication, it can provide optimized resource support, thereby significantly improving the overall performance and economic efficiency of the system.
[0050] The above steps determine that the target host is of the first workload type and / or the second workload type, and thereby add memory devices to the target host according to the workload type of the target host, and / or migrate the data in the memory devices allocated to the target host, thereby realizing dynamic adjustment of the memory devices, improving the allocation efficiency and utilization of memory resources, and further solving the problem of low memory resource allocation efficiency due to the inability to dynamically perform memory adjustment operations on the host.
[0051] In an exemplary embodiment, determining the workload type of the target host and obtaining the target workload type may be implemented by following steps S11 to S15, wherein steps S11 and S12 are not performed in any particular order:
[0052] Step S11: determining the number of times the target host accesses the memory pool within a first preset time to obtain a target number of times; determining the access frequency of the target host accessing the memory pool according to the target number of times and the first preset time;
[0053] Alternatively, if Figure 4 As shown, there are multiple hosts (including the target host) in the system. The hosts access the memory pool through the CXL topology module. There are multiple memory devices in the memory pool. Each host is allocated a memory device. Among them, different hosts may use the same memory device at the same time, and there may be idle memory devices (that is, the memory device does not provide memory usage function for any host).
[0054] Optionally, in step S11, the switch monitors the number of times the target host accesses the memory pool within a first preset time (e.g., 500 milliseconds) to obtain a target number of times. Then, the access frequency of the target host accessing the memory pool is calculated based on the target number of times and the first preset time. This frequency reflects the density of the host's access to the memory pool. The higher the access frequency, the more frequent the host's need to access the memory, which may be one of the characteristics of a delay-sensitive load.
[0055] It should be noted that step S11 can quantify the access demand, that is, the host's memory access demand within a specific time can be accurately understood, providing an objective basis for subsequent load type judgment. A high access frequency means that the host has a high requirement for fast response, which helps to identify whether the host is the first workload type.
[0056] Step S12: determining the amount of data accessed by the target host to the memory pool for read and write operations within the second preset time to obtain a target data amount; determining the actual bandwidth of the target host according to the target data amount within the second preset time; determining the ratio of the actual bandwidth of the target host to the bandwidth allowed to be used by the target host to obtain a target ratio;
[0057] Optionally, by monitoring the amount of memory (i.e., target data amount) read and written by the target host through the CXL topology module into the memory pool within a second preset time (e.g., 1 second), the memory bandwidth required by the target host (i.e., the actual bandwidth of the target host) is determined by the following formula:
[0058] B = M / T;
[0059] Among them, B1 is the actual bandwidth of the target host, M is the target data volume, and T is the second preset time.
[0060] Optionally, the target ratio is determined by the following formula:
[0061] C = B1 / B2;
[0062] Among them, C is the target ratio, B1 is the actual bandwidth of the target host, and B2 is the bandwidth allowed to be used by the target host.
[0063] Alternatively, assume that there are only host a and host b in the system, where host a is the target host and host b has a higher priority than target host a (i.e., the switch preferentially allocates memory devices to host b). Target host a is using three memory devices in the memory pool, which are S a , S b , S c , the sum of the bandwidths of the three memory devices is B all When host b does not use the three memory devices, the bandwidth B2 allowed to be used by target host a is the sum of the bandwidths of the three memory devices B all , that is, B2=B all ; When host B uses the bandwidth of the three memory devices at the same time, and a total of B a +B b +B c Bandwidth (B a S used by host b a The bandwidth, B bS used by host b b The bandwidth, B c S used by host b c The bandwidth, B a +B b +B c Less than B all ), the bandwidth B2 allowed to be used by the target host a is the remaining bandwidth after the three memory devices provide bandwidth for the host b, that is, at this time B2 = B all -(Ba+Bb+Bc).
[0064] Optionally, a memory pool allocation table is created to calculate the total bandwidth of the memory pool that can be theoretically used by the target host (that is, the bandwidth that the target host is allowed to use).
[0065] It should be noted that by accurately calculating the actual bandwidth requirements of the target host, data support is provided for subsequent resource allocation decisions.
[0066] Step S13: when the access frequency of the target host accessing the memory pool is greater than or equal to a third preset threshold, and the target ratio is less than a fourth preset threshold, determining that the target workload type is the first workload type;
[0067] Optionally, when the target host's access frequency to the memory pool reaches or exceeds a third preset threshold (e.g., the access frequency exceeds 1000 times per second), and the target ratio is less than a fourth preset threshold (e.g., the target ratio is less than 95%), the switch determines that the workload type of the target host is the first workload type (delay-sensitive). This means that the host has a high latency requirement for memory access, but there is still room for bandwidth resources, so the system will focus more on reducing latency.
[0068] It should be noted that by identifying delay-sensitive loads, the switch can give priority to reducing delays and improving data processing speeds. At the same time, it will not blindly allocate more bandwidth resources before the bandwidth reaches a bottleneck, thereby maintaining efficient use of resources.
[0069] Step S14: when the access frequency of the target host to the memory pool is less than the third preset threshold, and the target ratio is greater than or equal to the fourth preset threshold, determining that the target workload type is the second workload type;
[0070] Optionally, when the target host's access frequency to the memory pool is lower than the third preset threshold, and the target ratio is greater than or equal to the fourth preset threshold (for example, the above C is greater than or equal to 95%), the switch determines that the target workload type is the second workload type (bandwidth sensitive). This indicates that the host has a high bandwidth demand and a relatively high tolerance for delay.
[0071] It should be noted that after identifying the target host as a bandwidth-sensitive load, the switch will focus on increasing its bandwidth to meet high data transmission requirements. At the same time, since the target host is less sensitive to delay, the switch can appropriately relax the delay requirements when optimizing bandwidth to achieve reasonable allocation of resources.
[0072] Step S15: When the access frequency of the target host to the memory pool is greater than or equal to the third preset threshold, and the target ratio is greater than or equal to the fourth preset threshold, determine that the target workload type is the first workload type and the second workload type.
[0073] It should be noted that if the access frequency of the target host to the memory pool reaches or exceeds the third preset threshold, and the target ratio also reaches or exceeds the fourth preset threshold, this means that the host is subject to both high latency and high bandwidth requirements, and the workload type is both the first workload type and the second workload type (latency sensitive and bandwidth sensitive). At this time, the switch needs to optimize latency and bandwidth resources for the target host at the same time.
[0074] It should be noted that by executing steps S11 to S15, the workload type of the target host can be accurately determined, and according to different load characteristics, refined management and optimization of memory resources can be achieved, effectively improving the overall performance of the system, resource utilization efficiency and adaptability to changing workloads.
[0075] In an exemplary embodiment, the performing of the memory adjustment operation on the target host according to the target workload type may be implemented by the following steps S21 to S23, wherein step S21, step S22 and step S23 are steps performed in different situations:
[0076] Step S21: when the target workload type is the first workload type, determine N memory devices allocated to the target host; transfer the first data in the first memory device to the second memory device, and transfer the second data in the second memory device to the first memory device; wherein the first memory device is a memory device among the N memory devices whose delay is greater than or equal to a fifth preset threshold, the second memory device is a memory device among the N memory devices whose delay is less than the fifth preset threshold, the first data is data used by the target host with a usage frequency greater than or equal to a sixth preset threshold, the second data is data used by the target host with a usage frequency less than the sixth preset threshold, and N is an integer greater than or equal to 1;
[0077] It should be noted that the first memory device is a memory device with a delay greater than or equal to the fifth preset threshold among the N memory devices, indicating that the first memory device is a high-latency memory device among the N memory devices, and the second memory device is a memory device with a delay less than the fifth preset threshold among the N memory devices, indicating that the second memory device is a low-latency memory device among the N memory devices. The first data is data used by the target host with a usage frequency greater than or equal to the sixth preset threshold, and the first data can be identified as hot data. The second data is data used by the target host with a usage frequency less than the sixth preset threshold, and the second data can be identified as cold data.
[0078] Optionally, when the workload type of the target host is the first workload type, hot data in a high-latency memory device among the N memory devices of the target host can be transferred to a low-latency memory device among the N memory devices, and cold data in the low-latency memory device can be transferred to a high-latency memory device among the N memory devices.
[0079] It should be noted that by migrating hot data to low-latency memory devices, data access latency can be reduced and processing efficiency can be improved. Cold data is migrated to high-latency devices to avoid occupying valuable low-latency resources and improve overall resource utilization efficiency.
[0080] Optionally, a migration amount threshold is preset, that is, when the size of cold data of a low-latency memory device or hot data of a high-latency memory device exceeds the migration amount threshold, the memory dynamic scheduling module is designed with a direct memory access (Direct MemoryAccesS, abbreviated as DMA) controller, which will perform batch migration (i.e. transfer) of memory data between devices, but when the size of cold data of a low-latency memory device or hot data of a high-latency memory device does not reach the migration amount threshold, the data will not be transferred until the size of cold data of a low-latency memory device or hot data of a high-latency memory device exceeds the migration amount threshold.
[0081] Step S22: when the target workload type is the second workload type, reallocate M memory devices to the target host, wherein the sum of the bandwidth of the M memory devices allowed to be used by the target host and the bandwidth of the N memory devices allowed to be used by the target host meets the bandwidth demand of the target host, and M is an integer greater than or equal to 1;
[0082] Optionally, the system reallocates M memory devices to the target host, and the newly allocated M memory devices are combined with the original N memory devices to ensure that the bandwidth demand of the target host is met.
[0083] It should be noted that by adding memory devices to the target host, more bandwidth is provided to meet high data transmission requirements and improve data processing speed and system throughput.
[0084] Step S23: When the target workload type is the first workload type and the second workload type, reallocate M memory devices for the target host; transfer the first data in the third memory device to the fourth memory device, and transfer the second data in the fourth memory device to the third memory device; wherein the third memory device is a memory device among the N+M memory devices whose delay is greater than or equal to the fifth preset threshold, and the fourth memory device is a memory device among the N+M memory devices whose delay is less than the fifth preset threshold; the N+M memory devices include the N memory devices and the M memory devices.
[0085] It should be noted that when the target host is both the first workload type and the second workload type, in order to balance the latency and bandwidth requirements, the system will first allocate M memory devices to the target host, combined with the original N memory devices to form a combination of N+M memory devices, and then migrate hot data to memory devices with lower latency and cold data to memory devices with higher latency among the N+M memory devices.
[0086] It should be noted that, through the implementation of steps S21 to S23, corresponding memory optimization strategies can be adopted for different workload types, and targeted optimization can be obtained for loads that are latency-sensitive, bandwidth-sensitive, or both. This not only improves the response speed and data processing capabilities of the system, but also ensures the effective allocation of resources, thereby significantly improving the overall performance and economic efficiency of the system. In particular, when dealing with complex mixed load scenarios, the present invention can provide a more accurate and efficient resource management solution to meet the strict requirements of high-performance computing, big data processing, and other fields.
[0087] In an exemplary embodiment, the method further includes the following steps: determining the first data and the second data in the memory device by the following steps: when there are P memory pages in the memory device, determining the data in the memory pages whose mark values are less than a seventh preset threshold value among the P memory pages as the first data, and determining the data in the memory pages whose mark values are greater than or equal to the seventh preset threshold value among the P memory pages as the second data, where P is an integer greater than or equal to 1; wherein, when the target memory page in the memory device is accessed by the target host, the mark value of the target memory page is updated to zero, and when the target memory page is not accessed by the target host within a third preset time, the mark value of the target memory page is increased by one, and the seventh preset threshold value is greater than zero.
[0088] Alternatively, if Figure 4 As shown, the memory heat perception module in the switch will monitor the memory page usage frequency of the memory device in real time, and create a memory heat status table to record the hot and cold status of P memory pages of a single memory device in the memory pool. The hot and cold status of each memory page can be represented by 4 bits. The smaller the tag value of the memory page, the hotter the data in the memory page. A dynamic heat threshold is set (usually 7). When the tag value of the memory page exceeds the threshold, the memory page is marked as "cold", otherwise it is marked as "hot". When the memory page is "cold", the data in the memory page is confirmed to be the second data; when the memory page is "hot", the data in the memory page is confirmed to be the first data.
[0089] Optionally, when the target host accesses the Pth memory page of the CXL memory device through the switch topology module, the memory heat status table corresponding to the memory device will update the heat of the Pth memory page to 0. If no host accesses the Pth memory page every 500 milliseconds, the memory heat status table will increase the heat of the Pth memory page by one.
[0090] It should be noted that by implementing the above steps, memory data can be intelligently identified and classified, and refined management and dynamic scheduling of resources can be achieved, which not only improves the efficiency of resource utilization, but also significantly improves the performance and adaptability of the system, especially in scenarios with variable and mixed loads.
[0091] In an exemplary embodiment, the method further comprises the following steps: determining a target file, wherein the target file records the latency and bandwidth information of all memory devices of the memory pool; determining the latency of each device of the N devices from the target file;
[0092] Optionally, create a memory pool memory device table (target file), which includes the delay and bandwidth information of each memory device. When a memory device is added to the memory pool, the memory device will send a request to the memory pool management module. The memory pool management module accepts the request, and the memory pool memory device table will add the delay and bandwidth information of the memory device. The memory pool management module will poll and send requests to the memory devices in the memory pool. After the user wants to unplug the memory device in the memory pool, the corresponding memory device cannot respond to the request, and the memory pool management module will delete the delay and bandwidth information of the memory device in the memory pool memory device table.
[0093] In an exemplary embodiment, reallocating M memory devices to the target host may be achieved by the following steps: reallocating M memory devices to the target host based on the target file.
[0094] Optionally, a high latency threshold is set (the high latency threshold may be greater than or equal to a fifth preset threshold). For a memory device whose latency recorded in the target file is greater than the threshold, it indicates that the latency of the memory device must be greater than the fifth preset threshold. Even if the remaining bandwidth of the memory device is available, it will not be used to expand the bandwidth. In other words, the memory device will not be allocated to the target host.
[0095] It should be noted that the existence of the target file ensures that the system has real-time knowledge of the performance information of the memory device, can make resource management decisions based on the latest data, and improves the accuracy and efficiency of resource allocation. Resource reallocation based on the target file can intelligently select the appropriate memory device based on the current workload type of the target host. This reallocation strategy takes into account the dual factors of latency and bandwidth, can effectively meet the needs of different load types, and improve the overall performance of the system. Through the resource information determination and reallocation method of the above steps, memory resources can be managed more intelligently, which not only improves the efficiency of resource utilization, but also significantly improves the performance and economic efficiency of the system, especially in scenarios where variable and complex loads are processed. The effect is particularly prominent.
[0096] In an exemplary embodiment, the method further includes the following steps S31 to S33, wherein step S31 and step S32 are not executed in any particular order:
[0097] Step S31: in the case of obtaining a first request sent by a target memory device, sending a second request to the target memory device, and recording a first time of sending the second request, wherein the first request is a request sent by the target memory device after joining the memory pool; in the case of obtaining response information sent by the target memory device in response to the second request, recording a second time of receiving the response information; determining a delay of the target memory device according to the first time and the second time;
[0098] Alternatively, if Figure 6 As shown, when a new memory device (target memory device) joins the memory pool and sends a joining request (first request), the memory pool management module will send a delay determination request (second request) to the memory device, and record the time point Tq when the second request is sent. The target memory device will respond to the request and reply to the memory pool management module. The memory pool management module receives the reply and records the reply time Tr, and can calculate the delay of the target memory device as (Tr-Tq), and record it in the memory pool memory device table (i.e., the target file).
[0099] It should be noted that this delay test mechanism ensures that the switch can accurately obtain the delay information of each newly added device, providing support for the subsequent cold and hot data migration strategy. It can also ensure that the delay data of each memory device is the latest, avoiding resource scheduling errors caused by inaccurate delay information, and improving system performance and stability.
[0100] Step S32: when the first request sent by the target memory device is obtained, a bandwidth stress test is performed on the target memory device to obtain a target bandwidth; a minimum value of the target bandwidth and a preset bandwidth is determined as the bandwidth of the target memory device, wherein the preset bandwidth is determined according to the topology structure of the switch;
[0101] Alternatively, if Figure 6 As shown, when the memory pool adds a target memory device and the memory pool management module responds to the request of the target memory device, the memory pool management module will perform a bandwidth stress test on the target memory device, take the minimum value of the test result and the CXL topology link bandwidth as the bandwidth of the target memory device, and then record it in the memory device table (i.e., the target file).
[0102] It should be noted that through precise bandwidth stress testing, the switch can accurately evaluate the bandwidth capacity of each memory device, which not only ensures the effective use of resources but also avoids the impact of bandwidth bottlenecks on system performance.
[0103] Step S33: Recording the latency and bandwidth of the target memory device in a target file, wherein the target file records latency and bandwidth information of all memory devices in the memory pool.
[0104] It should be noted that the switch will record the latency and bandwidth information of the target memory device in the target file. The target file is a key database that contains the performance parameters of all memory devices in the memory pool, providing an important reference for subsequent resource allocation and optimization. By maintaining the target file, unified management of memory device performance information can be achieved, which simplifies the process of information query and update, improves the efficiency and accuracy of resource management, and also provides real-time data support for load type identification and dynamic scheduling.
[0105] It should be noted that the implementation of the above steps ensures that the latency and bandwidth information of the memory device can be accurately and real-time acquired and recorded, providing a solid data foundation for the subsequent resource allocation strategy. Through latency testing and bandwidth stress testing, not only can the efficient use of resources be ensured, but also the system performance can be improved and performance bottlenecks can be avoided. Especially when dealing with complex and variable workloads, this precise resource information management is particularly important, greatly enhancing the adaptability and reliability of the system.
[0106] In an exemplary embodiment, before determining the workload type of the target host and obtaining the target workload type, the method further includes the following steps S41-S42:
[0107] Step S41: obtaining a target configuration file, wherein the target configuration file records memory devices corresponding to different hosts;
[0108] Optionally, before starting the resource adjustment and optimization process, you need to obtain a target configuration file that details the list of memory devices that should be allocated to each host. The target configuration file may be configured by the administrator during system initialization or automatically updated according to policies during operation. It ensures that the switch has a clear record of the initial allocation relationship between hosts and memory devices.
[0109] It should be noted that the existence of the target configuration file simplifies the initial allocation process of memory devices, avoids the need to analyze and allocate resources from scratch when adjusting resources, and improves the efficiency and accuracy of resource allocation. At the same time, the existence of the configuration file also facilitates switch management and maintenance, and facilitates hot plugging and dynamic adjustment of resources.
[0110] Step S42: Allocate a memory device to the target host according to the target configuration file.
[0111] Optionally, the switch reads the information in the target configuration file and allocates a corresponding memory device to each specified host. The allocation process is performed according to the correspondence between the host and the memory device recorded in the configuration file to ensure that each host can obtain the memory resources it needs.
[0112] It should be noted that the allocation mechanism based on the target profile ensures that the host has obtained a set of preliminary memory resources when it is started or before the workload type is determined. This provides a starting point for subsequent resource optimization based on workload characteristics, avoids resource vacancies, and maintains the continuity and stability of switch operation.
[0113] It should be noted that through the above steps, the switch can quickly and accurately allocate memory devices to different hosts based on the target configuration file, laying the foundation for subsequent dynamic resource adjustment and optimization. The use of configuration files not only simplifies the process of initial resource allocation, but also ensures the flexibility and adaptability of resource allocation, enabling the switch to better cope with dynamic changes in workloads and improve overall performance and resource utilization. Especially in large data centers or cloud environments, this resource allocation method based on configuration files can significantly improve the efficiency of resource management and the scalability of switches.
[0114] In an exemplary embodiment, the method further comprises the following steps S51-S52:
[0115] Step S51: sending a heartbeat signal to the target memory device at every preset time interval, and marking the target memory device as a fault state if no reply information from the target memory device is received within a fourth preset time, wherein the reply information is used to indicate that the target memory device is in a normal state;
[0116] Step S52: If no reply information is received from the target memory device within the fourth preset time, the delay and bandwidth information of the target memory device is obtained, and the second data in the target memory device is transferred to other memory devices in the memory pool except the target memory device, and the priority of the target memory device is increased, thereby adding more available bandwidth for the target memory device.
[0117] It should be noted that through the above steps S51 and S52, the switch can quickly detect and respond when a memory device failure occurs, maintain the continuity of data transmission and the stability of system performance through emergency resource allocation and priority adjustment, and significantly enhance the system's robustness, high availability and user experience.
[0118] Obviously, the above described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. In order to better understand the above method, the above process is described below in combination with the embodiments, but it is not used to limit the technical solution of the embodiments of the present invention. Specifically, the memory device is a CXL device as an example:
[0119] This implementation designs a CXL switch system that supports memory latency stratification and bandwidth stratification. The system design block diagram is shown in the figure. Figure 4 As shown, it specifically includes: a load type identification module, a memory heat perception module, a memory dynamic scheduling module, a CXL topology module and a memory pool management module.
[0120] 1. Load type identification module;
[0121] Function: Monitor the memory access pattern of the host computer (i.e. the above host) in real time and identify the type of workload running on the host computer (delay-sensitive or bandwidth-sensitive).
[0122] Optionally, by monitoring the number of times the host computer accesses the memory pool through the CXL topology module within a fixed time period, the host computer's access frequency to the memory pool is determined, and an access frequency threshold is set. If the threshold is exceeded, the host computer is considered to be running a memory latency-sensitive workload. By monitoring the amount of memory (M) read and written to the memory pool by the host computer through the CXL topology module within a unit time (T), the memory bandwidth (B) required by the host computer is determined, B = M / T. If the memory bandwidth required by the host computer exceeds 95% of the total available memory bandwidth allocated by the host computer, the host computer is considered to be running a memory bandwidth-sensitive workload.
[0123] 2. Memory heat perception module;
[0124] Function: Monitor the memory page usage frequency of CXL memory devices in real time and dynamically determine the hot and cold status of memory pages.
[0125] Optionally, create a memory heat state table to record the hot and cold states of the memory pages of the CXL memory device in the memory pool. The hot and cold states of each memory page can be represented by 4 bits. The smaller the value, the hotter the memory page. Set a dynamic heat threshold, which is 7 by default. If the threshold is exceeded, the memory page is marked as "cold", otherwise it is marked as "hot". When the host computer accesses the memory page P of the CXL memory device through the CXL topology module, the corresponding memory heat state table will update the heat of P to 0. If no host computer accesses the memory page P every 500 milliseconds, the corresponding memory heat state table will increase the heat of P by one.
[0126] 3. Memory dynamic scheduling module;
[0127] Function: Design memory dynamic scheduling strategy and dynamically migrate data according to the host computer workload type, memory hot and cold information and memory pool allocation information.
[0128] Alternatively, if Figure 5 As shown, for a host computer running a latency-sensitive load, if multiple CXL devices are allocated, the module will migrate the hot data of the high-latency CXL device to the memory of the low-latency CXL device in real time, and migrate the cold data of the low-latency CXL device to the memory of the high-latency CXL device. For a host computer running a bandwidth-sensitive load, a CXL device with available bandwidth is allocated and the data allocation path is adjusted. After a period of time when the workload running on the host computer is no longer a bandwidth-sensitive load, the memory is judged, the data path is adjusted, and the newly allocated CXL device is released. For a host computer running a workload that is sensitive to both latency and bandwidth, after a CXL device with available bandwidth is allocated and the data path is adjusted, the module will migrate the hot data of the high-latency CXL device to the memory of the low-latency CXL device in real time, and migrate the cold data of the low-latency CXL device to the memory of the high-latency CXL device.
[0129] Optionally, a high delay threshold is set, and for CXL devices with a delay higher than the threshold, even if there is remaining available bandwidth, it is not used for bandwidth expansion.
[0130] Optionally, a migration amount threshold is set. If the cold data size of the low-latency CXL device or the hot data size of the high-latency CXL device exceeds the migration amount threshold, the memory dynamic scheduling module is designed with a DMA controller to batch migrate memory data between devices.
[0131] Optionally, a host computer task priority mechanism is introduced, and the user can set the host computer priority, and high-priority host computer tasks are given priority in bandwidth expansion.
[0132] 4. CXL topology module;
[0133] Function: Establish a hardware link between the host computer and the memory pool and manage the communication protocol.
[0134] Optionally, it mainly supports full interconnection between Type 3 devices and host computers in this architecture.
[0135] 5. Memory pool management module;
[0136] Function: Supports users to perform static memory allocation and recycling on the host computer, supports users to manually set the memory delay and bandwidth of CXL devices in the memory pool, supports automatic identification of the memory delay and bandwidth of CXL devices in the memory pool, supports hot-swap management of CXL device delay and bandwidth information. Manages the allocation of the host computer's corresponding memory pool and the total bandwidth of the memory pool that the host computer can theoretically use.
[0137] Optionally, a memory pool allocation table is created to provide an interface so that the user can allocate or unallocate a specified CXL device to the host computer and record it in the memory pool allocation table, and calculate the total bandwidth of the memory pool that can be theoretically used by the host computer.
[0138] Optionally, create a memory pool CXL device table that includes latency and bandwidth information for each CXL device. Figure 6(Steps S601-S607), when a CXL device is added to the memory pool, the CXL device will send a request to the memory pool management module, the memory pool management module accepts the request, and the memory pool CXL device table will increase the delay and bandwidth information of the CXL device. The memory pool management module will poll the CXL devices in the memory pool and send requests. After the user wants to unplug the CXL device in the memory pool, the corresponding CXL device cannot respond to the request, and the memory pool management module will delete the delay and bandwidth information of the CXL device in the memory pool CXL device table. When a CXL device is added to the memory pool and the memory pool management module receives the request of the CXL device, the memory pool management module will send a delay determination request to the CXL device and record the request time Tq at the same time. The CXL device will respond to the request and reply to the memory pool management module. The memory pool management module receives the reply and records the reply time Tr, calculates the delay of the CXL device as (Tr-Tq), and records it in the memory pool CXL device table. When a CXL device is added to the memory pool and the memory pool management module responds to the request of the CXL device, the memory pool management module will perform a bandwidth stress test on the CXL device, take the minimum value of the test result and the CXL topology link bandwidth as the CXL device bandwidth, and record it in the memory pool CXL device table.
[0139] It should be noted that the above modules are summarized as follows:
[0140] Load type identification module: Based on memory access frequency and data transmission volume, a threshold judgment mechanism is designed to achieve classification and identification of delay-sensitive and bandwidth-sensitive workloads. The module establishes an accurate identification algorithm for the host computer load characteristics by monitoring the access frequency and bandwidth usage within a fixed time;
[0141] Memory heat perception module: proposes a heat monitoring algorithm based on the memory page access frequency, tracks the data flow to achieve real-time perception of the hot and cold status of the memory page. The 4-bit status mark is used to quickly determine and stratify hot and cold data;
[0142] Memory dynamic scheduling module: Based on hot and cold data and load types, it designs multi-dimensional memory migration strategies and combines DMA controllers to achieve batch data migration across devices;
[0143] Memory pool management module: Develop a mechanism to automatically identify the latency and bandwidth characteristics of CXL devices, combined with a real-time updated memory pool allocation table, to support dynamic tiered management and hot-swap operations. The module records the performance characteristics of the device through protocol interaction to provide accurate data for allocation decisions;
[0144] Multi-load characteristic optimization architecture: Design a new CXL Switch architecture that supports optimizing resource allocation for both latency-sensitive and bandwidth-sensitive loads, coordinating resource competition among different types of loads, and ensuring system stability and scalability.
[0145] 6. System Process:
[0146] a) System power on;
[0147] b) The memory pool management module creates and maintains the memory pool CXL device table and the memory pool allocation table;
[0148] c) When a new CXL device is added, the memory pool management module will update the memory pool CXL device table in a timely manner;
[0149] d) The memory pool management module polls to detect whether there are CXL devices removed and updates the memory pool CXL device table in a timely manner;
[0150] e) The user can set the priority of the host computer;
[0151] f) The user allocates CXL memory to the host computer through the memory pool management module, and the memory pool management module updates the memory pool allocation table;
[0152] g) Host computer starts delay-sensitive workloads;
[0153] h) Host computer data is stored in CXL memory through CXL topology module;
[0154] i) The load type identification module identifies the load type of the host computer;
[0155] j) The memory heat sensing module monitors the temperature of CXL memory and creates and maintains the memory heat status table;
[0156] k) The memory dynamic scheduling module migrates the storage locations of hot and cold data in real time according to the memory pool allocation table and the memory heat status table;
[0157] l) The host computer shuts down latency-sensitive workloads and the host computer starts bandwidth-sensitive workloads;
[0158] m) Host computer data is stored in CXL memory through CXL topology module;
[0159] n) The load type identification module identifies the load type of the host computer and analyzes the memory bandwidth required by the host computer;
[0160] o) The memory heat sensing module monitors the temperature of CXL memory and creates and maintains the memory heat status table;
[0161] p) The memory dynamic scheduling module determines the available CXL devices of the host computer in real time based on the memory bandwidth required by the host computer, the memory pool allocation table and the memory pool CXL device table, and migrates the storage locations of hot and cold data based on the memory heat status table.
[0162] It should be noted that the present application also has the following advantages: 1. Significantly improve memory management efficiency: by introducing a memory heat perception module, the access characteristics of memory data are monitored in real time, and dynamic memory scheduling is achieved accordingly. This intelligent management method integrated in the CXL Switch system enables memory resources to be accurately allocated according to the frequency of use and importance, thereby significantly improving the utilization of memory resources, reducing resource performance redundancy, and saving the consumption of computing resources of the host computer; 2. Optimize system performance: the system can automatically identify the workload type (such as delay-sensitive or bandwidth-sensitive) running on the host computer, and allocate resources in a targeted manner in combination with the scheduling strategy. This targeted resource allocation strategy enables multiple host computers to run multiple types of loads while maintaining higher performance; 3. Through the optimized memory management mechanism, the system can identify the delay and bandwidth information of different CXL devices and combine the scheduling strategy to ensure the optimization of the host computer system performance. The priority scheduling strategy from low delay, high bandwidth to high delay, low bandwidth can also reduce the volatility of the host computer workload performance.
[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0164] In this embodiment, a switch is also provided for realizing the communication connection between the host and the memory devices in the memory pool, and for realizing the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated. As used below, the term "module" can realize the combination of software and / or hardware of the predetermined function. Although the modules described in the following embodiments are preferably realized by software, the realization of hardware, or the combination of software and hardware is also possible and conceivable.
[0165] Figure 7 : is a structural block diagram of a switch according to an embodiment of the present application, the switch comprising:
[0166] A load type identification module 702 is used to determine the workload type of the target host and obtain the target workload type, wherein the workload type includes: a first workload type and / or a second workload type, when the target host operates in the working mode of the first workload type and the communication delay is lower than a preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, and when the target host operates in the working mode of the second workload type and the communication bandwidth is lower than a preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host includes the target host;
[0167] The memory dynamic scheduling module 704 is used to perform memory adjustment operations on the target host according to the target workload type, wherein the memory adjustment operations include: adding memory devices to the target host, and / or migrating data in the memory devices allocated to the target host.
[0168] The above-mentioned switch determines that the target host is of the first workload type and / or the second workload type, and thus adds memory devices to the target host according to the workload type of the target host, and / or migrates the data in the memory devices allocated to the target host, thereby realizing dynamic adjustment of the memory devices, improving the allocation efficiency and utilization of memory resources, and further solving the problem of low memory resource allocation efficiency due to the inability to dynamically perform memory adjustment operations on the host.
[0169] In an exemplary embodiment, the load type identification module 702 is further used to determine the number of times the target host accesses the memory pool within a first preset time to obtain a target number of times; determine the access frequency of the target host accessing the memory pool according to the target number of times and the first preset time; and determine the amount of data accessed by the target host to the memory pool for read and write operations within a second preset time to obtain a target data amount; determine the actual bandwidth of the target host according to the target data amount within the second preset time; determine the ratio of the actual bandwidth of the target host to the bandwidth allowed to be used by the target host to obtain a target ratio; if the access frequency of the target host accessing the memory pool is greater than or equal to a third preset threshold and the target ratio is less than a fourth preset threshold, determine the target workload type to be the first workload type; if the access frequency of the target host accessing the memory pool is less than the third preset threshold and the target ratio is greater than or equal to the fourth preset threshold, determine the target workload type to be the second workload type; if the access frequency of the target host accessing the memory pool is greater than or equal to the third preset threshold and the target ratio is greater than or equal to the fourth preset threshold, determine the target workload type to be the first workload type and the second workload type.
[0170] In an exemplary embodiment, the memory dynamic scheduling module 704 is also used to, when the target workload type is the first workload type, determine N memory devices allocated to the target host; transfer the first data in the first memory device to the second memory device, and transfer the second data in the second memory device to the first memory device; wherein the first memory device is a memory device among the N memory devices whose delay is greater than or equal to a fifth preset threshold, the second memory device is a memory device among the N memory devices whose delay is less than the fifth preset threshold, the first data is data used by the target host with a usage frequency greater than or equal to a sixth preset threshold, the second data is data used by the target host with a usage frequency less than the sixth preset threshold, and N is an integer greater than or equal to 1; when the target workload type is the second workload type, The target host reallocates M memory devices, wherein the sum of the bandwidth allowed for the target host to use in the M memory devices and the bandwidth allowed for the target host to use in the N memory devices meets the bandwidth requirement of the target host, and M is an integer greater than or equal to 1; when the target workload type is the first workload type and the second workload type, reallocates M memory devices for the target host; transfers the first data in the third memory device to the fourth memory device, and transfers the second data in the fourth memory device to the third memory device; wherein the third memory device is a memory device among the N+M memory devices whose delay is greater than or equal to the fifth preset threshold, and the fourth memory device is a memory device among the N+M memory devices whose delay is less than the fifth preset threshold; the N+M memory devices include the N memory devices and the M memory devices.
[0171] In an exemplary embodiment, the switch further includes: a memory heat perception module, used to determine the first data and the second data in the memory device in the following manner: when there are P memory pages in the memory device, the data in the memory pages whose tag values are less than a seventh preset threshold among the P memory pages are determined as the first data, and the data in the memory pages whose tag values are greater than or equal to the seventh preset threshold among the P memory pages are determined as the second data, where P is an integer greater than or equal to 1; wherein, when the target memory page in the memory device is accessed by the target host, the tag value of the target memory page is updated to zero, and when the target memory page is not accessed by the target host within a third preset time, the tag value of the target memory page is increased by one, and the seventh preset threshold is greater than zero.
[0172] In an exemplary embodiment, the switch further includes: a memory pool management module, used to determine a target file, wherein the target file records the delay and bandwidth information of all memory devices in the memory pool; determining the delay of each of the N devices from the target file; and a memory dynamic scheduling module 704, further used to reallocate M memory devices to the target host based on the target file.
[0173] In an exemplary embodiment, the memory pool management module is also used to, upon obtaining a first request sent by a target memory device, send a second request to the target memory device and record a first time of sending the second request, wherein the first request is a request sent by the target memory device after joining the memory pool; upon obtaining response information sent by the target memory device in response to the second request, record a second time of receiving the response information; determine a delay of the target memory device according to the first time and the second time; and upon obtaining the first request sent by the target memory device, perform a bandwidth stress test on the target memory device to obtain a target bandwidth; determine the minimum value of the target bandwidth and a preset bandwidth as the bandwidth of the target memory device, wherein the preset bandwidth is determined according to the topology of the switch; and record the delay and bandwidth of the target memory device in a target file, wherein the target file records the delay and bandwidth information of all memory devices in the memory pool.
[0174] In an exemplary embodiment, the switch further includes: a switch topology module, which is used to obtain a target configuration file before determining the workload type of the target host and obtaining the target workload type, wherein the target configuration file records memory devices corresponding to different hosts; and allocate memory devices to the target host according to the target configuration file.
[0175] In an exemplary embodiment, the switch topology module is also used to implement a communication connection between the host and the memory devices in the memory pool.
[0176] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0177] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0178] Optionally, in this embodiment, the computer program may be configured to perform the following steps by means of the computer program:
[0179] S1, determine the workload type of the target host and obtain the target workload type, wherein the workload type includes: a first workload type and / or a second workload type, when the target host operates in the working mode of the first workload type and the communication delay is lower than the preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, when the target host operates in the working mode of the second workload type and the communication bandwidth is lower than the preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host includes the target host;
[0180] S2. Perform a memory adjustment operation on the target host according to the target workload type, wherein the memory adjustment operation includes: adding a memory device to the target host, and / or migrating data in the memory device allocated to the target host.
[0181] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0182] The embodiment of the present application also provides an electronic device, such as Figure 8 As shown, the electronic device includes a memory 808 and a processor 804, wherein the memory 808 stores a computer program, and the processor 804 is configured to execute the steps in any one of the above method embodiments through the computer program.
[0183] Optionally, in this embodiment, the processor 804 may be configured to perform the following steps through a computer program:
[0184] S1, determine the workload type of the target host and obtain the target workload type, wherein the workload type includes: a first workload type and / or a second workload type, when the target host operates in the working mode of the first workload type and the communication delay is lower than the preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, when the target host operates in the working mode of the second workload type and the communication bandwidth is lower than the preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host includes the target host;
[0185] S2. Perform a memory adjustment operation on the target host according to the target workload type, wherein the memory adjustment operation includes: adding a memory device to the target host, and / or migrating data in the memory device allocated to the target host.
[0186] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0187] Alternatively, a person skilled in the art may understand that: Figure 8 The structure shown is for illustration only. Figure 8 The structure of the electronic device is not limited. For example, the electronic device may also include Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations shown.
[0188] Among them, the memory 808 can be used to store software programs and modules, such as the memory adjustment method in the embodiment of the present application and the program instructions / modules corresponding to the switch. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 808, that is, realizing the above-mentioned memory adjustment method. The memory 808 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 808 may further include a memory remotely located relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 808 can be specifically, but not limited to, used to store information such as system configuration files. As an example, such as Figure 8As shown, the memory 808 may include but is not limited to the load type identification module 702 and the memory dynamic scheduling module 704 in the switch. In addition, it may also include but is not limited to other module units in the switch, which will not be described in detail in this example.
[0189] Optionally, the transmission device 806 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0190] In addition, the electronic device mentioned above further includes: a display 808; and a connection bus 810, which is used to connect various module components in the electronic device mentioned above.
[0191] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0192] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0193] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0194] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0195] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A memory adjustment method, characterized in that: Applied to a switch, the switch is used to realize a communication connection between a host and a memory device in a memory pool; include: Determine the workload type of the target host and obtain the target workload type, wherein the workload type includes: a first workload type and / or a second workload type, when the target host operates in the working mode of the first workload type and the communication delay is lower than the preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, when the target host operates in the working mode of the second workload type and the communication bandwidth is lower than the preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host includes the target host; A memory adjustment operation is performed on the target host according to the target workload type, wherein the memory adjustment operation includes: adding a memory device to the target host, and / or migrating data in the memory device allocated to the target host.
2. The method according to claim 1, characterized in that The determining the workload type of the target host to obtain the target workload type includes: Determine the number of times the target host accesses the memory pool within a first preset time to obtain a target number of times; determine the access frequency of the target host accessing the memory pool according to the target number of times and the first preset time; and Determine the amount of data accessed by the target host to the memory pool for read and write operations within a second preset time to obtain a target data amount; determine the actual bandwidth of the target host according to the target data amount within the second preset time; determine the ratio of the actual bandwidth of the target host to the bandwidth allowed to be used by the target host to obtain a target ratio; When the access frequency of the target host accessing the memory pool is greater than or equal to a third preset threshold, and the target ratio is less than a fourth preset threshold, determining that the target workload type is the first workload type; When the access frequency of the target host to the memory pool is less than the third preset threshold, and the target ratio is greater than or equal to the fourth preset threshold, determining that the target workload type is the second workload type; When the access frequency of the target host to the memory pool is greater than or equal to the third preset threshold, and the target ratio is greater than or equal to the fourth preset threshold, the target workload type is determined to be the first workload type and the second workload type.
3. The method according to claim 1, characterized in that The performing a memory adjustment operation on the target host according to the target workload type includes: In the case where the target workload type is the first workload type, determining N memory devices allocated to the target host; transferring first data in the first memory device to the second memory device, and transferring second data in the second memory device to the first memory device; wherein the first memory device is a memory device among the N memory devices whose delay is greater than or equal to a fifth preset threshold, the second memory device is a memory device among the N memory devices whose delay is less than the fifth preset threshold, the first data is data used by the target host with a usage frequency greater than or equal to a sixth preset threshold, the second data is data used by the target host with a usage frequency less than the sixth preset threshold, and N is an integer greater than or equal to 1; In the case where the target workload type is the second workload type, reallocate M memory devices to the target host, wherein the sum of the bandwidth allowed to be used by the target host in the M memory devices and the bandwidth allowed to be used by the target host in the N memory devices meets the bandwidth demand of the target host, and M is an integer greater than or equal to 1; In the case where the target workload type is the first workload type and the second workload type, M memory devices are reallocated to the target host; the first data in the third memory device is transferred to the fourth memory device, and the second data in the fourth memory device is transferred to the third memory device; wherein the third memory device is a memory device among the N+M memory devices whose delay is greater than or equal to the fifth preset threshold, and the fourth memory device is a memory device among the N+M memory devices whose delay is less than the fifth preset threshold; the N+M memory devices include the N memory devices and the M memory devices.
4. The method according to claim 3, characterized in that The method further comprises: The first data and the second data in the memory device are determined by: In a case where there are P memory pages in the memory device, data in memory pages whose mark values among the P memory pages are less than a seventh preset threshold are determined as the first data, and data in memory pages whose mark values among the P memory pages are greater than or equal to the seventh preset threshold are determined as the second data, where P is an integer greater than or equal to 1; Among them, when the target memory page in the memory device is accessed by the target host, the tag value of the target memory page is updated to zero; when the target memory page is not accessed by the target host within a third preset time, the tag value of the target memory page is increased by one, and the seventh preset threshold is greater than zero.
5. The method according to claim 3, characterized in that: The method further includes: determining a target file, wherein the target file records the delay and bandwidth information of all memory devices in the memory pool; determining the delay of each device in the N devices from the target file; Reallocating M memory devices for the target host includes: reallocating M memory devices for the target host based on the target file.
6. The method according to claim 1, characterized in that The method further comprises: In the case of obtaining a first request sent by a target memory device, sending a second request to the target memory device and recording a first time of sending the second request, wherein the first request is a request sent by the target memory device after joining the memory pool; in the case of obtaining response information sent by the target memory device in response to the second request, recording a second time of receiving the response information; determining a delay of the target memory device according to the first time and the second time; and In the case of obtaining a first request sent by a target memory device, performing a bandwidth stress test on the target memory device to obtain a target bandwidth; determining a minimum value of the target bandwidth and a preset bandwidth as the bandwidth of the target memory device, wherein the preset bandwidth is determined according to a topological structure of the switch; The latency and bandwidth of the target memory device are recorded in a target file, wherein the latency and bandwidth information of all memory devices in the memory pool are recorded in the target file.
7. The method according to claim 1, characterized in that Before determining the workload type of the target host and obtaining the target workload type, the method further includes: Obtain a target configuration file, wherein the target configuration file records memory devices corresponding to different hosts; Allocate a memory device to the target host according to the target configuration file.
8. A switch, characterized in that: The switch is used to realize the communication connection between the host and the memory devices in the memory pool; include: A load type identification module, used to determine the workload type of a target host and obtain a target workload type, wherein the workload type includes: a first workload type and / or a second workload type, when the target host operates in a working mode of the first workload type and the communication delay is lower than a preset delay, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication delay is greater than a first preset threshold, and when the target host operates in a working mode of the second workload type and the communication bandwidth is lower than a preset bandwidth, the ratio of the change amplitude of the workload of the target host to the change amplitude of the communication bandwidth is greater than a second preset threshold; the host includes the target host; A memory dynamic scheduling module is used to perform memory adjustment operations on the target host according to the target workload type, wherein the memory adjustment operations include: adding memory devices to the target host, and / or migrating data in the memory devices allocated to the target host.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Task scheduling method, server and server cluster
CN116643875A
Resource allocation method and device, electronic equipment and storage medium
CN117873738A
Memory hotspot elimination method and device based on memory pooling technology
CN118550846A
RDMA end side task queue scheduling method
CN118590454A
Cited By
Hot plug control device and method
CN120670350A
Storage control system and storage control method
CN120892218A