Port resource scheduling method and electronic equipment
By collecting and calculating the resource utilization and weight of ports in real time, and dynamically adjusting the allocation of port resources, the problem of fixed and unallocated link resources in the server is solved, achieving balanced utilization of port resources and improving server performance.
Patent Information
- Application Number
- CN202511549172.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-10-28
AI Technical Summary
In a server, the link resources allocated to each port are fixed and cannot be dynamically adjusted, resulting in some ports being heavily loaded while others are idle, leading to uneven resource utilization and affecting server performance.
The system collects real-time operational data from each port on the server, including resource utilization and configuration weights, calculates the target resource ratio, and adjusts the resource allocation between ports based on this ratio to meet the resource allocation needs of each port.
By dynamically monitoring and adjusting port resource allocation, the resource utilization efficiency of port links is improved, server performance is optimized, and the resource allocation of each port is ensured to be balanced.
Smart Images

Figure CN121029366A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of resource scheduling, in particular to a port resource scheduling method and an electronic device. BACKGROUND
[0002] In a server, the central processing unit and each component are connected through ports for resource allocation and data transmission. In the running process of the server, some ports are heavily loaded, while some ports are relatively idle. However, the resources cannot be shared between the ports, that is, the link resource allocation of each port is fixed and cannot be dynamically adjusted. SUMMARY
[0003] The present application provides a port resource scheduling method and an electronic device to at least solve the problem of fixed link resource allocation of each port and inability to dynamically adjust.
[0004] The present application provides a port resource scheduling method, comprising: real-time collection of running data of each port in a server, the running data comprising resource utilization rate and resource configuration weight corresponding to the port; when it is detected that the resource utilization rate of a first port exceeds a preset threshold, calculating target resource proportion corresponding to each port according to the resource utilization rate and the resource configuration weight corresponding to each port, the first port being any one of the ports, and the target resource proportion being a ratio between the amount of resource allocated to the port and the total amount of resource; adjusting resource allocation between the ports in the server according to the target resource proportion corresponding to each port, so that the amount of resource allocated to each port meets the target resource proportion.
[0005] The present application also provides a port resource scheduling device, comprising: an acquisition module configured to collect running data of each port in a server in real time, the running data comprising resource utilization rate and resource configuration weight corresponding to the port; a processing module configured to, when it is detected that the resource utilization rate of a first port exceeds a preset threshold, calculate target resource proportion corresponding to each port according to the resource utilization rate and the resource configuration weight corresponding to each port, the first port being any one of the ports, and the target resource proportion being a ratio between the amount of resource allocated to the port and the total amount of resource; the processing module is further configured to adjust resource allocation between the ports in the server according to the target resource proportion corresponding to each port, so that the amount of resource allocated to each port meets the target resource proportion.
[0006] The present application also provides an electronic device, comprising a memory configured to store a computer program and a processor configured to implement the steps of any one of the above port resource scheduling methods when executing the computer program.
[0007] The application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program.
[0008] The application further provides a computer program product, which comprises a computer program.
[0009] According to the application, the running data of each port in the server is collected in real time, and the running data comprises the resource utilization rate and the resource configuration weight corresponding to the port; when it is detected that the resource utilization rate of a first port exceeds a preset threshold, the target resource proportion corresponding to each port is calculated according to the resource utilization rate and the resource configuration weight corresponding to each port, the first port is any one of the ports, and the target resource proportion is the ratio between the resource amount allocated to the port and the total resource amount; the resource allocation between the ports in the server is adjusted according to the target resource proportion corresponding to each port, so that the resource allocation amount of each port meets the target resource proportion. In this scheme, the resource usage of the port link is dynamically monitored, the resource proportion between the ports is determined by calculating the utilization rate and the weight, the resource allocation between the ports is adjusted, and therefore the resource usage efficiency of the port link is improved, and the server performance is improved as much as possible. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0011] Figure 1 A PCIe Switch expansion topology diagram is provided for the embodiments of the application. Figure 2 A port resource scheduling method flow is provided for the embodiments of the application Figure 1 ; Figure 3 A port resource scheduling method flow is provided for the embodiments of the application Figure 2 ; Figure 4 A port resource scheduling device structure diagram is provided for the embodiments of the application. Figure 5 A structure diagram of an electronic device is provided for the embodiments of the application. DETAILED DESCRIPTION
[0012] With reference to the drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present application.
[0013] It should be noted that in the description of the present application, the terms "comprising", "containing" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0014] It should be noted that in the embodiments of the present application, the words "exemplary" or "for example" are used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words "exemplary" or "for example" are intended to present the relevant concept in a specific manner.
[0015] With the development of AI servers, the peripheral component interconnect express (PCIe) topology is becoming more and more complex, and the number of external devices is increasing. PCIe is a high-speed serial computer expansion bus standard used to connect the motherboard and external devices (such as graphics cards, solid state disks, network cards, etc.), aiming to replace the traditional parallel bus architecture (such as PCI, AGP), providing higher bandwidth and lower latency. Basically, PCIe topology is extended by PCIe Switch, whether it is to extend hard disks, GPUs or network cards. PCIe Switch is a hardware device used to extend and manage PCIe bus connections. Its core function is to connect with the root complex (RC) of the CPU through an upstream port (Upstream Port) and connect with terminal devices (Endpoint) or other PCIe devices through multiple downstream ports (Downstream Ports). In conventional design, PCIe Switch usually contains only one upstream port, but some advanced designs may support multiple logical upstream connections through special configuration or hierarchical structure.
[0016] In actual use, the PCIe Switch allocates hardware resources such as queue buffers according to the port, and determines how many instructions can be processed at the same time. This processing method is simple and direct, but cannot dynamically allocate resources in the case of heavy load of some ports, and cannot optimize utilization. Some Switches can support intra-station sharing. When the number of expansion ports of different stations is inconsistent, the station with fewer expansion ports will get more resources, causing performance differences in the same type of expansion port, such as hard disks, which causes users to be confused. In addition, there is a lack of real-time traffic data in the current PCIe link. The current method usually needs to be externally connected to a monitoring port and a tool to capture, which is not conducive to collecting real-time data and historical data in a business environment.
[0017] As shown in Figure 1 The PCIe Switch expansion topology in the prior art is more typical, as can be seen, the PCIe Switch is connected with the CPU through two uplink ports (ports), and expands two GPU ports, two network card ports, and two hard disk ports. Usually, the uplink and GPU are X16, occupying one PCIe Switch station, and the nvme is usually X4, one station is divided into two or four nvme hard disk ports, and the link resources such as queue are allocated according to the bandwidth. This typical topology will have the following problems in actual use. The business usually does not simultaneously press full, such as GPU1 with relatively large pressure, data or instruction press full queue buffer, but the data amount of other ports is very small. At this time, the GPU port cannot share the queue resources of other ports, and the phenomenon of partial idling and partial insufficient use occurs at the same time. In addition, there are also differences in the splitting of different ports of different stations, such as splitting 4 X4 ports in one station and splitting two X4 ports in another station, and the rest is not used. In some performance test scenarios, this will cause some differences in the data of these X4 ports, causing user confusion.
[0018] In summary, it can be seen that there are the following problems in each port in the current server: link traffic and performance data need to be obtained by additional tools; link resource allocation is fixed and cannot be dynamically allocated; and there is an imbalance in the same type and bandwidth expansion devices.
[0019] To address the aforementioned technical problems, this application provides a port resource scheduling method. This method involves real-time collection of operational data from each port on a server, including the resource utilization rate and resource configuration weights corresponding to each port. When the resource utilization rate of a first port exceeds a preset threshold, a target resource ratio for each port is calculated based on its resource utilization rate and resource configuration weights. The first port can be any one of the ports, and the target resource ratio is the ratio of the resources allocated to that port to the total resources. The resource allocation among ports on the server is adjusted according to the target resource ratios for each port to ensure that the resource allocation for each port meets the target resource ratio. In this scheme, the resource usage of port links is dynamically monitored, and the resource ratio among ports is determined by calculating utilization rates and weights. This adjustment of resource allocation among ports improves the efficiency of port link resource utilization and maximizes server performance.
[0020] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0021] like Figure 2 As shown, Figure 2 A flowchart of a port resource scheduling method provided for embodiments of this application, the method may include the following steps: 201. Real-time collection of operating data from each port on the server.
[0022] In this embodiment of the application, the server can be configured with multiple ports, through which data can be transmitted and processed with multiple external devices. In order to ensure the normal operation of the port link, certain resources need to be allocated to each port. The operating data of each port in the server can be collected in real time. The operating data can specifically include the resource utilization rate and resource configuration weight of the port.
[0023] It should be noted that this resource utilization rate is a metric used to measure the efficiency of port resource usage during normal operation. It is the ratio of actual used port resources (such as bandwidth and number of connections) to the total port resource capacity, usually expressed as a percentage. This metric measures the efficiency of port resource utilization and reflects the degree of port resource utilization in a network or system.
[0024] It should be noted that the resource configuration weight can be a weight configured for the port attribute, which can be understood as the priority of the port to resource allocation. The higher the resource configuration weight, the more resources the port needs. Resource allocation can be skewed by the resource configuration weight of each port, and resource allocation will be prioritized for ports with higher resource configuration weights. The resource configuration weight is only a weight for each port itself and does not limit the sum of the resource configuration weights of all ports. The resource configuration weight can also be understood as a weight adjustment coefficient. If a port is running normally and the current resources can meet the port running, the resource configuration weight of the port can be 1, that is, no additional resources are allocated and no resources are taken away from other ports. If some ports are not enough, the resource configuration weight of the port can be set to a value greater than 1. If some ports are too idle and can share resources with other ports, the resource configuration weight of the port can be set to a value less than 1.
[0025] 202、When it is detected that the resource utilization rate of the first port exceeds the preset threshold, the target resource proportion corresponding to each port is calculated according to the resource utilization rate and the resource configuration weight corresponding to each port.
[0026] In the embodiment of the application, the first port can be any one of the ports, that is, if the resource utilization rate of any one port exceeds the preset threshold, it can be indicated that the first port has less remaining available resources, and the remaining resource allocation amount can not be sufficient to ensure the normal operation of the port link. Therefore, resource scheduling between the ports can be performed again, and the resources of other idle ports can be scheduled to the first port for use.
[0027] The preset threshold can be a pre-set threshold (for example, 75%, 85%, etc.), which can be set by itself or determined according to historical experience, and the embodiment of the application does not make specific limitations.
[0028] It should be noted that the specific way of measuring how much resource each port needs can be calculated according to the resource utilization rate and the resource configuration weight. A higher resource utilization rate indicates that the port needs to continue to allocate resources, a lower resource utilization rate indicates that the port does not need to allocate resources, and the resource configuration weight can indicate the degree of demand for resource allocation by each port. Therefore, the target resource proportion corresponding to each port is calculated according to the resource utilization rate and the resource configuration weight corresponding to each port. The target resource proportion can be understood as the ratio between the amount of resources allocated to the port and the total amount of resources.
[0029] In some embodiments, the target resource proportions corresponding to the respective ports are added together, and the sum needs to be 100%. The target resource proportion can be calculated by multiplying the resource utilization and the resource configuration weight corresponding to each port to obtain a product corresponding to each port, and then calculating the target resource proportion corresponding to each port based on the product corresponding to each port.
[0030] It can be understood that, based on the product corresponding to each port, the proportion between each product can be mapped into 100% to obtain the target resource proportion corresponding to each port. That is, the proportion between each product and the sum of all products is calculated, and the proportion is the target resource proportion.
[0031] For example, assuming that there are three ports in total, the resource utilization of port A is 50%, and the resource configuration weight is 1; the resource utilization of port B is 80%, and the resource configuration weight is 1.5; the resource utilization of port C is 70%, and the resource configuration weight is 2. Then the product of the resource utilization and the resource configuration weight of each port can be calculated, the product corresponding to port A is 50%*1=0.5, the product corresponding to port B is 80%*1.5=1.2, and the product corresponding to port C is 70%*2=1.4. The sum of the three products is 0.5+1.2+1.4=3.1, so the target resource proportion corresponding to port A can be 0.5 / 3.1=0.17, the target resource proportion corresponding to port B can be 1.2 / 3.1=0.38, and the target resource proportion corresponding to port C can be 1.4 / 3.1=0.45. That is, 17% of the resource amount needs to be allocated to port A, 38% of the resource needs to be allocated to port B, and 45% of the resource needs to be allocated to port C.
[0032] 203. Adjust the resource allocation between the ports in the server according to the target resource proportions corresponding to the respective ports, so that the resource allocation of each port meets the target resource proportion.
[0033] In the embodiments of the present application, after the target resource proportions corresponding to the respective ports are calculated, the resources in the server can be allocated again according to the target resource proportions. If the resource amount currently possessed by a port is less than the resource amount corresponding to the target resource proportion, the resources of other ports need to be scheduled to the port. If the resource amount currently possessed by a port is greater than the resource amount corresponding to the target resource proportion, the resources of the port need to be scheduled to other ports. After the resources are scheduled in this way, the resource allocation of each port can meet the target resource proportion corresponding to each port.
[0034] For example, assuming that there are a total of 100 resource amounts, there are three ports, port A corresponds to a target resource proportion of 17%; port B corresponds to a target resource proportion of 38%; and port C corresponds to a target resource proportion of 45%. Then, 17 resource amounts can be allocated to port A, 38 resource amounts need to be allocated to port B, and 45 resource amounts need to be allocated to port C. If port A currently includes 35 resource amounts, port B includes 35 resource amounts, and port C includes 30 resource amounts, it can be understood that port A needs to schedule 15 resource amounts to port C, and port A needs to schedule 3 resource amounts to port C. After the scheduling, port A is left with only 17 resource amounts, port B is left with 38 resource amounts after receiving 3 resource amounts, and port C is left with 45 resource amounts after receiving 15 resource amounts, satisfying the target resource proportions corresponding to port A, port B, and port C.
[0035] In the embodiments of the present application, running data of each port in the real-time collection server is collected, and the running data includes resource utilization rates and resource configuration weights corresponding to the ports. When it is detected that a resource utilization rate of a first port exceeds a preset threshold, target resource proportions corresponding to each port are calculated according to the resource utilization rates and the resource configuration weights corresponding to each port, the first port is any one of the at least one port, and the target resource proportion is a ratio between a resource amount allocated to the port and a total resource amount. According to the target resource proportions corresponding to each port, resource allocation between the ports in the server is adjusted, so that the resource allocation amounts of each port satisfy the target resource proportions. In this scheme, the resource usage of the port link is dynamically monitored, the resource proportions between each port are determined by calculating the utilization rates and the weights, and the resource allocation between each port is adjusted, thereby improving the resource usage efficiency of the port link and improving the server performance as much as possible.
[0036] In some embodiments, if an exception occurs or an appropriate amount of resources cannot be scheduled to the port during the resource scheduling process, the resource scheduling is stopped, and the resources of each port are adjusted to the initial allocation amount.
[0037] In some embodiments, the port running data, the resource scheduling process, and the resource scheduling result at each resource scheduling can also be recorded, and the association between the port running data, the resource scheduling process, and the resource scheduling result is learned, so that the resource scheduling calculation speed can be accelerated during subsequent resource scheduling.
[0038] In some embodiments, in the resource scheduling process, some important ports or business complex ports require a large amount of resources, so the resources in the port can include the resources of other ports for scheduling, but each port cannot use the resources of other ports for a long time without limit, so a regulation factor can be introduced for calculation, that is, when it is detected that the resource utilization rate of the first port exceeds the preset threshold, the target resource proportion corresponding to each port is calculated according to the resource utilization rate and the resource configuration weight corresponding to each port, which can specifically include: when it is detected that the resource utilization rate of the first port exceeds the preset threshold, the occupied resource time length corresponding to each port is obtained; in the case that the occupied resource time length is greater than zero, the regulation factor corresponding to each port is determined according to the occupied resource time length; the target resource proportion corresponding to each port is calculated according to the resource utilization rate, the resource configuration weight and the regulation factor corresponding to each port.
[0039] It should be noted that the occupied resource time length is the time length after the port receives the scheduling resources of other ports, that is, if a port does not receive the scheduling resources of other ports, the occupied resource time length of the port is 0, which means that the port does not need to calculate the regulation factor; if a port receives the scheduling resources of other ports, the occupied resource time length of the port can be started to be counted, and the regulation factor can be adjusted according to the accumulation of the occupied resource time length, the regulation factor is negatively related to the occupied resource time length, that is, the longer the time length of occupying the resources of other ports, the smaller the regulation factor, and then the target resource proportion corresponding to each port is calculated according to the resource utilization rate, the resource configuration weight and the regulation factor corresponding to each port, the way of calculating the target resource proportion can refer to the description in step 202, after introducing the regulation factor, the product of the resource utilization rate, the resource configuration weight and the regulation factor can be calculated, and then each product can be mapped to 100% according to the proportion between each product, so as to obtain the target resource proportion corresponding to each port.
[0040] It should be noted that the regulation factor is a value greater than 0, which can be understood that the longer the time length of occupying the resources of other ports, the smaller the regulation factor; the shorter the time length of occupying the resources of other ports, the larger the regulation factor, which is intended that if a port occupies the resources of other ports for a long time, the port should not be allocated resources as much as possible, that is, a port cannot occupy too many resources for a long time; and the occupied resource time length of a port is short, which means that the port has just started to occupy the resources of other ports, which may be that the current business is complex and needs more resources, so the port can be allocated as much resources as possible.
[0041] To measure the duration of resource occupation, an average occupation duration can be set. This average duration can be determined based on experience or statistically derived from historical operating data. The average occupation duration is compared to the current average. If the average occupation duration is longer than the average, it indicates that the port has been occupying resources for a relatively long time, and therefore, a large amount of resources should not be allocated. In this case, an adjustment factor less than 1 can be set (the longer the occupation duration, the closer the adjustment factor is to 0, e.g., 0.8, 0.6, 0.3, 0.2, etc.) to reduce resource allocation. If the average occupation duration is shorter than the average, it indicates that the port has been occupying resources for a relatively short time, and a large amount of resources can still be allocated. In this case, an adjustment factor greater than 1 can be set (the shorter the occupation duration, the greater the adjustment factor is to 1, e.g., 1.2, 1.5, 1.8, 2.5, etc.) to further increase resource allocation. If the average occupation duration is exactly equal to the average, then the adjustment factor can be 1.
[0042] Furthermore, in order to measure the duration of resource occupation, a duration range can be set, and an adjustment factor corresponding to the duration range can be determined based on the duration of resource occupation.
[0043] In this embodiment, based on resource utilization and resource allocation weight, an adjustment factor is further introduced to calculate the resource ratio. This adjustment factor is negatively correlated with the duration of resource occupation by the port. This allows the port to be allocated a large amount of resources in the early stage of resource scheduling, while avoiding a port from occupying a large amount of resources for a long time.
[0044] In some embodiments, port resource utilization can indicate the ratio between the amount of resources currently in use and the total resources of the port. During resource scheduling, both the amount of resources currently in use and the total resources of the port are variables. Therefore, the current resource utilization alone cannot accurately measure the current resource scheduling needs of a port. For example, if a port's resource utilization is low at a certain moment, it's impossible to determine whether this is due to a lack of business processing or excessive resource allocation. Similarly, if a port's resource utilization is high at a certain moment, it's impossible to determine whether this is due to processing a large amount of complex business or insufficient resource allocation. Therefore, when the resource utilization of a first port exceeds a preset threshold, the target resource percentage for each port is calculated based on its resource utilization and resource configuration weight. Specifically, this may include: determining the increase in the resource utilization of the first port when it exceeds the preset threshold; and calculating the target resource percentage for each port if the increase is within a preset growth range.
[0045] It should be noted that port resource utilization may change in real time. When the resource utilization of the first port exceeds a preset threshold, the resource utilization of the first port may increase from a value below the preset threshold to a value above the preset threshold. Therefore, the increase in the resource utilization of the first port can be calculated, that is, the change in the resource utilization of the first port over a period of time can be statistically analyzed. If the increase in the resource utilization is within the preset growth range, it means that the resource utilization of the first port is gradually increasing normally. Therefore, based on the resource utilization and resource configuration weight of each port, the target resource ratio of each port can be calculated, and resource scheduling can be performed. If the increase in the resource utilization is not within the preset growth range, it means that the resource utilization of the first port has suddenly increased, which may not be a resource utilization affected by business operations. Therefore, resource scheduling can be omitted.
[0046] It should be noted that it is also possible for the resource utilization of some ports to decrease from a value greater than the preset threshold to a value less than the preset threshold, and the decrease in resource utilization is not within the preset growth range, and no resource scheduling will be performed.
[0047] In this embodiment, resource scheduling is only performed when the increase in resource utilization of the first port is within a preset growth range. This ensures stable changes in resource utilization and avoids situations where resource utilization increases or decreases significantly due to changes in the total resource amount of the port.
[0048] In some embodiments, a server includes multiple ports, some of which are of the same type and may be responsible for the same business. This can help balance resources among ports of the same type and avoid resource allocation imbalance. Therefore, when collecting the operating data of each port, the operating data may also include: port type. When the resource utilization of the first port is detected to exceed a preset threshold, the target resource ratio of each port is calculated based on the resource utilization and resource configuration weight of each port. Specifically, this may include: determining ports of the same port type as a group of ports; calculating the average resource utilization and average resource configuration weight of each group of ports based on the resource utilization and resource configuration weight of each port in each group; and calculating the target resource ratio of each group of ports based on the average resource utilization and average resource configuration weight of each group of ports.
[0049] It should be noted that after collecting the port type for each port, the ports can be divided into groups, grouping ports of the same type together. This will result in at least one group of ports, each containing at least one port. To calculate the resource allocation for a group of ports, the average resource utilization and resource configuration weight of all ports within that group can be calculated. Specifically, the average resource utilization and resource configuration weight of all ports of the same type are calculated separately and used as the average resource utilization and average resource configuration weight for the group of ports. Then, the target resource allocation for the group of ports is calculated based on this average resource utilization and average resource configuration weight. This target resource allocation can be understood as the target resource allocation for each port within that group, and the target resource allocation for each port within a group is the same.
[0050] In this embodiment, by grouping ports of the same type together, it is not necessary to perform resource scheduling on each port individually. Resource scheduling can be performed only on each group of ports, which reduces the amount of computation and ensures that the resource allocation of ports of the same type is consistent, thereby achieving resource balance of ports of the same type.
[0051] In some embodiments, resource scheduling can be understood as allocating the resources of idle ports to busy ports. That is, when port A needs to occupy the resources of port B, it is on the premise that port B is idle and does not need these additional resources. If the resource utilization of port B also increases, it means that port B is currently processing business and also needs resources. Therefore, port A can no longer occupy the resources of port B. Thus, the resources occupied by port B in port A can be rescheduled to port B, so that the resources of port A and port B are restored to the initial allocation and maintained in balance.
[0052] In some embodiments, users can configure resource scheduling for certain ports on the server. For example, they can set a port to not be scheduled for resource allocation, thus eliminating the need to collect operational data for that port or calculate its resource share.
[0053] like Figure 3 As shown, Figure 3 Another flowchart of a port resource scheduling method provided for embodiments of this application, the method may include the following steps: 301. Obtain the link connection status of each port in the server in real time.
[0054] 302. If the link connection status indicates a normal connection, collect the operating data of each port.
[0055] In this embodiment of the application, before collecting the operating data of each port, it is also possible to detect whether the port is connected normally. Therefore, the link connection status of each port in the server can be obtained. If the link connection status of each port indicates that the connection is normal, then the collection of the operating data of each port can begin.
[0056] 303. When the resource utilization rate of the first port is detected to exceed the preset threshold, the initial resource ratio of each port is calculated based on the resource utilization rate and resource configuration weight of each port.
[0057] 304. Based on the initial resource percentage of each port, calculate the initial resource allocation for each port.
[0058] 305. If the initial resource allocation for each port is detected to be within the preset resource allocation range, the initial resource ratio will be determined as the target resource ratio.
[0059] In this embodiment, more resources are allocated to busy ports and less resources are allocated to idle ports. However, it is not possible to allocate a large amount of resources to busy ports indefinitely, nor is it possible to allocate too few resources to idle ports. Therefore, a preset resource allocation range can be set for the amount of resources allocated. Only when the resources allocated to each port are within the preset resource allocation range can resource scheduling be performed according to the target resource ratio.
[0060] In some embodiments, the preset resource allocation range can be set by the user or determined based on historical experience. It can usually be set to between one-third and three times the initial allocation amount. The initial allocation amount can be understood as the amount of resources initially allocated to each port, i.e., the average resource allocation for each port. In other words, the amount of resources allocated to each port can not exceed three times the average value and can not be less than one-third of the average value.
[0061] 306. If the initial resource allocation of the second port is detected to be greater than the maximum value of the preset resource allocation range, then the maximum value of the preset resource allocation range is determined as the resource allocation of the second port, and the target resource ratio is updated according to the resource allocation of the second port.
[0062] In this embodiment, if the initial resource allocation amount calculated based on the initial resource ratio of a certain port (taking the second port as an example) is greater than the maximum value of the preset resource allocation range, it indicates that the amount of resources that need to be allocated to the second port is too much and cannot be allocated according to the initial resource allocation amount. Therefore, the maximum value of the preset resource allocation range can be determined as the resource allocation amount of the second port, and the target resource ratio can be recalculated according to the maximum value of the preset resource allocation range. In other words, if the resource ratio of the second port calculated based on the resource utilization rate and resource configuration weight is large, the resource ratio of the second port needs to be reduced, and the resource ratio of other ports can be appropriately increased accordingly.
[0063] 307. If the initial resource allocation of the second port is detected to be less than the minimum value of the preset resource allocation range, the minimum value of the preset resource allocation range shall be determined as the resource allocation of the second port, and the target resource ratio shall be updated according to the resource allocation of the second port.
[0064] In this embodiment, if the initial resource allocation calculated for the second port based on the initial resource ratio is less than the minimum value of the preset resource allocation range, it indicates that the amount of resources to be allocated to the second port is too small and cannot be allocated according to the initial resource allocation. Therefore, the minimum value of the preset resource allocation range can be determined as the resource allocation amount for the second port, and the target resource ratio can be recalculated according to the minimum value of the preset resource allocation range. In other words, if the resource ratio of the second port calculated based on the resource utilization rate and resource allocation weight is small, the resource ratio of the second port needs to be increased, and the resource ratio of other ports can be appropriately reduced accordingly.
[0065] In this embodiment of the application, when performing resource scheduling, it is also necessary to control the resource allocation of each port to be within the preset resource allocation range. This ensures that each port has a certain amount of resources to guarantee normal operation, and also ensures that busy ports have enough resources to use, thereby improving the rationality of resource scheduling.
[0066] 308. Calculate the average value of the initial resource percentage for each port.
[0067] 309. If the initial resource percentage of the third port is less than or equal to the average value, then the initial resource percentage shall be determined as the target resource percentage of the third port.
[0068] 310. If the initial resource percentage of the third port is greater than the average, then the average of all initial resource percentages that are greater than the average shall be determined as the target resource percentage of the third port.
[0069] In this embodiment of the application, after calculating the initial resource percentage corresponding to each port, an average value can be calculated. For ports whose resource percentage is less than or equal to the average value, the target resource percentage can be directly determined without any other processing. For ports whose resource percentage is greater than the average value, the resource percentage can be averaged again. That is, the average value is calculated again for the initial resource percentage that is greater than the average value, and the average value is determined as the target resource percentage of the corresponding port.
[0070] For example, suppose there are 4 ports in total. The initial resource percentage of port A is 10%, that of port B is 30%, that of port C is 20%, and that of port D is 40%. The average initial resource percentage of the 4 ports can be calculated to be 25%. It can be seen that the initial resource percentages of ports A and C are less than the average of 25%. Therefore, the target resource percentage of port A can be directly determined to be 10%, and the initial resource percentage of port C can be determined to be 20%. Then, the average of the initial resource percentages of ports B and D, which are greater than the average of 25%, is calculated to be 35%. Therefore, the target resource percentages of ports B and D are both 35%.
[0071] In this embodiment of the application, by averaging the resource proportions of ports that are higher than the average resource proportion, the resources of ports with high resource utilization can be balanced.
[0072] 311. Write each port into the register according to its corresponding target resource ratio, so as to adjust the resource allocation between ports in the server according to the appearance ratio of each port in the register.
[0073] In this embodiment of the application, before resource scheduling, each port can be written into a register according to its corresponding target resource ratio. That is, the port with a higher target resource ratio appears more often in the register, while the port with a lower target resource ratio appears less often in the register. In this way, when reading data from the register, it is possible to intuitively understand how much resource needs to be allocated to each port.
[0074] For example, port control can be implemented using registers. Suppose there are five ports A, B, C, D, and E. The target resource percentages for each port are calculated to be 10%, 10%, 20%, 30%, and 30%, respectively. The switch will schedule according to the port percentage values in the register. Therefore, the target resource percentages of the five ports A, B, C, D, and E are written to the register. For easier calculation, only the first 100 characters of the 128-character string can be used, and the last 28 characters can be set to FF. Since the resource percentage ratios among the five ports are 1:1:2:3:3, they can be written ten times in the order of ABCCDDDEEE, or they can be written once and then set to FF. For easier calculation, it is recommended to use 100 bits. The calculated target resource percentages are converted into register values and written in this way. Subsequently, resources will be allocated according to the port percentages in the register, thus realizing the underlying resource scheduling.
[0075] In some embodiments, during the entire port resource scheduling method execution process, the information processing module can realize full-process information tracking and storage. The initialization process of the information processing module loads port configuration information and completes the initialization of PCIeSwitch to ensure that the link can work normally. It analyzes and processes the data of the link monitoring module, generates real-time performance data, and can output data for different time intervals and different ports according to interactive commands. Relevant data can also be recorded in memory and flash for users to retrieve, meeting users' needs for monitoring port performance. Any abnormalities or other critical information of other modules that occur during operation are recorded and output through the external interactive interface. Serious alarms are recorded in flash to ensure that they can still be queried after restart.
[0076] By using a PCIe switch as an intermediate device, the usage of link resources is dynamically monitored, performance data is output to the outside world, and resource scheduling of each port is actively performed through intelligent analysis, weighting algorithm, and balancing algorithm, thereby improving the resource utilization efficiency of the link and maximizing performance. At the same time, balancing considerations are taken into account, ports are managed by type, and the resource utilization of ports of the same type is maximized while maintaining balance. Adjustments are made after data changes to move towards balance and ensure balance.
[0077] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0078] like Figure 4 As shown, embodiments of this application also provide a port resource scheduling device, which may include: The acquisition module 401 is used to collect the operating data of each port in the server in real time. The operating data includes the resource utilization rate and resource configuration weight of the corresponding port. Processing module 402 is used to calculate the target resource ratio of each port based on the resource utilization and resource configuration weight of each port when the resource utilization of the first port exceeds a preset threshold. The first port is any one of the ports, and the target resource ratio is the ratio between the amount of resources allocated to the port and the total amount of resources. The processing module 402 is also used to adjust the resource allocation among the ports in the server according to the target resource ratio corresponding to each port, so that the resource allocation of each port meets the target resource ratio.
[0079] In some embodiments, the acquisition module 401 is specifically used to acquire the link connection status of each port in the server in real time; The processing module 402 is specifically used to collect the operating data of each port if the link connection status indicates that the connection is normal.
[0080] In some embodiments, the acquisition module 401 is specifically used to acquire the resource occupation duration corresponding to each port when the resource utilization rate of the first port exceeds a preset threshold. The resource occupation duration is the duration after the port receives the scheduled resources from other ports. The processing module 402 is specifically used to determine the adjustment factor corresponding to each port based on the resource occupation duration when the resource occupation duration is greater than zero. The adjustment factor is negatively correlated with the resource occupation duration. The processing module 402 is specifically used to calculate the target resource ratio for each port based on the resource utilization rate, resource configuration weight, and adjustment factor corresponding to each port.
[0081] In some embodiments, the processing module 402 is specifically used to calculate the initial resource ratio corresponding to each port based on the resource utilization rate and resource configuration weight of each port when the resource utilization rate of the first port exceeds a preset threshold. The processing module 402 is specifically used to calculate the initial resource allocation for each port based on the initial resource ratio for each port. The processing module 402 is specifically used to determine the initial resource ratio as the target resource ratio if it is detected that the initial resource allocation for each port is within the preset resource allocation range.
[0082] In some embodiments, the processing module 402 is further configured to, if it is detected that the initial resource allocation amount of the second port is greater than the maximum value of the preset resource allocation range, determine the maximum value of the preset resource allocation range as the resource allocation amount of the second port, and update the target resource ratio according to the resource allocation amount of the second port. The processing module 402 is further configured to, if it is detected that the initial resource allocation amount of the second port is less than the minimum value of the preset resource allocation range, determine the minimum value of the preset resource allocation range as the resource allocation amount of the second port, and update the target resource ratio according to the resource allocation amount of the second port.
[0083] In some embodiments, the processing module 402 is further configured to calculate the average value of the initial resource percentage corresponding to each port; The processing module 402 is further configured to determine the initial resource percentage as the target resource percentage of the third port if the initial resource percentage of the third port is less than or equal to the average value. The processing module 402 is further configured to determine the average of all initial resource percentages that are greater than the average as the target resource percentage of the third port if the initial resource percentage of the third port is greater than the average.
[0084] In some embodiments, the processing module 402 is specifically used to determine the increase in the resource utilization of the first port when it is detected that the resource utilization of the first port exceeds a preset threshold. The processing module 402 is specifically used to calculate the target resource ratio of each port based on the resource utilization rate and resource configuration weight of each port when the increase in resource utilization rate is within a preset growth range.
[0085] In some embodiments, the processing module 402 is specifically used to determine ports of the same port type as a group of ports according to the port type; The processing module 402 is specifically used to calculate the average resource utilization rate and average resource configuration weight of each group of ports based on the resource utilization rate and resource configuration weight of each port included in each group of ports. The processing module 402 is specifically used to calculate the target resource ratio for each group of ports based on the average resource utilization rate and average resource configuration weight for each group of ports.
[0086] In some embodiments, the processing module 402 is specifically used to write each port into a register according to its corresponding target resource ratio, so as to adjust the resource allocation between ports in the server according to the appearance ratio of each port in the register.
[0087] In the embodiments of this application, the description of the features corresponding to the port resource scheduling device in the embodiments can be found in the relevant description of the port resource scheduling method in the embodiments, and will not be repeated here.
[0088] like Figure 5 As shown, embodiments of this application also provide an electronic device, including a memory 501 and a processor 502. The memory 501 stores a computer program, and the processor 502 is configured to run the computer program to perform the steps in any of the above-described port resource scheduling method embodiments.
[0089] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described port resource scheduling method embodiments at runtime.
[0090] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0091] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described port resource scheduling method embodiments.
[0092] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described port resource scheduling method embodiments.
[0093] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0094] The foregoing has provided a detailed description of the process monitoring of a storage system provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A port resource scheduling method, characterized in that, The method includes: Real-time collection of operational data from each port in the server, including the resource utilization rate and resource configuration weight of the corresponding port; When the resource utilization rate of the first port exceeds the preset threshold, the target resource ratio of each port is calculated based on the resource utilization rate and resource configuration weight of each port. The first port is any one of the ports, and the target resource ratio is the ratio between the amount of resources allocated to the port and the total amount of resources. According to the target resource ratio corresponding to each port, the resource allocation among the ports in the server is adjusted so that the resource allocation of each port meets the target resource ratio.
2. The method according to claim 1, characterized in that, The real-time acquisition server collects operational data from each port, including: The link connection status of each port in the server is obtained in real time. If the link connection status indicates a normal connection, then the operating data of each port is collected.
3. The method according to claim 1, characterized in that, When the resource utilization rate of the first port is detected to exceed a preset threshold, the target resource ratio corresponding to each port is calculated based on the resource utilization rate and resource configuration weight of each port, including: When the resource utilization of the first port is detected to exceed the preset threshold, the resource occupation duration corresponding to each port is obtained, and the resource occupation duration is the duration after the port receives the scheduled resources from other ports; When the resource occupation duration is greater than zero, an adjustment factor corresponding to each port is determined based on the resource occupation duration, and the adjustment factor is negatively correlated with the resource occupation duration. The target resource ratio for each port is calculated based on the resource utilization rate, resource configuration weight, and adjustment factor corresponding to each port.
4. The method according to claim 1, characterized in that, When the resource utilization rate of the first port is detected to exceed a preset threshold, the target resource ratio corresponding to each port is calculated based on the resource utilization rate and resource configuration weight of each port, including: When the resource utilization rate of the first port is detected to exceed the preset threshold, the initial resource ratio of each port is calculated based on the resource utilization rate and resource configuration weight of each port. The initial resource allocation for each port is calculated based on the initial resource percentage for each port. If it is detected that the initial resource allocation for each port is within the preset resource allocation range, then the initial resource ratio is determined as the target resource ratio.
5. The method according to claim 4, characterized in that, After calculating the initial resource allocation for each port based on the initial resource percentage for each port, the method further includes: If the initial resource allocation amount of the second port is detected to be greater than the maximum value of the preset resource allocation range, then the maximum value of the preset resource allocation range is determined as the resource allocation amount of the second port, and the target resource ratio is updated according to the resource allocation amount of the second port. If the initial resource allocation amount of the second port is detected to be less than the minimum value of the preset resource allocation range, then the minimum value of the preset resource allocation range is determined as the resource allocation amount of the second port, and the target resource ratio is updated according to the resource allocation amount of the second port.
6. The method according to claim 4, characterized in that, When the resource utilization rate of the first port is detected to exceed the preset threshold, after calculating the initial resource ratio corresponding to each port based on the resource utilization rate and resource configuration weight, the method further includes: Calculate the average value of the initial resource percentage corresponding to each port; If the initial resource percentage of the third port is less than or equal to the average value, then the initial resource percentage is determined as the target resource percentage of the third port. If the initial resource percentage of the third port is greater than the average value, then the average value among all initial resource percentages that are greater than the average value is determined as the target resource percentage of the third port.
7. The method according to claim 1, characterized in that, When the resource utilization rate of the first port is detected to exceed a preset threshold, the target resource ratio corresponding to each port is calculated based on the resource utilization rate and resource configuration weight of each port, including: When the resource utilization rate of the first port is detected to exceed the preset threshold, the increase in the resource utilization rate of the first port is determined. If the increase in resource utilization is within a preset growth range, the target resource ratio corresponding to each port is calculated based on the resource utilization rate and resource configuration weight of each port.
8. The method according to claim 1, characterized in that, The operational data also includes: the port type of the port; when the resource utilization rate of the first port is detected to exceed a preset threshold, the target resource ratio corresponding to each port is calculated based on the resource utilization rate and the resource configuration weight, including: Based on the port type, ports of the same type are identified as a group of ports; Based on the resource utilization rate of each port included in each group of ports and the resource configuration weight, the average resource utilization rate and average resource configuration weight corresponding to each group of ports are calculated. The target resource percentage for each group of ports is calculated based on the average resource utilization rate and the average resource allocation weight for each group of ports.
9. The method according to claim 1, characterized in that, The step of adjusting the resource allocation among ports in the server according to the target resource ratio corresponding to each port includes: Each port is written into a register according to its corresponding target resource ratio, so as to adjust the resource allocation among the ports in the server according to the appearance ratio of each port in the register.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the port resource scheduling method as described in any one of claims 1 to 9 when executing the computer program.
Citation Information
Patent Citations
Resource distribution method and device
CN103560979A
Port resource allocation method and device, equipment, storage medium and program product
CN118426937A
Resource allocation method, server, storage medium and program product
CN119621349A
Resource allocation method and device of PCIe equipment, storage medium and equipment
CN119938321A
Resource management method, system, device and equipment of NVMe controller system and medium
CN120523400A