Port resource scheduling method and electronic device
By collecting and calculating the resource utilization and weight of ports in real time, the resource allocation between ports is adjusted, which solves the problem of fixed link resource allocation in the server, realizes dynamic allocation and balanced utilization of port resources, and improves server performance.
Patent Information
- Application Number
- CN202511549172.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2045-10-28
AI Technical Summary
In servers, the link resources allocated to each port are fixed and cannot be dynamically adjusted, resulting in some ports being overloaded while others are idle, leading to uneven resource utilization and affecting server performance.
Real-time collection of operational data from each port on the server, including resource utilization and configuration weights, calculation of the target resource ratio, and adjustment of resource allocation between ports based on this ratio to meet the target resource ratio of each port.
By dynamically monitoring port link resource usage, we can improve the efficiency of port link resource utilization, optimize server performance, and ensure a balanced allocation of resources across all ports.
Smart Images

Figure CN121029366B_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, resource allocation and data transmission between a central processing unit and various components are performed through ports. During the operation of the server, some ports are heavily loaded, while some ports are relatively idle. However, the resources between the various ports cannot be shared, 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:
[0005] Real-time collection of operation data of each port in a server, wherein the operation data includes resource utilization rate and resource configuration weight corresponding to the port;
[0006] When it is detected that the 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 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 a ratio between the amount of resource allocated to the port and the total amount of resource;
[0007] According to the target resource proportions corresponding to each port, the resource allocation between the ports in the server is adjusted so that the resource allocation of each port meets the target resource proportion.
[0008] The present application also provides a port resource scheduling device, comprising:
[0009] An acquisition module for real-time collection of operation data of each port in a server, wherein the operation data includes resource utilization rate and resource configuration weight corresponding to the port;
[0010] A processing module for calculating target resource proportions corresponding to each port according to the resource utilization rate and the resource configuration weight corresponding to each port when it is detected that the resource utilization rate of a first port exceeds a preset threshold, 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;
[0011] The processing module is also used for adjusting the resource allocation between the ports in the server according to the target resource proportions corresponding to each port so that the resource allocation of each port meets the target resource proportion.
[0012] The application further provides an electronic device, comprising a memory for storing a computer program, and a processor for executing the computer program to implement the steps of any of the port resource scheduling methods.
[0013] The application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the steps of any of the port resource scheduling methods.
[0014] The application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of any of the port resource scheduling methods.
[0015] 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, and the resource allocation between the ports is adjusted, so as to improve the resource usage efficiency of the port link and improve the server performance as much as possible. BRIEF DESCRIPTION OF DRAWINGS
[0016] 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 labor.
[0017] Figure 1 A PCIe Switch expansion topology diagram is provided for the embodiments of the application.
[0018] Figure 2 A port resource scheduling method flow is provided for the embodiments of the application Figure 1 ;
[0019] Figure 3 A port resource scheduling method flow is provided for the embodiments of the application Figure 2 ;
[0020] Figure 4A structural diagram of a port resource scheduling device provided by an embodiment of the present application is shown in FIG. 1.
[0021] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 2. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. 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 work fall within the protection scope of the present application.
[0023] 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 containing, so that a 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 a 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 intended to describe a specific order or sequence.
[0024] 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.
[0025] With the development of AI servers, the peripheral component interconnect express (PCIe) topology is becoming more and more complex, and the number of external device models 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 drives, network cards, etc.), aiming to replace the traditional parallel bus architecture (such as PCI, AGP), providing higher bandwidth and lower latency. Most of them rely on PCIe Switch to expand the PCIe topology, whether it is to expand hard drives, GPUs or network cards. PCIe Switch is a hardware device used to expand and manage PCIe bus connections. Its core function is to connect to the CPU's root complex (RC) through an upstream port (Upstream Port) and connect to endpoint 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.
[0026] In actual use, PCIe Switch allocates hardware resources such as queue buffers according to port, which determines how many instructions can be processed at the same time. This processing method is simple and direct, but it cannot be dynamically allocated, and it cannot be dynamically allocated in some cases where the load of some ports is heavy, and it cannot be optimized for use. Some Switches can support intra-station sharing, and when the number of expansion ports in different stations is inconsistent, the station with fewer expansion ports will get more resources, causing the same type of expansion port, such as hard drives, to have a large performance difference, causing users to be confused. In addition, there is a lack of real-time traffic data in the current PCIe link, and the current method usually requires external monitoring ports and tools to capture, which is not conducive to collecting real-time data and historical data in a business environment.
[0027] For example, Figure 1The diagram shows a typical PCIe Switch expansion topology in existing technology. It can be seen that the PCIe Switch connects to the CPU via two uplink ports, expanding to two GPU ports, two network interface card ports, and two hard drive ports. Typically, the uplink and GPU are both x16, occupying one PCIe Switch station. NVMe is generally x4, with one station divided into two or four NVMe hard drive ports. Link resources, such as queues, are allocated according to bandwidth. This typical topology has the following problems in practical use: Services are usually not simultaneously at full capacity. For example, GPU1 may experience high load, filling the queue cache with data or instructions, while other ports have very little data. In this case, the GPU ports cannot share queue resources with other ports, resulting in some ports being idle and others insufficient. Additionally, there are differences in the splitting of ports across different stations. For example, one station might split four x4 ports, another two x4 ports, and the rest unused. In certain performance testing scenarios, this can cause slight differences in data across these x4 ports, causing confusion for users.
[0028] In summary, the following issues can be identified in the current server ports: link traffic and performance data require additional tools to obtain; link resource allocation is fixed and cannot be dynamically adjusted; and there is an imbalance in the number of expansion devices of the same type and bandwidth.
[0029] 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.
[0030] 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.
[0031] like Figure 2 As shown, Figure 2A flowchart of a port resource scheduling method provided for embodiments of the present application can include the following steps:
[0032] 201. Real-time collection of running data of each port in the server.
[0033] In embodiments of the present application, a plurality of ports can be provided in the server, through which data transmission and data processing can be performed with a plurality of external devices. In order to ensure the normal operation of the port link, a certain resource needs to be allocated to each port. The running data of each port in the server can be collected in real time, which can specifically include the resource utilization rate and resource configuration weight corresponding to the port.
[0034] It should be noted that the resource utilization rate is a data that can be used to measure the resource use efficiency of the port in the normal use and operation process, that is, the ratio of the actual used port resource (such as bandwidth, connection number, etc.) to the total resource capacity of the port, which is usually expressed in percentage. This index is used to measure the use efficiency of the port resource, and reflects the utilization degree of the port resource in the network or system.
[0035] 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 for resource allocation. The higher the resource configuration weight, the more resources the port needs. The resource allocation can be skewed through the resource configuration weight of each port, and the resource allocation will be given priority to the port with higher resource configuration weight. The resource configuration weight is only the weight of each port itself, and does not limit the total sum of 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 resource can meet the port operation, the resource configuration weight of the port can be 1, that is, no additional resource needs to be allocated, nor does the resource need to be taken away from other ports. If the resource of a port is not enough, the resource configuration weight of the port can be set to a value greater than 1. If the resource of a port is too idle and can be evenly distributed to other ports, the resource configuration weight of the port can be set to a value less than 1.
[0036] 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.
[0037] In the embodiments of the present application, the first port can be any of the ports, that is, if the resource utilization of any port exceeds the preset threshold, it can be indicated that the first port has less available resources, and the remaining resource allocation amount can be insufficient to ensure the normal operation of the port link, and therefore the resource scheduling between the ports can be performed again, and the resources of other relatively idle ports can be scheduled to the first port for use.
[0038] The preset threshold can be a preset threshold (such as 75%, 85%, etc.), which can be set by itself or determined according to historical experience, and the embodiments of the present application do not make specific limitations.
[0039] It should be noted that the specific way of measuring how much resource each port needs can be calculated according to the resource utilization and the resource allocation weight. The higher the resource utilization indicates that the port needs to continue to allocate resources, the lower the resource utilization indicates that the port does not need to allocate resources, and even can reduce resources, and the resource allocation weight can indicate the demand degree of each port for resource allocation, and therefore the target resource proportion of each port is calculated according to the resource utilization and the resource allocation weight corresponding to each port. The target resource proportion can be understood as the ratio between the resource amount allocated to the port and the total resource amount.
[0040] In some embodiments, the target resource proportions of each port are added, and the sum needs to be 100%. The specific calculation method of the target resource proportion can include: multiplying the resource utilization and the resource allocation weight corresponding to each port to obtain the product corresponding to each port; and based on the product corresponding to each port, the target resource proportion corresponding to each port is calculated.
[0041] 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.
[0042] For example, assuming 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 respectively, 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, and thus 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 amount needs to be allocated to port B, and 45% of the resource amount needs to be allocated to port C.
[0043] 203. Adjust the resource allocation among the ports in the server according to the target resource proportions corresponding to the ports, so that the resource allocation of each port meets the target resource proportion.
[0044] In the embodiments of the present application, after the target resource proportions corresponding to the 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 this 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 this 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 the port.
[0045] For example, assuming there are 100 resource amounts in total, and there are three ports, the target resource proportion corresponding to port A is 17%; the target resource proportion corresponding to port B is 38%; and the target resource proportion corresponding to port C is 45%, then 17 resource amounts can be allocated to port A, 38 resource amounts can be allocated to port B, and 45 resource amounts can 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 only has 17 resource amounts, port B includes 38 resource amounts after receiving 3 resource amounts, and port C includes 45 resource amounts after receiving 15 resource amounts, which meet the target resource proportions corresponding to port A, port B, and port C respectively.
[0046] 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 of the port and resource configuration weight; when it is detected that the resource utilization of a first port exceeds a preset threshold, target resource proportions of each port are calculated according to the resource utilization of each port and the resource configuration weight, 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; resource allocation between the ports in the server is adjusted according to the target resource proportion of 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 proportions between the ports are determined by calculating the utilization and the weight, and the resource allocation between the ports is adjusted, thereby improving the resource usage efficiency of the port link and improving the server performance as much as possible.
[0047] In some embodiments, if an exception occurs in the resource scheduling process or an appropriate amount of resources cannot be scheduled to the port, the resource scheduling is stopped, and the resource of each port is adjusted to the initial allocation amount.
[0048] In some embodiments, the port running data, the resource scheduling process and the resource scheduling result at each resource scheduling can also be recorded, 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 in subsequent resource scheduling.
[0049] In some embodiments, in the resource scheduling process, some important ports or complex business ports require a large amount of resources, so the resources in the port can include resources scheduled by other ports, 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 of a first port exceeds a preset threshold, target resource proportions of each port are calculated according to the resource utilization of each port and the resource configuration weight, which can specifically include: when it is detected that the resource utilization of a first port exceeds a preset threshold, an occupied resource duration of each port is obtained; when the occupied resource duration is greater than zero, a regulation factor of each port is determined according to the occupied resource duration; target resource proportions of each port are calculated according to the resource utilization of each port, the resource configuration weight and the regulation factor.
[0050] It should be noted that the occupied resource time length is the time length after the port receives the scheduling resource of other ports, that is, if a port does not receive the scheduling resource of other ports, the occupied resource time length of the port is 0, indicating that the port does not need to calculate the adjustment factor; if a port receives the scheduling resource of other ports, the occupied resource time length of the port can be started to be counted, and the adjustment factor is adjusted according to the accumulation of the occupied resource time length, the adjustment factor is negatively related to the occupied resource time length, that is, the longer the time length of occupying the resource of other ports, the smaller the adjustment 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 adjustment factor corresponding to each port. The way of calculating the target resource proportion can refer to the description in step 202, after introducing the adjustment factor, the product of the resource utilization rate, the resource configuration weight and the adjustment factor can be calculated, and then the proportion between each product can be mapped into 100% to obtain the target resource proportion corresponding to each port.
[0051] It should be noted that the adjustment factor is a value greater than 0, which can be understood as that the longer the time length of occupying the resource of other ports, the smaller the adjustment factor; the shorter the time length of occupying the resource of other ports, the larger the adjustment factor. In this way, if a port occupies the resource of other ports for a long time, it is necessary to try not to allocate resources to this port, that is, a port cannot always occupy too much resource to run; and the short occupied resource time length of a port indicates that the port has just started to occupy the resource of other ports, which may be that the current business is complex and needs more resources, so it is necessary to try to allocate more resources.
[0052] Among them, in order to measure the length of the occupied resource time length, an occupied time length mean value can be set, which can be determined according to experience or obtained by statistical analysis of historical running data. The occupied resource time length is compared with the occupied time length mean value. If the occupied resource time length is greater than the occupied time length mean value, it indicates that the port has occupied the resource for a long time, so it cannot continue to allocate a large amount of resources, and therefore the adjustment factor can be set to a value less than 1 (the greater the occupied resource time length, the closer the adjustment factor to 0, such as 0.8, 0.6, 0.3, 0.2, etc.), and the resource allocation amount is reduced; if the occupied resource time length is less than the occupied time length mean value, it indicates that the port has occupied the resource for a short time, and a large amount of resources can still be allocated, so the adjustment factor can be set to a value greater than 1 (the smaller the occupied resource time length, the greater the adjustment factor than 1, such as 1.2, 1.5, 1.8, 2.5, etc.), and the resource allocation amount is increased; and if the occupied resource time length is equal to the occupied time length mean value, the adjustment factor can be 1.
[0053] Further, in order to measure the length of the occupied resource time, a time interval can also be set, and according to the time interval in which the occupied resource time is located, a corresponding adjustment factor is determined.
[0054] In the embodiments of the present application, on the basis of the resource utilization rate and the resource configuration weight, an adjustment factor is further introduced for calculating the resource proportion, and the adjustment factor is negatively correlated with the occupied resource time of the port, so that the port can be allocated with a large amount of resources at the initial stage of resource scheduling, while avoiding that a certain port occupies a large amount of resources for a long time.
[0055] In some embodiments, the resource utilization rate of the port can indicate the ratio between the amount of resources being used and the total amount of resources of the port, and both the amount of resources being used and the total amount of resources of the port are variables in the resource scheduling process. Therefore, the current resource scheduling demand of the port cannot be accurately measured by only the resource utilization rate at the current time. For example, if the resource utilization rate of a certain port is low at a certain time, it cannot be determined whether the resource utilization rate is low because the port has no business to process or the port is allocated with too many resources. Similarly, if the resource utilization rate of a certain port is high at a certain time, it cannot be determined whether the resource utilization rate is high because the port needs to process a large amount of complex business or the port is allocated with too few resources. Therefore, 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 corresponding to each port and the resource configuration weight. Specifically, when it is detected that the resource utilization rate of the first port exceeds the preset threshold, the resource utilization rate growth of the first port is determined. If the resource utilization rate growth is within a preset growth range, the target resource proportion corresponding to each port is calculated according to the resource utilization rate corresponding to each port and the resource configuration weight.
[0056] It should be noted that the resource utilization rate of the port can change in real time. When the resource utilization rate of the first port exceeds the preset threshold, the resource utilization rate of the first port can increase from a value lower than the preset threshold to a value greater than the preset threshold. Therefore, the resource utilization rate growth of the first port can be calculated, that is, the change amount of the resource utilization rate of the first port within a period of time can be counted. If the resource utilization rate growth is within the preset growth range, it indicates that the resource utilization rate of the first port is gradually increasing normally. Therefore, the target resource proportion corresponding to each port can be calculated according to the resource utilization rate corresponding to each port and the resource configuration weight, so as to perform resource scheduling. If the resource utilization rate growth is not within the preset growth range, it can be indicated that the resource utilization rate of the first port is suddenly increased, which may not be the resource utilization rate affected by business. Therefore, resource scheduling can not be performed.
[0057] It should be noted that it is also possible that the resource utilization of some ports is reduced from a value greater than the preset threshold to a value less than the preset threshold, and the resource utilization reduction is not within the preset increase range, and resource scheduling is not performed.
[0058] In the embodiment of the present application, resource scheduling is performed only when the resource utilization increase of the first port is within the preset increase range, which can make the resource utilization change stably and avoid the situation that the resource utilization increases or decreases greatly due to the change of the total resource amount of the port.
[0059] In some embodiments, the server includes multiple ports, and some ports have the same port type and can be responsible for the same business. Therefore, the resources of the ports of the same type can be balanced to avoid the imbalance of resource allocation among the ports of the same type. Therefore, when collecting the running data of each port, the port type can also be included in the running data. When it is detected that the resource utilization of the first port exceeds the preset threshold, the target resource proportion of each port is calculated according to the resource utilization and the resource configuration weight of each port. Specifically, the ports of the same type can be determined as a group of ports according to the port type. The average resource utilization and the average resource configuration weight of each group of ports are calculated according to the resource utilization and the resource configuration weight of each port included in each group of ports. The target resource proportion of each group of ports is calculated according to the average resource utilization and the average resource configuration weight of each group of ports.
[0060] It should be noted that after collecting the port type of each port, the ports of the same type can be divided into a group, so that at least one group of ports can be obtained, and each group of ports can include at least one port. In order to calculate the resource proportion of a group of ports, the average value of the resource utilization and the resource configuration weight of all ports in the group of ports can be calculated, that is, the average value of the resource utilization and the resource configuration weight of all ports of the same type is calculated as the average resource utilization and the average resource configuration weight of a group of ports, and then the target resource proportion of a group of ports is calculated according to the average resource utilization and the average resource configuration weight. The target resource proportion can be understood as the target resource proportion of each port in the group of ports, and the target resource proportion of each port in a group of ports is the same.
[0061] In the embodiment of the present application, the ports of the same type are divided into a group, and resource scheduling is not needed for each port, but only for each group of ports, which reduces the calculation amount and ensures the consistency of resource allocation of the ports of the same type, and achieves the resource balance of the ports of the same type.
[0062] 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.
[0063] 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.
[0064] 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:
[0065] 301. Obtain the link connection status of each port in the server in real time.
[0066] 302. If the link connection status indicates a normal connection, collect the operating data of each port.
[0067] 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.
[0068] 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.
[0069] 304. Based on the initial resource percentage of each port, calculate the initial resource allocation for each port.
[0070] 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.
[0071] In the embodiments of the present application, more resources are allocated to the busy ports and less resources are allocated to the idle ports. However, the busy ports cannot be allocated with a large amount of resources without limit, and the idle ports cannot be allocated with too few resources. Therefore, a preset resource allocation range can be set for the resource allocation amount. Only when the resources allocated to each port are within the preset resource allocation range, the resource scheduling can be performed according to the target resource proportion.
[0072] In some embodiments, the preset resource allocation range can be set by itself or determined according to historical experience. Generally, the preset resource allocation range can be set to be between one third and three times of an initial allocation amount. The initial allocation amount can be understood as the resource amount initially allocated to each port, that is, the average value of the resource allocation of each port. In other words, the resource amount allocated to each port cannot exceed three times of the average value, and cannot be less than one third of the average value.
[0073] 306. 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, the maximum value of the preset resource allocation range is determined as the resource allocation amount of the second port, and the target resource proportion is updated according to the resource allocation amount of the second port.
[0074] In the embodiments of the present application, if the initial resource allocation amount of a certain port (the second port is taken as an example) calculated according to the initial resource proportion is greater than the maximum value of the preset resource allocation range, it indicates that the resource amount currently required to be allocated to the second port is too large, and the initial resource allocation amount cannot be allocated. 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 proportion is recalculated according to the maximum value of the preset resource allocation range. In other words, the resource proportion of the second port calculated according to the resource utilization rate and the resource configuration weight is large, and the resource proportion of the second port needs to be reduced. Correspondingly, the resource proportion of other ports can be appropriately increased.
[0075] 307. 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, the minimum value of the preset resource allocation range is determined as the resource allocation amount of the second port, and the target resource proportion is updated according to the resource allocation amount of the second port.
[0076] In the embodiment of the present application, if the initial resource allocation calculated by the second port according to the initial resource proportion is less than the minimum value of the preset resource allocation range, it indicates that the resource amount currently needed to be allocated to the second port is too small and cannot be allocated according to the initial resource allocation amount, and therefore the minimum value of the preset resource allocation range can be determined as the resource allocation amount of the second port, and the target resource proportion is recalculated according to the minimum value of the preset resource allocation range, that is, the resource proportion of the second port calculated according to the resource utilization rate and the resource configuration weight is small, and the resource proportion of the second port needs to be increased, and correspondingly the resource proportions of other ports can be appropriately reduced.
[0077] In the embodiment of the present application, when performing resource scheduling, the resource allocation amounts of various ports also need to be controlled to be within the preset resource allocation range, so that each port has a certain resource guarantee for normal operation at the minimum, and the busy port is ensured to have sufficient resource usage as much as possible, and the rationality of resource scheduling is improved.
[0078] 308、Calculate the average value of the initial resource proportions corresponding to various ports.
[0079] 309、If the initial resource proportion of the third port is less than or equal to the average value, the initial resource proportion is determined as the target resource proportion of the third port.
[0080] 310、If the initial resource proportion of the third port is greater than the average value, the average value between all initial resource proportions greater than the average value is determined as the target resource proportion of the third port.
[0081] In the embodiment of the present application, after the initial resource proportions corresponding to various ports are calculated, the average value can be calculated, the target resource proportion of the port with the resource proportion less than or equal to the average value can be directly determined, and no other processing is performed; the resource proportion of the port with the resource proportion greater than the average value can be averaged again, that is, the average value of the initial resource proportions greater than the average value is calculated again, and the average value is determined as the target resource proportion of the corresponding port.
[0082] For example, assuming that there are four ports in total, the initial resource proportion of port A is 10%, the initial resource proportion of port B is 30%, the initial resource proportion of port C is 20%, and the initial resource proportion of port D is 40%, the average value of the initial resource proportions of the four ports can be calculated as 25%, it can be seen that the initial resource proportions of port A and port C are less than the average value 25%, and therefore the target resource proportion of port A is directly determined as 10%, and the initial resource proportion of port C is 20%, and then the average value of the initial resource proportions of port B and port D greater than the average value 25% is calculated as 35%, and therefore the target resource proportions of port B and port D are both 35%.
[0083] In the embodiments of the present application, by re-averaging the resource occupancy of the ports higher than the average value of the resource occupancy, the resource of the ports with high resource utilization can be balanced.
[0084] 311、write each port into the register according to the corresponding target resource occupancy, so as to adjust the resource allocation among the ports in the server according to the occurrence proportion of each port in the register.
[0085] In the embodiments of the present application, before resource scheduling, each port can be written into the register according to the corresponding target resource occupancy, that is, the port with high target resource occupancy appears more frequently in the register, and the port with low target resource occupancy appears less frequently in the register, so that when reading data from the register, it can be intuitively understood how much resource needs to be allocated to each port.
[0086] For example, the register is used to implement port control. It is assumed that there are five ports ABCDE, and the target resource occupancy of each port is calculated as 10%, 10%, 20%, 30% and 30% respectively. The switch will schedule according to the occurrence proportion of the ports in the register. Therefore, the target resource occupancy of the five ports ABCDE is written into the register. In order to facilitate calculation, only the first 100 characters of 128 characters can be used, and the last 28 characters are set to FF. Since the proportion of resource occupancy among the five ports is 1:1:2:3:3, the target resource occupancy can be written in the form of ABCCDDDEEE for ten times, or written once and then set to FF. In order to facilitate calculation, 100 bits are recommended. The target resource occupancy calculated is converted into register writing according to the above method. Subsequently, resource allocation will be performed according to the occurrence proportion of the ports in the register, and the underlying resource scheduling is realized.
[0087] In some embodiments, during the entire execution of the port resource scheduling method, the information processing module can be used to track and store information throughout the process. The initialization process of the information processing module loads the port configuration information and completes the initialization of the PCIe switch to ensure that the link works normally. The link monitoring module data is analyzed and processed to generate real-time performance data. Different time intervals and different port data can be output according to the interactive instructions. Related data can also be recorded in the memory and flash for users to retrieve, meeting the user's demand for monitoring port performance. For abnormal situations that occur during operation or other important information of the module, they are recorded and output through the external interactive interface. Serious alarm records are recorded in the flash to ensure that they can still be queried after restarting.
[0088] By using the PCIe Switch intermediate device, the link resource usage is dynamically monitored, performance data is output, intelligent analysis, weight algorithm and balancing algorithm are used for processing, and resource scheduling of each port is actively performed, so that the resource usage efficiency of the link is improved, the performance is as high as possible, and balanced consideration is taken into account, the ports are managed in types, the resource utilization rate of the same type of port is as high as possible, and balancing is as much as possible, the data is adjusted after the change and in the direction of balancing, and the balancing is ensured.
[0089] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and necessary general hardware platforms, and of course, it can also be realized by hardware, but in many cases, the former is a better embodiment.
[0090] As shown in Figure 4 The embodiments of the application also provide a port resource scheduling device, which can include:
[0091] The acquisition module 401 is configured to collect running data of each port in the server in real time, and the running data includes resource utilization rate and resource configuration weight corresponding to the port;
[0092] The processing module 402 is configured to calculate target resource proportions corresponding to each port according to the resource utilization rate and the resource configuration weight corresponding to each port when detecting that the resource utilization rate of the first port exceeds the preset threshold, the first port being any one of the ports, and the target resource proportion being a ratio between the resource amount allocated to the port and the total resource amount;
[0093] The processing module 402 is further configured to adjust the resource allocation between the ports in the server according to the target resource proportions corresponding to each port, so that the resource allocation amount of each port meets the target resource proportion.
[0094] In some embodiments, the acquisition module 401 is specifically configured to acquire the link connection state of each port in the server in real time.
[0095] The processing module 402 is specifically configured to collect the running data of each port if the link connection state indicates that the connection is normal.
[0096] In some embodiments, the acquisition module 401 is specifically configured to acquire the occupied resource duration corresponding to each port when detecting that the resource utilization rate of the first port exceeds the preset threshold, the occupied resource duration being a duration after the port receives the scheduling resource of other ports.
[0097] The processing module 402 is specifically configured to determine an adjustment factor corresponding to each port according to the occupied resource duration in a case where the occupied resource duration is greater than zero, the adjustment factor being negatively correlated with the occupied resource duration.
[0098] The processing module 402 is specifically configured to calculate a target resource proportion corresponding to each port according to the resource utilization ratio corresponding to each port, the resource configuration weight, and the adjustment factor.
[0099] In some embodiments, the processing module 402 is specifically configured to, when it is detected that the resource utilization ratio of the first port exceeds the preset threshold, calculate an initial resource proportion corresponding to each port according to the resource utilization ratio corresponding to each port and the resource configuration weight.
[0100] The processing module 402 is specifically configured to calculate an initial resource allocation amount corresponding to each port according to the initial resource proportion corresponding to each port.
[0101] The processing module 402 is specifically configured to, if it is detected that the initial resource allocation amount corresponding to each port is within a preset resource allocation range, determine the initial resource proportion as the target resource proportion.
[0102] 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 proportion according to the resource allocation amount of the second port.
[0103] 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 proportion according to the resource allocation amount of the second port.
[0104] In some embodiments, the processing module 402 is further configured to calculate an average value of the initial resource proportions corresponding to each port.
[0105] The processing module 402 is further configured to, if the initial resource proportion of the third port is less than or equal to the average value, determine the initial resource proportion as the target resource proportion of the third port.
[0106] The processing module 402 is further configured to, if the initial resource proportion of the third port is greater than the average value, determine an average value between all initial resource proportions greater than the average value as the target resource proportion of the third port.
[0107] In some embodiments, the processing module 402 is specifically configured to, when it is detected that the resource utilization ratio of the first port exceeds the preset threshold, determine a resource utilization ratio growth amount of the first port.
[0108] The processing module 402 is specifically configured to, if the resource utilization growth amount is within a preset growth range, calculate a target resource proportion corresponding to each port according to the resource utilization of each port and the resource configuration weight corresponding to each port.
[0109] In some embodiments, the processing module 402 is specifically configured to determine ports of the same port type as a group of ports according to the port type.
[0110] The processing module 402 is specifically configured to calculate an average resource utilization and an average resource configuration weight corresponding to each group of ports according to the resource utilization of each port included in each group of ports and the resource configuration weight.
[0111] The processing module 402 is specifically configured to calculate a target resource proportion corresponding to each group of ports according to the average resource utilization and the average resource configuration weight corresponding to each group of ports.
[0112] In some embodiments, the processing module 402 is specifically configured to write each port into a register according to the target resource proportion corresponding to each port, so as to adjust the resource allocation between ports in the server according to the occurrence proportion of each port in the register.
[0113] In the embodiments of the present application, the features of the embodiments of the port resource scheduling device can be referred to the related descriptions of the embodiments of the port resource scheduling method, which will not be repeated here.
[0114] As shown in FIG. 5, Figure 5 The embodiments of the present application further provide an electronic device, which comprises 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 execute the steps in any of the above-mentioned embodiments of the port resource scheduling method.
[0115] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to execute the steps in any of the above-mentioned embodiments of the port resource scheduling method when running.
[0116] In an exemplary embodiment, the above-mentioned computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0117] The embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program realizes the steps in any of the above-mentioned port resource scheduling method embodiments when executed by a processor.
[0118] The embodiment of the present application further provides another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program realizes the steps in any of the above-mentioned port resource scheduling method embodiments when executed by a processor.
[0119] Those skilled in the art will further appreciate that the steps of the example methods described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various examples have been described generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled persons can implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
[0120] The above describes in detail the process monitoring of the storage system provided by the present application. The principles and implementation manners of the present application are described by using specific examples in the present application. The above description of the examples is only used to help understand the method of the present application and its core idea. It should be pointed out that, for those skilled in the art, some improvements and modifications can be made to the present application without departing from the principles of the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A port resource scheduling method, characterized in that, The method includes: Real-time collection of operating data from each port in the server, including the resource utilization rate and resource configuration weight of the port, wherein the resource configuration weight is used to indicate the port’s demand for resource allocation, and the resource configuration weights of each port are independent of each other; When the resource utilization rate of the first port exceeds a 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. The target resource ratio is the ratio between the amount of resources allocated to the port and the total amount of resources. The sum of the target resource ratios of each port is 1. 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 rate 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 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. 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