WO2017202108A1 - Resource allocation method and apparatus for distributed system - Google Patents

Resource allocation method and apparatus for distributed system Download PDF

Info

Publication number
WO2017202108A1
WO2017202108A1 PCT/CN2017/076347 CN2017076347W WO2017202108A1 WO 2017202108 A1 WO2017202108 A1 WO 2017202108A1 CN 2017076347 W CN2017076347 W CN 2017076347W WO 2017202108 A1 WO2017202108 A1 WO 2017202108A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
resources
occupied
configuration
preliminary
Prior art date
Application number
PCT/CN2017/076347
Other languages
French (fr)
Chinese (zh)
Inventor
杨磊
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017202108A1 publication Critical patent/WO2017202108A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Definitions

  • the present disclosure relates to the field of computer technologies, and in particular, to a resource configuration method and apparatus for a distributed system.
  • a distributed system is formed by distributed transformation of the communication system.
  • a distributed system is a software system built on top of a network. It is a computer system composed of a plurality of interconnected computing units, wherein each computing unit performs the same task in cooperation under the control of the entire system, and can achieve at least a centralized program, data or hardware-dependent effect. These computing units may be geographically adjacent or geographically dispersed.
  • the main technical problem to be solved by the present disclosure is to provide a resource optimization configuration solution, which is used to solve the problem that the resource allocation in the prior art can only be performed for a certain resource and cannot be distributed according to multiple resources. Technical problems with unreasonable system resource allocation.
  • the present disclosure provides a resource configuration method for a distributed system, including:
  • the standard resource is any one of the resources or any one of the resources.
  • the preliminary configuration scheme of acquiring the current to-be-configured processes on each computing unit includes:
  • the to-be-configured processes other than the specific process are randomly configured to each of the computing units.
  • the manner of calculating, according to the equivalent quantization relationship, the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios includes:
  • the preliminary configuration scheme that selects the pseudo-occupied resource of each of the computing units to meet a preset condition according to the calculation result includes:
  • the preliminary configuration scheme of the most averaging resources of each of the computing units is selected as the destination configuration scheme.
  • the preliminary configuration scheme for selecting the most averaging of the resources to be occupied by each of the computing units as the destination configuration solution includes:
  • the preliminary configuration scheme in which the characterization value is the smallest is selected as the destination configuration scheme.
  • the present disclosure also provides a resource configuration apparatus for a distributed system, including:
  • the relationship obtaining module is configured to obtain an equivalent quantization relationship of each resource, where the equivalent quantization relationship is a conversion relationship that quantizes each of the resources into a standard resource;
  • An occupancy calculation module configured to calculate, according to the equivalent quantization relationship, a planned occupied resource of each of the computing units in each of the preliminary configuration scenarios, where the planned occupied resource is the one to which the computing unit is to be dispatched Standard resources occupied by the process to be configured;
  • the solution selection module is configured to select, according to the calculation result, a preliminary configuration scheme that the planned occupied resource of each of the computing units meets a preset condition as a destination configuration scheme.
  • the occupancy calculation module includes at least one of the following:
  • a first calculation module configured to calculate, according to the equivalent quantization relationship, a standard resource that is required to be used when each of the to-be-configured processes is running;
  • a second calculating module configured to calculate a standard resource occupied by each of the computing units in each of the preliminary configuration schemes by the to-be-configured process
  • a third calculating module configured to calculate an actual resource occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes
  • a fourth calculating module configured to calculate, according to the equivalent quantization relationship, a standard resource occupied by each of the computing units in each of the preliminary configuration scenarios by each of the to-be-configured processes.
  • the solution selection module includes:
  • the uniform selection module is configured to select a preliminary configuration scheme of the most averaging resources of each of the computing units as the destination configuration scheme.
  • the uniform selection module includes:
  • a fifth calculating module configured to calculate a variance of the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios
  • a variance selection module configured to select the preliminary configuration scheme with the smallest variance value as the destination configuration scheme
  • a sixth calculation module configured to calculate a difference between the two occupied resources of each of the computing units in each of the preliminary configuration scenarios
  • Characterizing a selection module configured to select a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme
  • the most value selection module is configured to select the preliminary configuration scheme in which the representation value is the smallest as the destination configuration scheme.
  • the resource configuration method of the distributed system proposed by the present disclosure obtains various resources occupied by each to-be-configured process.
  • the equivalent quantitative relationship and then normalize the resources occupied by the processes allocated to each of the computing units in the various preliminary configuration schemes, and finally select a preliminary configuration scheme that meets the preset requirements according to the calculation result as the final configuration.
  • the various quantitative resources occupied by the process can be uniformly quantized by the equivalent quantitative relationship of each resource, so that different resources have the conditions for calculation and comparison.
  • the optimal resource configuration scheme can be selected according to the preset requirements, the resource optimization configuration of the distributed system is realized, and the resource utilization rate is improved.
  • FIG. 1 is a flowchart of a resource configuration method of a distributed system according to Embodiment 1 of the present disclosure
  • FIG. 3 is a flowchart of a selection destination configuration scheme according to Embodiment 1 of the present disclosure
  • FIG. 4 is another flowchart of a selection destination configuration scheme according to Embodiment 1 of the present disclosure.
  • FIG. 5 is a schematic structural diagram of a resource configuration apparatus of a distributed system according to Embodiment 2 of the present disclosure
  • FIG. 6 is a schematic structural view of the preliminary determining module of FIG. 5;
  • FIG. 7 is a schematic structural view of the occupancy calculation module of FIG. 5;
  • FIG. 8 is another schematic structural diagram of the occupancy calculation module of FIG. 5;
  • FIG. 9 is a schematic structural view of the scheme selection module of FIG. 5;
  • FIG. 10 is a schematic structural view of the uniform selection module of FIG. 9;
  • FIG. 11 is another schematic structural view of the uniform selection module of FIG. 9.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • This embodiment provides a resource configuration method for a distributed system.
  • the method includes:
  • a process When a process runs on a computing unit, it consumes resources such as CPU, memory, hard disk, and network bandwidth of the computing unit.
  • the CPU uses core ("core") as the unit of measurement
  • the unit of memory is GB (gigabytes)
  • the unit of hard disk I/O Input/Output, input/output
  • MB/s megabits per second
  • network bandwidth is measured in bps.
  • a process a runs on computing unit A, which requires CPUs of A computing unit 2core and 64 GB of memory, and hardly occupies hard disk and network bandwidth.
  • Process b runs on computing unit B. Since the algorithm is not very complicated, the CPU requirements are very low, but it requires 32 GB of memory and 100 MB/s of hard disk I/O. According to the prior art scheme, it is difficult to judge. Which of the processes a and b consumes more computing units, too It is difficult to say whether the resource usage of the computing unit A is larger or the resource usage of the computing unit B is larger.
  • the metal block weighs 0.5 kilograms and the volume is 3 cubic centimeters.
  • the weight of B is 0.2 kilograms and the volume is 10 cubic centimeters. It is difficult to compare which metal block is more valuable from this information. Or maybe there is an A project, which is to build a bridge, and the B project is to lay a road. Because the construction of the bridge and the geographical environment are very different, we can’t simply take the bridge. The length and width of the roads indicate which of the two projects is more ambitious.
  • various different resources can be converted into a standard resource according to the equivalent quantization relationship, so that various different resources can have the basis for comparison.
  • the equivalent quantitative relationship is to convert each resource into a standard resource conversion relationship, which is equivalent to comparing the items of A and B according to the cost of the project.
  • the capital cost of a project is 1 million
  • the funds of B are The consumption is 870,000.
  • the size of the project can be compared, which is equivalent to a project with a capital cost of 1 million and a capital cost of 870,000.
  • the conversion relationship between the bridge repairing project and the road construction project to the fund is equivalent to the equivalent quantitative relationship in the present embodiment.
  • the equivalent quantization relationship can be customized by the user. Users can set the conversion relationship between CPU, memory, hard disk and network bandwidth according to their own considerations. For example, the user can determine the equivalent relationship from the aspect of capital consumption, if you extend a 2core CPU and expand a 64GB memory. As much as you need, you can think of a 2core CPU equivalent to 64GB of memory. Similarly, if the network bandwidth of 1000Mbps is the same as the price of the CPU of the extended 2core, the network bandwidth of 1000Mbps can be equivalent to the CPU of 2core, and the hard disk I/O of 100MB/s can be equivalent to the memory of 64GB, as long as it expands. 100MB/s of hard disk I/O costs as much as 64GB of expanded memory.
  • the standard resource is the basis for realizing the comparison of various types of resources, and the standard resource may be any one other than the resource that needs to be quantified by the standard.
  • the standard resource may be any one of the CPU, the memory, the hard disk I/O, and the network bandwidth that needs to be quantized and unified, for example, the user customizes a “virtual resource”, for example, a user-defined “2core”.
  • the standard resource can also be any one of the resources that need to be quantified by the standard.
  • the process P [3croe, 2core, 20core, 1core], which is equivalent to
  • bridge repair project” and “road construction project” will be uniformly converted into any one of “bridge repair project” or “bridge repair project”.
  • bridge repair project is equal to One "bridge construction project” and “road construction project” can be equal to 0.87 "bridge repair projects”.
  • the user sets the equivalent quantitative relationship according to the capital expenditure of expanding various resources. It can be understood that the embodiment does not limit the determination manner of the equivalent quantitative relationship, because the user can according to his subjective will. Make any form of setting the equivalent quantization relationship. Of course, it is also feasible to set the equivalent quantitative relationship according to other factors than the capital consumption. For example, some resources are more difficult to expand, and it takes more time for the user, and some resources may be easier to expand. Obviously, the user can also set the equivalent quantization relationship according to the difficulty of expanding various resources.
  • the initial configuration scheme generally includes multiple types. Since the initial configuration scheme only meets the most basic configuration requirements, there are many initial configuration schemes in which the process allocation is unreasonable, and the final destination configuration scheme needs to be filtered. .
  • this embodiment proposes a method for obtaining a preliminary configuration scheme, please refer to FIG. 2:
  • S201 Determine a number of units of the computing unit and a specific process according to a preset requirement.
  • the preliminary configuration scheme can have Kind, that is, 60 species.
  • This process is a specific process, and a specific process is a process that predetermines the owning computing unit. For example, in a distributed system, it is explicitly required to assign process B to a computing unit, then process B is a specific process.
  • the specific process B is allocated to the computing unit A of the distributed system. Since the allocation scheme of the process B has been determined, there are no more than 60 preliminary configuration schemes that can be formed.
  • process B there are four processes A, C, D, and E that need to be assigned to three computing units.
  • the four processes A, C, D, and E can be randomly assigned to A and B.
  • the preliminary configuration that can be formed is Kind, that is, 24 kinds.
  • each process in the preliminary configuration scheme is only intended to be configured on the corresponding computing unit, but has not been configured in practice, the standard resources occupied by the processes to which the computing units are configured in the preliminary configuration scheme are calculated. It is also only to calculate the resources that are occupied in the assumed situation. It is assumed that the occupied resources in the case are intended to occupy resources, and the resources to be occupied are the standard resources occupied by the to-be-configured process to which the computing unit is to be allocated. There are at least two ways to calculate the resources to be occupied:
  • the first type firstly converts the resources to be used in the running process of the to-be-configured process into standard resources according to the equivalent quantization relationship, and then calculates the processes occupied by the processes to which the computing units are to be dispatched according to the converted standard resources. Standard resources.
  • the real resources occupied by the processes to which the computing units are to be dispatched are first calculated, and then the calculated results of the obtained real resources are converted into standard resources according to the equivalent quantitative relationship.
  • the first solution is to use the process as the computing object, to quantify the resources, convert them into standard resources, and then calculate the occupied standard resources by using the computing unit as the object.
  • the calculation method of the second calculation method is just the opposite.
  • the calculation unit calculates the resource occupancy first, and then converts the real resources into standard resources according to the equivalent quantization relationship. It should be understood by those skilled in the art that although the two calculation methods are different in order, the calculated results should be the same.
  • the first is to standardize the resources occupied by each process at the first run:
  • the second way is to first calculate the real resources occupied by the computing unit by processes A, B, and C:
  • P true [7core, 256GB, 2550MB / s, 2000Mbps];
  • At least one scheme may be selected from the multiple schemes as the destination configuration scheme according to the calculation result. Since the hardware resources of the computing units in the distributed system are generally the same, the more even the allocation means the less resources are available, so the more optimized, the description in natural language is: assigned to different computing units. The difference in the resources occupied by the process is the smallest, that is, the scheme that the output value of the planned occupied resources of each computing unit is the smallest is an ideal resource allocation scheme. Therefore, in this embodiment, a preliminary configuration scheme in which the calculation unit is most averaging the resources to be occupied is selected as the destination configuration scheme.
  • P 2 [2.5v, 6v, 10v, 4v]
  • P 3 [3v, 2v, 5v, 4v].
  • ⁇ B 1-2
  • ⁇ B 2-3
  • ⁇ B 1-3
  • the characterization values are 16v, 17v, 19.5v, respectively, then according to the scheme of the present disclosure, the first preliminary configuration scheme should be selected as the destination configuration scheme to configure each computing unit.
  • the standard corresponding to each resource of the process should not be used until the two-two difference between the planned occupied resources of each computing unit is calculated.
  • the resource combination calculation for example, cannot calculate the above P standard 1 as 29.5v. Because the difference between the two pairs is an absolute difference, if the standard resources corresponding to the resources are combined in advance, the calculation results of the two preliminary configuration schemes are similar, but the actual occupied resources are extremely unbalanced.
  • the variance between the pseudo-occupied resources of each computing unit may be selected, and then the calculation result of the variance is selected according to the calculation result of the variance.
  • Destination configuration scheme The second way to select the destination configuration scheme is shown in Figure 4:
  • the proposed occupied resources of three computing units in a preliminary configuration scheme are:
  • P 2 [2.5v, 6v, 10v, 4v]
  • P 3 [3v, 2v, 5v, 4v].
  • P 22v
  • the variance value of 40.17 can be obtained according to the formula of the variance.
  • the initial configuration scheme with the smallest variance value is selected as the destination configuration scheme.
  • the resource allocation method of the distributed system provided in this embodiment can uniformly quantize various resources occupied by the process by using the equivalent quantization relationship of each resource, so that different resources have calculation and comparison between them.
  • the optimal resource allocation scheme can be selected according to the preset requirements, the resource optimization configuration of the distributed system is realized, and the resource utilization rate is improved.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • This embodiment provides a resource configuration apparatus for a distributed system.
  • the resource configuration method of the distributed system provided in Embodiment 1 can be used on the device. Please refer to FIG. 5:
  • the resource configuration apparatus 50 of the distributed system includes a relationship acquisition module 501, a preliminary determination module 502, an occupancy calculation module 503, and a scheme selection module 504.
  • the relationship obtaining module 501 is configured to obtain an equivalent quantization relationship of each resource occupied by each to-be-configured process.
  • a process When a process runs on a computing unit, it consumes resources such as CPU, memory, hard disk, and network bandwidth of the computing unit.
  • the CPU uses core ("core") as the unit of measurement
  • the unit of memory is GB (gigabytes)
  • the unit of hard disk I/O Input/Output, input/output
  • MB/s megabits per second
  • network bandwidth is measured in bps.
  • a process a runs on computing unit A, which requires CPUs of A computing unit 2core and 64 GB of memory, and hardly occupies hard disk and network bandwidth.
  • Process b runs on computing unit B. Since the algorithm is not very complicated, the CPU requirements are very low, but it requires 32 GB of memory and 100 MB/s of hard disk I/O. According to the prior art scheme, it is difficult to judge. Which of the processes a and b consumes more of the computing unit, and it is difficult to say whether the resource occupancy of the computing unit A is larger or the resource occupancy of the computing unit B is larger.
  • the metal block weighs 0.5 kilograms and the volume is 3 cubic centimeters.
  • the weight of B is 0.2 kilograms and the volume is 10 cubic centimeters. It's hard to compare a piece of metal from this information. Or maybe there is an A project, which is to build a bridge, and the B project is to lay a road. Because the construction of the bridge and the geographical environment are very different, we can’t simply take the bridge. The length and width of the roads indicate which of the two projects is more ambitious.
  • various different resources can be converted into a standard resource according to the equivalent quantization relationship, so that various different resources can have the basis for comparison.
  • the equivalent quantitative relationship is to convert each resource into a standard resource conversion relationship, which is equivalent to comparing the items of A and B according to the cost of the project.
  • the capital cost of a project is 1 million
  • the funds of B are The consumption is 870,000.
  • the size of the project can be compared, which is equivalent to a project with a capital cost of 1 million and a capital cost of 870,000.
  • the conversion relationship between the bridge repairing project and the road construction project to the fund is equivalent to the equivalent quantitative relationship in the present embodiment.
  • the equivalent quantization relationship acquired by the relationship obtaining module 501 can be customized by the user. Users can set the conversion relationship between CPU, memory, hard disk and network bandwidth according to their own considerations. For example, the user can determine the equivalent relationship from the aspect of capital consumption, if you extend a 2core CPU and expand one. A 64GB of memory costs as much, so you can think of a 2core CPU equivalent to 64GB of memory. Similarly, if the network bandwidth of 1000Mbps is the same as the price of the CPU of the extended 2core, the network bandwidth of 1000Mbps can be equivalent to the CPU of 2core, and the hard disk I/O of 100MB/s can be equivalent to the memory of 64GB, as long as it expands. 100MB/s of hard disk I/O costs as much as 64GB of expanded memory.
  • the standard resource is the basis for realizing the comparison of various types of resources, and the standard resource may be any one other than the resource that needs to be quantified by the standard.
  • the standard resource can be any one of the CPU, memory, hard disk I/O, and network bandwidth that need to be quantized and unified.
  • the CPU, memory, hard disk I/O, and network bandwidth can be uniformly converted into such virtual resources and then compared.
  • the standard resource can also be any one of the resources that need to be quantified by the standard.
  • the process P [3croe, 2core, 20core, 1core], which is equivalent to
  • the “bridge repair project” and the “road construction project” are uniformly converted into any one of “bridge repair project” or “bridge repair project”.
  • bridge repair project is equal to 1
  • a "bridge repair project” and “road construction project” can be equal to 0.87 “bridge repair projects”.
  • the relationship obtaining module 501 is an equivalent quantitative relationship that is set by the user according to the cost of expanding various resources. It can be understood that the present disclosure does not limit the equivalent quantitative relationship acquired by the relationship obtaining module 501. How is it determined? Because users can make any form of equivalent quantitative relationship according to their subjective wishes. Of course, it is also feasible to set the equivalent quantitative relationship according to other factors than the capital consumption. For example, some resources are more difficult to expand, and it takes more time for the user, and some resources may be easier to expand. Obviously, the user can also set the equivalent quantization relationship according to the difficulty of expanding various resources.
  • the preliminary determining module 502 obtains a preliminary configuration scheme of each current configuration process on each computing unit.
  • the initial configuration scheme generally includes multiple types. Since the initial configuration scheme only meets the most basic configuration requirements, there are many initial configuration schemes in which the process allocation is unreasonable, and the final destination configuration scheme needs to be filtered. .
  • this embodiment provides a preliminary determination module 502, please refer to FIG. 6:
  • the preliminary determination module 502 includes a first sub-module 5021, a second sub-module 5022, and a third sub-module 5023.
  • the first sub-module 5021 is configured to determine a unit number and a specific process of the computing unit according to a preset requirement. It is assumed that the current preset requirement is to configure the five processes A, B, C, D, and E to the three computing units A, B, and C of the distributed system. Then, the preliminary configuration scheme can have Kind, that is, 60 species.
  • this process is a specific process, and a specific process is a process that predetermines the owning computing unit. For example, in a distributed system, it is explicitly required to assign process B to a computing unit, then process B is a specific process.
  • the second sub-module 5022 is configured to configure a particular process onto the computing unit to which it belongs.
  • the second sub-module 5022 can allocate the specific process B to the computing unit A of the distributed system according to the preset requirement. Since the allocation scheme of the process B has been determined, there are no 60 preliminary configuration schemes that can be formed.
  • the third sub-module 5023 randomly configures the processes to be configured outside the specific process to the respective computing units.
  • process B there are four processes A, C, D, and E that need to be assigned to three computing units.
  • the third sub-module 5023 can randomly assign four processes A, C, D, and E. Go to the three calculation units of A, B, and C.
  • the preliminary configuration that can be formed is Kind, that is, 24 kinds.
  • the occupancy calculation module 503 calculates the planned occupied resources of each computing unit in each preliminary configuration scheme according to the equivalent quantization relationship.
  • the occupancy calculation module 503 can be at least one of the following two types. Please refer to FIG. 7 and FIG. 8 for further reference:
  • the occupancy calculation module 503 shown in FIG. 7 includes a first calculation module 5031 and a second calculation module 5032.
  • the first calculating module 5031 first converts the resources that need to be configured in the running process to the standard resources according to the equivalent quantization relationship, and then the second calculating module 5032 calculates, according to the converted standard resources, each computing unit is proposed to be The standard resources occupied by the process.
  • the occupancy calculation module 503 shown in FIG. 8 includes a third calculation module 5033 and a fourth calculation module 5034.
  • the third calculating module 5033 first calculates the real resources occupied by the processes to which the computing units are to be dispatched, and then the fourth calculating module 5034 converts the calculated results of the obtained real resources into standard resources according to the equivalent quantization relationship.
  • the occupancy calculation module 503 shown in FIG. 7 is a standard resource that is first occupied by a process by using a process as a calculation object, equivalently quantizing a resource, converting it into a standard resource, and then taking the calculation unit as an object.
  • the calculation process of the occupancy calculation module 503 in FIG. 8 is just the opposite.
  • the calculation unit calculates the resource occupancy first, and then converts the real resource into a standard resource according to the equivalent quantization relationship. It should be understood by those skilled in the art that although the order in which the two occupancy calculation modules perform calculations is different, the calculated results should be the same.
  • the first type of occupancy calculation module first performs standard quantization on the resources occupied by each process:
  • the second occupancy calculation module first calculates the real resources occupied by the calculation unit by processes A, B, and C:
  • P true [7core, 256GB, 2550MB / s, 2000Mbps];
  • the solution selection module 504 is configured to select, according to the calculation result, a preliminary configuration scheme that each of the computing units whose planned occupied resources meet the preset condition is used as the destination configuration solution.
  • the scheme selection module 504 may select at least one scheme from the multiple schemes as the destination configuration scheme according to the calculation result. Since the hardware resources of the computing units in the distributed system are generally the same, the more even the allocation means the less resources are available, so the more optimized, the description in natural language is: assigned to different computing units. The difference in the resources occupied by the process is the smallest, that is, the scheme that the output value of the planned occupied resources of each computing unit is the smallest is an ideal resource allocation scheme. Therefore, in this embodiment, as shown in FIG. 9, the scheme selection module 504 includes a uniform selection module 5041, and the uniform selection module 5041 is configured to select a preliminary configuration scheme of the calculation unit that is the most averaging of the resources to be used as the destination configuration scheme.
  • a uniform selection module is provided, please refer to FIG. 10:
  • the uniform selection module 5041 includes a sixth calculation module 50411 and a characterization selection module 50412, and a maximum value selection module 50413,
  • the sixth calculation module 50411 is configured to calculate the difference between the two occupied resources of each computing unit in the preliminary configuration scheme.
  • the estimated occupied resources of the three computing units in a preliminary configuration scheme are:
  • P 2 [2.5v, 6v, 10v, 4v]
  • P 3 [3v, 2v, 5v, 4v].
  • the sixth calculation module 50411 calculates that the difference between the two occupied resources of the three computing units is:
  • ⁇ B 1-2
  • ⁇ B 2-3
  • ⁇ B 1-3
  • the characterization selection module 50412 is configured to select a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme. For example, in the above example, the characterization selection module 50412 should select 19.5v as the characterization value to characterize the preliminary configuration scheme.
  • the most value selection module 50413 is configured to select a preliminary configuration scheme with the smallest characterization value as the destination configuration scheme. Assuming that there are three preliminary configuration schemes, the characterization values are 16v, 17v, 19.5v, respectively, then according to the solution of the present disclosure, the maximum value selection module 50413 should select the first preliminary configuration scheme as the destination configuration scheme to configure each computing unit.
  • the standard resources corresponding to the resources of the process should not be combined before calculating the difference between the two resources of the computing units. For example, the above P label 1 cannot be calculated as 29.5v. Because the difference between the two pairs is an absolute difference, if the standard resources corresponding to the resources are combined in advance, the calculation results of the two preliminary configuration schemes are similar, but the actual occupied resources are extremely unbalanced.
  • the uniform selection module 5041 includes a fifth calculation module 50414 and a variance selection module 50415.
  • the uniform selection module 5041 can calculate a variance between the pseudo-occupied resources of each computing unit, and then select a destination configuration scheme according to the calculation result of the variance.
  • the fifth calculating module 50414 is configured to calculate a variance of the planned occupied resources of each computing unit in each preliminary configuration scheme.
  • the proposed occupied resources of three computing units in a preliminary configuration scheme are:
  • P 2 [2.5v, 6v, 10v, 4v]
  • P 3 [3v, 2v, 5v, 4v].
  • the fifth block 50414 calculates the variance value of 40.17 can be obtained according to the formula of the variance.
  • the variance selection module 50415 selects a preliminary configuration scheme in which the variance value is the smallest according to the calculation result of the fifth calculation module 50414 as the destination configuration scheme.
  • the smaller the variance the more average the resources to be occupied by each computing unit, and the more optimized the resource allocation, that is, the more ideal the initial configuration scheme.
  • the resource configuration apparatus of the distributed system provided by the embodiment can uniformly quantize various resources occupied by the process by using the equivalent quantization relationship of each resource, so that different resources have conditions for calculation and comparison. Based on the preset requirements, the optimal resource configuration scheme can be selected to optimize resource allocation of the distributed system and improve resource utilization.
  • modules or steps of the present disclosure can be implemented by a general computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that They are stored in a storage medium (ROM/RAM, disk, optical disk) by a computing device, and in some cases, the steps shown or described may be performed in a different order than here, or they may be separately It is made by making individual integrated circuit modules, or by making a plurality of modules or steps of them into a single integrated circuit module. Therefore, the present disclosure is not limited to any specific combination of hardware and software.
  • the present disclosure is applicable to the field of computer technology, and is used to uniformly quantify various resources occupied by processes through the equivalent quantitative relationship of resources, so that different resources have conditions for calculation and comparison, and on this basis, According to the preset requirements, the optimal resource configuration scheme is selected to implement resource optimization configuration of the distributed system and improve resource utilization.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

A resource allocation method and apparatus for a distributed system. An equivalent quantization relationship of various resources occupied by each process to be allocated is obtained; then standard calculation is performed on resources occupied by each process allocated to each calculation unit in various initial allocation schemes; at last, an initial allocation scheme satisfying a preset requirement is selected as a final allocation scheme according to calculation results. In the resource allocation method of a distributed system, various different resources occupied by a process can be uniformly quantized by using an equivalent quantization relationship of the resources, so that calculation and comparison conditions exist between the different resources. Based on this, an optimal resource allocation scheme can be selected according to a preset requirement, thereby implementing optimized resource allocation of a distributed system and improving the resource utilization.

Description

一种分布式系统的资源配置方法及装置Resource configuration method and device for distributed system 技术领域Technical field
本公开涉及计算机技术领域,尤其涉及一种分布式系统的资源配置方法及装置。The present disclosure relates to the field of computer technologies, and in particular, to a resource configuration method and apparatus for a distributed system.
背景技术Background technique
由于通讯系统中网管软件的数量越来越庞大,系统需要处理的需求和响应也越来越多,为了提高处理效率,增强用户体验,可以将原有的进程分配到不同的硬件服务器上运行,通过对通讯系统进行分布式改造,形成分布式系统(distributed system)。分布式系统是建立在网络之上的软件系统。它是一个由多个互相连接的计算单元组成的计算机系统,其中,各个计算单元在整个系统的控制下协同执行同一个任务,能够实现最少依赖于集中程序、数据或硬件的效果。这些计算单元可以是地理上相邻的,也可以是在地理上分散的。分布式系统隐含的共同特征是:场地分布、数据分布、硬件平台多样化、操作系统多样化、应用平台多样化。Due to the increasing number of network management software in the communication system, the system needs to process more and more demands and responses. In order to improve the processing efficiency and enhance the user experience, the original process can be allocated to different hardware servers for operation. A distributed system is formed by distributed transformation of the communication system. A distributed system is a software system built on top of a network. It is a computer system composed of a plurality of interconnected computing units, wherein each computing unit performs the same task in cooperation under the control of the entire system, and can achieve at least a centralized program, data or hardware-dependent effect. These computing units may be geographically adjacent or geographically dispersed. The common features implied by distributed systems are: site distribution, data distribution, diversification of hardware platforms, diversification of operating systems, and diversification of application platforms.
但是如何才能将需要运行的进程合理地分配到各计算单元上,实现资源的优化配置?现有技术中所提出的各种资源优化配置方案要么是针对非分布式系统的,要么就只是单独针对某一方面的。例如单独根据各进程运行时所占用的CPU或者内存来进行资源配置,或者单独针对网络响应模型。但实际上,将单独针对某种资源进行资源配置的方案在分布式系统中的运用是不合理的,因为每一个进程都有其独特性,例如,有些进程在运行的时候,需要大量的内存来做数据的缓存,但是对网络带宽的需求却不高;有些进程里面涵盖复杂的算法,需要消耗CPU资源来进行大量的计算,但是几乎不需要使用到计算单元里的磁盘IO;还有一些进程在运行的时候要频繁的与服务器进行数据交互,因此,对网络带宽的要求很高。But how can the processes that need to be run be reasonably allocated to each computing unit to achieve optimal resource allocation? The various resource optimization configurations proposed in the prior art are either for non-distributed systems or are solely for a certain aspect. For example, the resource configuration is performed separately according to the CPU or memory occupied by each process, or the network response model is separately. But in fact, it is unreasonable to use a solution for resource allocation for a certain resource in a distributed system, because each process has its own uniqueness. For example, some processes require a large amount of memory when they are running. To do data caching, but the demand for network bandwidth is not high; some processes cover complex algorithms, need to consume CPU resources to perform a large number of calculations, but almost no need to use the disk IO in the computing unit; The process needs to interact with the server frequently during the running process. Therefore, the network bandwidth requirements are very high.
由于每一个进程的运行要求不同,按照现有的资源优化配置方案,很难将上面几种不同的进程进行合理的分配。所以现在缺少一种资源优化配置方案,用于根据一个进程所占用的各方面的资源来全面地评价将该进程分配到某一个计算单元中是否合理,用于提出更优秀的分配方案。Due to the different operational requirements of each process, it is difficult to reasonably allocate the above several different processes according to the existing resource optimization configuration scheme. Therefore, there is a lack of a resource optimization configuration scheme for comprehensively evaluating whether it is reasonable to allocate the process to a computing unit according to various resources occupied by a process, and to propose a better allocation scheme.
发明内容Summary of the invention
本公开要解决的主要技术问题是,提供一种资源优化配置方案,用于解决现有技术中只能针对某种单独的资源进行资源配置,无法根据多种资源进行进程分配而导致的分布式系统资源配置不合理的技术问题。The main technical problem to be solved by the present disclosure is to provide a resource optimization configuration solution, which is used to solve the problem that the resource allocation in the prior art can only be performed for a certain resource and cannot be distributed according to multiple resources. Technical problems with unreasonable system resource allocation.
为解决上述技术问题,本公开提供一种分布式系统的资源配置方法,包括:To solve the above technical problem, the present disclosure provides a resource configuration method for a distributed system, including:
获取各资源的等效量化关系,所述等效量化关系为将各所述资源量化为标准资源的转 换关系;Obtaining an equivalent quantitative relationship of each resource, where the equivalent quantization relationship is a quantification of each of the resources into a standard resource Change relationship
获取当前各待配置进程在各计算单元上的初步配置方案;Obtaining a preliminary configuration scheme of each current configuration process on each computing unit;
根据所述等效量化关系计算各所述初步配置方案中各所述计算单元的拟占用资源,所述拟占用资源为所述计算单元被拟派到其上的所述待配置进程所占用的标准资源;And calculating, according to the equivalent quantization relationship, a planned occupied resource of each of the computing units in each of the preliminary configuration scenarios, where the planned occupied resource is occupied by the to-be-configured process to which the computing unit is to be allocated Standard resources
根据计算结果选择各所述计算单元的所述拟占用资源满足预设条件的初步配置方案作为目的配置方案。And selecting, according to the calculation result, a preliminary configuration scheme that the planned occupied resource of each of the computing units meets a preset condition is used as a destination configuration scheme.
在本公开一种实施例中,所述标准资源为所述资源中的任意一种或者为所述资源以外的任意一种。In an embodiment of the present disclosure, the standard resource is any one of the resources or any one of the resources.
在本公开一种实施例中,所述获取当前各待配置进程在各计算单元上的初步配置方案包括:In an embodiment of the present disclosure, the preliminary configuration scheme of acquiring the current to-be-configured processes on each computing unit includes:
根据预设要求确定所述计算单元的单元数目和特定进程,所述特定进程为预先确定所属计算单元的待配置进程;Determining, according to a preset requirement, a number of units of the computing unit and a specific process, where the specific process is a process to be configured in advance to be determined by the associated computing unit;
将所述特定进程配置到其所属的所述计算单元上;Configuring the particular process to the computing unit to which it belongs;
将所述特定进程以外的所述待配置进程随机配置到各所述计算单元上。The to-be-configured processes other than the specific process are randomly configured to each of the computing units.
在本公开一种实施例中,所述根据所述等效量化关系计算各所述初步配置方案中各所述计算单元的拟占用资源的方式包括:In an embodiment of the present disclosure, the manner of calculating, according to the equivalent quantization relationship, the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios includes:
根据所述等效量化关系计算各所述待配置进程运行时所需要占用的标准资源;Calculating, according to the equivalent quantization relationship, standard resources that are required to be occupied when each of the to-be-configured processes is running;
计算各所述初步配置方案中各所述计算单元被所述待配置进程占用的标准资源;Calculating, by each of the preliminary configuration schemes, a standard resource occupied by each of the computing units by the to-be-configured process;
或者,or,
计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的实际资源;Calculating actual resources occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes;
根据所述等效量化关系计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的标准资源。Calculating, according to the equivalent quantization relationship, standard resources occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes.
在本公开一种实施例中,所述根据计算结果选择各所述计算单元的所述拟占用资源满足预设条件的初步配置方案作为目的配置方案包括:In an embodiment of the present disclosure, the preliminary configuration scheme that selects the pseudo-occupied resource of each of the computing units to meet a preset condition according to the calculation result includes:
选择各所述计算单元的所述拟占用资源最平均的初步配置方案作为所述目的配置方案。The preliminary configuration scheme of the most averaging resources of each of the computing units is selected as the destination configuration scheme.
在本公开一种实施例中,所述选择各所述计算单元的所述拟占用资源最平均的初步配置方案作为所述目的配置方案包括:In an embodiment of the present disclosure, the preliminary configuration scheme for selecting the most averaging of the resources to be occupied by each of the computing units as the destination configuration solution includes:
计算各所述初步配置方案中各所述计算单元的所述拟占用资源的方差;Calculating a variance of the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios;
选择方差值最小的所述初步配置方案作为所述目的配置方案;Selecting the preliminary configuration scheme with the smallest variance value as the destination configuration scheme;
或者,or,
计算各所述初步配置方案中各所述计算单元的所述拟占用资源之间的两两差值;Calculating a difference between the two occupied resources of each of the computing units in each of the preliminary configuration schemes;
选择所述初步配置方案中拟占用资源间的最大差值作为表征值来表征所述初步配置方案;Selecting a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme;
选择所述表征值最小的所述初步配置方案作为所述目的配置方案。 The preliminary configuration scheme in which the characterization value is the smallest is selected as the destination configuration scheme.
本公开还提供一种分布式系统的资源配置装置,包括:The present disclosure also provides a resource configuration apparatus for a distributed system, including:
关系获取模块,设置为获取各资源的等效量化关系,所述等效量化关系为将各所述资源量化为标准资源的转换关系;The relationship obtaining module is configured to obtain an equivalent quantization relationship of each resource, where the equivalent quantization relationship is a conversion relationship that quantizes each of the resources into a standard resource;
初步确定模块,设置为获取当前各待配置进程在各计算单元上的初步配置方案;Initially determining a module, configured to obtain a preliminary configuration scheme of each current configuration process on each computing unit;
占用计算模块,设置为根据所述等效量化关系计算各所述初步配置方案中各所述计算单元的拟占用资源,所述拟占用资源为所述计算单元被拟派到其上的所述待配置进程所占用的标准资源;An occupancy calculation module, configured to calculate, according to the equivalent quantization relationship, a planned occupied resource of each of the computing units in each of the preliminary configuration scenarios, where the planned occupied resource is the one to which the computing unit is to be dispatched Standard resources occupied by the process to be configured;
方案选择模块,设置为根据计算结果选择各所述计算单元的所述拟占用资源满足预设条件的初步配置方案作为目的配置方案。The solution selection module is configured to select, according to the calculation result, a preliminary configuration scheme that the planned occupied resource of each of the computing units meets a preset condition as a destination configuration scheme.
在本公开一种实施例中,所述占用计算模块包括以下至少一种:In an embodiment of the present disclosure, the occupancy calculation module includes at least one of the following:
第一计算模块,设置为根据所述等效量化关系计算各所述待配置进程运行时所需要占用的标准资源;a first calculation module, configured to calculate, according to the equivalent quantization relationship, a standard resource that is required to be used when each of the to-be-configured processes is running;
第二计算模块,设置为计算各所述初步配置方案中各所述计算单元被所述待配置进程占用的标准资源;a second calculating module, configured to calculate a standard resource occupied by each of the computing units in each of the preliminary configuration schemes by the to-be-configured process;
或者,or,
第三计算模块,设置为计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的实际资源;a third calculating module, configured to calculate an actual resource occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes;
第四计算模块,设置为根据所述等效量化关系计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的标准资源。And a fourth calculating module, configured to calculate, according to the equivalent quantization relationship, a standard resource occupied by each of the computing units in each of the preliminary configuration scenarios by each of the to-be-configured processes.
在本公开一种实施例中,所述方案选择模块包括:In an embodiment of the present disclosure, the solution selection module includes:
均匀选择模块,设置为选择各所述计算单元的所述拟占用资源最平均的初步配置方案作为所述目的配置方案。The uniform selection module is configured to select a preliminary configuration scheme of the most averaging resources of each of the computing units as the destination configuration scheme.
在本公开一种实施例中,所述均匀选择模块包括:In an embodiment of the present disclosure, the uniform selection module includes:
第五计算模块,设置为计算各所述初步配置方案中各所述计算单元的所述拟占用资源的方差;a fifth calculating module, configured to calculate a variance of the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios;
方差选择模块,设置为选择方差值最小的所述初步配置方案作为所述目的配置方案;a variance selection module, configured to select the preliminary configuration scheme with the smallest variance value as the destination configuration scheme;
或者,or,
第六计算模块,设置为计算各所述初步配置方案中各所述计算单元的所述拟占用资源之间的两两差值;a sixth calculation module, configured to calculate a difference between the two occupied resources of each of the computing units in each of the preliminary configuration scenarios;
表征选择模块,设置为选择所述初步配置方案中拟占用资源间的最大差值作为表征值来表征所述初步配置方案;Characterizing a selection module, configured to select a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme;
最值选择模块,设置为选择所述表征值最小的所述初步配置方案作为所述目的配置方案。The most value selection module is configured to select the preliminary configuration scheme in which the representation value is the smallest as the destination configuration scheme.
本公开的有益效果是:The beneficial effects of the present disclosure are:
本公开提出的分布式系统的资源配置方法,通过获取各待配置进程所占用的各种资源 的等效量化关系,然后对各种初步配置方案中各计算单元的被各配置到其上的进程占用的资源进行标准化计算,最后根据计算结果选择满足预设要求的初步配置方案作为最终的配置方案。在本公开提出的分布式系统的资源配置方法中,通过各资源的等效量化关系可以将进程占用的各种不同的资源进行统一量化,使得不同资源之间具备进行计算、比较的条件,在此基础上,可以根据预设要求选择出最优的资源配置方案,实现分布式系统的资源优化配置,提高资源利用率。The resource configuration method of the distributed system proposed by the present disclosure obtains various resources occupied by each to-be-configured process. The equivalent quantitative relationship, and then normalize the resources occupied by the processes allocated to each of the computing units in the various preliminary configuration schemes, and finally select a preliminary configuration scheme that meets the preset requirements according to the calculation result as the final configuration. Program. In the resource allocation method of the distributed system proposed by the present disclosure, the various quantitative resources occupied by the process can be uniformly quantized by the equivalent quantitative relationship of each resource, so that different resources have the conditions for calculation and comparison. On this basis, the optimal resource configuration scheme can be selected according to the preset requirements, the resource optimization configuration of the distributed system is realized, and the resource utilization rate is improved.
附图说明DRAWINGS
图1为本公开实施例一提供的分布式系统的资源配置方法的一种流程图;FIG. 1 is a flowchart of a resource configuration method of a distributed system according to Embodiment 1 of the present disclosure;
图2为本公开实施例一提供的获取初步配置方案的一种流程图;2 is a flowchart of obtaining a preliminary configuration scheme according to Embodiment 1 of the present disclosure;
图3为本公开实施例一提供的选择目的配置方案的一种流程图;FIG. 3 is a flowchart of a selection destination configuration scheme according to Embodiment 1 of the present disclosure;
图4为本公开实施例一提供的选择目的配置方案的另一种流程图;FIG. 4 is another flowchart of a selection destination configuration scheme according to Embodiment 1 of the present disclosure;
图5为本公开实施例二提供的分布式系统的资源配置装置的一种结构示意图;FIG. 5 is a schematic structural diagram of a resource configuration apparatus of a distributed system according to Embodiment 2 of the present disclosure;
图6为图5中初步确定模块的一种结构示意图;6 is a schematic structural view of the preliminary determining module of FIG. 5;
图7为图5中占用计算模块的一种结构示意图;7 is a schematic structural view of the occupancy calculation module of FIG. 5;
图8为图5中占用计算模块的另一种结构示意图;8 is another schematic structural diagram of the occupancy calculation module of FIG. 5;
图9为图5中方案选择模块的一种结构示意图;9 is a schematic structural view of the scheme selection module of FIG. 5;
图10为图9中均匀选择模块的一种结构示意图;10 is a schematic structural view of the uniform selection module of FIG. 9;
图11为图9中均匀选择模块的另一种结构示意图。FIG. 11 is another schematic structural view of the uniform selection module of FIG. 9.
具体实施方式detailed description
下面通过具体实施方式结合附图对本公开作进一步详细说明。The present disclosure will be further described in detail below with reference to the accompanying drawings.
实施例一:Embodiment 1:
本实施例提供一种分布式系统的资源配置方法,请参考图1,该方法包括:This embodiment provides a resource configuration method for a distributed system. Referring to FIG. 1, the method includes:
S101、获取各待配置进程所占用的各资源的等效量化关系。S101. Acquire an equivalent quantitative relationship of each resource occupied by each to-be-configured process.
一个进程在计算单元上运行的时候,会占用该计算单元的CPU、内存、硬盘、网络带宽等资源。通常,CPU以core(“核”)作为计量单位,内存的单位为GB(千兆字节),硬盘I/O(Input/Output,输入/输出)的单位为MB/s(兆比特每秒),而网络带宽以bps来计量。这几种资源由于性质不同,计量的单位也不同,所以在通常意义上,是没有办法将它们放在一起进行衡量比较的。这也就是为什么现有技术中还没有提出一种资源分配方案,能够全面考虑进程运行时所消耗的各方面的资源。例如,一个进程a在计算单元A上运行,其需要占用A计算单元2core的CPU和64GB的内存,几乎不占用硬盘与网络带宽。而进程b在计算单元B上运行,由于算法不是很复杂,所以对CPU的要求很低,但是需要占用32GB的内存和100MB/s的硬盘I/O,根据现有技术的方案,很难评判进程a和b哪一个对计算单元的消耗更大,也 很难说明是计算单元A的资源占用更大还是计算单元B的资源占用更大。就如同现在有甲乙两个金属块,甲金属块重0.5千克,体积为3立方厘米,乙的重量为0.2千克,体积为10立方厘米。从这些信息中很难比较哪个金属块会更值钱一些。又或者说现在有一个甲工程项目,是要修建一座桥,而乙工程项目是要铺设一条路,由于桥跟路的修建方案、地理环境等有很大的不同,所以我们不能简单的从桥和路的长短、宽窄来说明这两个工程项目哪一个更宏大一些。When a process runs on a computing unit, it consumes resources such as CPU, memory, hard disk, and network bandwidth of the computing unit. Usually, the CPU uses core ("core") as the unit of measurement, the unit of memory is GB (gigabytes), and the unit of hard disk I/O (Input/Output, input/output) is MB/s (megabits per second). ), while network bandwidth is measured in bps. These kinds of resources have different units of measurement because of their different natures. Therefore, in the usual sense, there is no way to put them together for comparison and comparison. This is why there is no resource allocation scheme in the prior art, which can fully consider all aspects of resources consumed by the process. For example, a process a runs on computing unit A, which requires CPUs of A computing unit 2core and 64 GB of memory, and hardly occupies hard disk and network bandwidth. Process b runs on computing unit B. Since the algorithm is not very complicated, the CPU requirements are very low, but it requires 32 GB of memory and 100 MB/s of hard disk I/O. According to the prior art scheme, it is difficult to judge. Which of the processes a and b consumes more computing units, too It is difficult to say whether the resource usage of the computing unit A is larger or the resource usage of the computing unit B is larger. Just as there are two metal blocks of A and B, the metal block weighs 0.5 kilograms and the volume is 3 cubic centimeters. The weight of B is 0.2 kilograms and the volume is 10 cubic centimeters. It is difficult to compare which metal block is more valuable from this information. Or maybe there is an A project, which is to build a bridge, and the B project is to lay a road. Because the construction of the bridge and the geographical environment are very different, we can’t simply take the bridge. The length and width of the roads indicate which of the two projects is more ambitious.
在本实施例中,可以根据等效量化关系将各种不同的资源转换成一种标准的资源,使得各种不同的资源能够具备进行比较的基础。等效量化关系是将各资源量化为标准资源的转换关系,就相当于将甲和乙的项目统一根据耗费资金来比较项目的大小,例如甲工程项目的资金耗费是100万,而乙的资金消耗为87万,当甲和乙这两个工程被统一按照资金耗费计量后,甲乙工程的大小也就能够进行比较了,相当于有一个资金耗费为100万的工程和一个资金耗费为87万的工程,这时,很明显,甲工程项目更大。修桥工程和建路工程到资金之间的换算关系就相当于本实施例中的等效量化关系。In this embodiment, various different resources can be converted into a standard resource according to the equivalent quantization relationship, so that various different resources can have the basis for comparison. The equivalent quantitative relationship is to convert each resource into a standard resource conversion relationship, which is equivalent to comparing the items of A and B according to the cost of the project. For example, the capital cost of a project is 1 million, and the funds of B are The consumption is 870,000. When the two projects of A and B are uniformly measured according to the capital expenditure, the size of the project can be compared, which is equivalent to a project with a capital cost of 1 million and a capital cost of 870,000. At the time of the project, it was obvious that the A project was even bigger. The conversion relationship between the bridge repairing project and the road construction project to the fund is equivalent to the equivalent quantitative relationship in the present embodiment.
在本实施例中,等效量化关系可以由用户自定义。用户可以根据自己的考量,设定CPU、内存、硬盘、网络带宽之间的转换关系,例如简单地,用户从资金耗费方面来确定等效关系,如果扩展一个2core的CPU和扩展一个64GB的内存所需要的花费一样多,那么就可以认为2core的CPU等效于64GB的内存。同理,如果扩展1000Mbps的网络带宽与扩展2core的CPU的价格相同,那么1000Mbps的网络带宽可以等效于2core的CPU,100MB/s的硬盘I/O也可以等效于64GB的内存,只要扩展100MB/s的硬盘I/O和扩展64GB的内存的花费一样多。In this embodiment, the equivalent quantization relationship can be customized by the user. Users can set the conversion relationship between CPU, memory, hard disk and network bandwidth according to their own considerations. For example, the user can determine the equivalent relationship from the aspect of capital consumption, if you extend a 2core CPU and expand a 64GB memory. As much as you need, you can think of a 2core CPU equivalent to 64GB of memory. Similarly, if the network bandwidth of 1000Mbps is the same as the price of the CPU of the extended 2core, the network bandwidth of 1000Mbps can be equivalent to the CPU of 2core, and the hard disk I/O of 100MB/s can be equivalent to the memory of 64GB, as long as it expands. 100MB/s of hard disk I/O costs as much as 64GB of expanded memory.
标准资源是实现各类型资源进行比较的基础,标准资源可以是需要被标准量化的资源以外的任意一种。例如,在上面的示例中,可以将“修桥工程”和“建路工程”统一换算成“资金耗费”,这时“资金耗费”属于“修桥工程”和“修桥工程”以外的一种,“资金耗费”也可以用“人力耗费”等来代替。回到本实施例中,标准资源可以是需要被量化统一的CPU、内存、硬盘I/O以及网络带宽以外的任意一种,例如用户自定义一种“虚拟资源”,例如用户自定义“2core的CPU=64GB的内存=100MB/s的硬盘I/O=1000Mbps的网络带宽=1v”,这里1v就是一种虚拟资源,可以将CPU、内存、硬盘I/O以及网络带宽都统一换算成这种虚拟资源之后在进行比较。The standard resource is the basis for realizing the comparison of various types of resources, and the standard resource may be any one other than the resource that needs to be quantified by the standard. For example, in the above example, “bridge repair project” and “road construction project” can be uniformly converted into “funding cost”. At this time, “funding cost” belongs to one other than “bridge repair project” and “bridge repair project”. Kind of, "funding expenses" can also be replaced by "manpower consumption" and the like. In this embodiment, the standard resource may be any one of the CPU, the memory, the hard disk I/O, and the network bandwidth that needs to be quantized and unified, for example, the user customizes a “virtual resource”, for example, a user-defined “2core”. CPU=64GB memory=100MB/s hard disk I/O=1000Mbps network bandwidth=1v”, where 1v is a virtual resource that can convert CPU, memory, hard disk I/O and network bandwidth into this The virtual resources are then compared.
在本实施例中通过“进程=[CPU、内存、硬盘I/O、网络带宽]”的方式来表示进程,假定当前一个进程P的运行需要3core的CPU、64GB的内存、1000MB/s的硬盘I/O以及500Mbps的网络带宽,那么进程P=[3croe,64GB,1000MB/s,500Mbps],如果标准资源为虚拟资源时,那么进程P=[1.5v,1v,10v,0.5v]。In this embodiment, the process is represented by "process=[CPU, memory, hard disk I/O, network bandwidth]", and it is assumed that the current process P requires 3 core CPU, 64 GB of memory, and 1000 MB/s hard disk. I / O and 500Mbps network bandwidth, then the process P = [3croe, 64GB, 1000MB / s, 500Mbps], if the standard resource is a virtual resource, then the process P = [1.5v, 1v, 10v, 0.5v].
可以理解的是,标准资源也可以是需要被标准量化的资源中的任意一种,例如,直接将CPU作为标准资源,那么进程P=[3croe,2core,20core,1core],这就相当于 将分别以“修桥工程”和“建路工程”统一换算成以“修桥工程”或者“修桥工程”中的任意一种,例如从资金消耗的角度来说,“修桥工程”等于1个“修桥工程”,“建路工程”可以等于0.87个“修桥工程”。It can be understood that the standard resource can also be any one of the resources that need to be quantified by the standard. For example, if the CPU is directly used as a standard resource, then the process P=[3croe, 2core, 20core, 1core], which is equivalent to The “bridge repair project” and “road construction project” will be uniformly converted into any one of “bridge repair project” or “bridge repair project”. For example, from the perspective of capital consumption, “bridge repair project” is equal to One "bridge construction project" and "road construction project" can be equal to 0.87 "bridge repair projects".
在上述实施例中,用户是根据扩展各种资源的资金花费来设置等效量化关系的,可以理解的是,本实施例并未限定等效量化关系的确定方式,因为用户可以根据其主观意愿对等效量化关系做任何形式的设置。当然根据资金耗损以外的其他因素来设置等效量化关系也是可行的,例如有的资源在扩展的时候难度较大,需要耗费用户更多的时间,而有的资源可能比较容易就能实现扩展,显然,用户也可以根据扩展各种资源的难度来设置等效量化关系。In the above embodiment, the user sets the equivalent quantitative relationship according to the capital expenditure of expanding various resources. It can be understood that the embodiment does not limit the determination manner of the equivalent quantitative relationship, because the user can according to his subjective will. Make any form of setting the equivalent quantization relationship. Of course, it is also feasible to set the equivalent quantitative relationship according to other factors than the capital consumption. For example, some resources are more difficult to expand, and it takes more time for the user, and some resources may be easier to expand. Obviously, the user can also set the equivalent quantization relationship according to the difficulty of expanding various resources.
S102、获取当前各待配置进程在各计算单元上的初步配置方案。S102. Acquire a preliminary configuration scheme of each current configuration process on each computing unit.
初步配置方案一般包括多种,由于初步配置方案只是满足最基本的配置要求,所以有许多的初步配置方案中的进程分配得不合理,而得到最终的目的配置方案需要对这些初步配置方案进行筛选。The initial configuration scheme generally includes multiple types. Since the initial configuration scheme only meets the most basic configuration requirements, there are many initial configuration schemes in which the process allocation is unreasonable, and the final destination configuration scheme needs to be filtered. .
下面,本实施例提出一种获取初步配置方案的方式,请参考图2:In the following, this embodiment proposes a method for obtaining a preliminary configuration scheme, please refer to FIG. 2:
S201、根据预设要求确定计算单元的单元数目和特定进程。S201. Determine a number of units of the computing unit and a specific process according to a preset requirement.
假定现在的预设要求是将A、B、C、D、E五个进程配置到分布式系统的三个计算单元甲、乙、丙上。那么,初步配置方案可以有
Figure PCTCN2017076347-appb-000001
种,即60种。在实际应用过程中,有一些进程的配置会有特定的要求,这种进程即为特定进程,特定进程是预先确定所属计算单元的进程。例如,在一个分布式系统中,明确要求要将进程B分配到甲计算单元上,那么进程B就是特定进程。
Assume that the current default requirement is to configure the five processes A, B, C, D, and E to the three computing units A, B, and C of the distributed system. Then, the preliminary configuration scheme can have
Figure PCTCN2017076347-appb-000001
Kind, that is, 60 species. In the actual application process, there are specific requirements for the configuration of some processes. This process is a specific process, and a specific process is a process that predetermines the owning computing unit. For example, in a distributed system, it is explicitly required to assign process B to a computing unit, then process B is a specific process.
S202、将特定进程配置到其所属的计算单元上。S202. Configure a specific process to a computing unit to which it belongs.
根据预设要求将特定进程B分配到分布式系统的计算单元甲上,由于进程B的分配方案已经确定,那么可以形成的初步配置方案已经没有60种了。According to the preset requirement, the specific process B is allocated to the computing unit A of the distributed system. Since the allocation scheme of the process B has been determined, there are no more than 60 preliminary configuration schemes that can be formed.
S203、将特定进程以外的待配置进程随机配置到各计算单元上。S203. Randomly configure a to-be-configured process other than a specific process to each computing unit.
除了进程B以外,此时还剩下四个进程A、C、D、E需要被分配到三个计算单元上,A、C、D、E四个进程可以被随机地分配到甲、乙、、丙三个计算单元上。这时,能够形成的初步配置方案为
Figure PCTCN2017076347-appb-000002
种,即24种。
In addition to process B, there are four processes A, C, D, and E that need to be assigned to three computing units. The four processes A, C, D, and E can be randomly assigned to A and B. And C on the three calculation units. At this time, the preliminary configuration that can be formed is
Figure PCTCN2017076347-appb-000002
Kind, that is, 24 kinds.
S103、根据等效量化关系计算各初步配置方案中各计算单元的拟占用资源。S103. Calculate, according to the equivalent quantization relationship, the planned occupied resources of each computing unit in each preliminary configuration scheme.
由于在初步配置方案中的各个进程只是拟将被配置到对应的计算单元上,而实际上还并未被配置,所以计算初步配置方案中各计算单元被配置到其上的进程占用的标准资源还只是计算假定情况中被占用的资源,假定情况中被占用的资源即拟占用资源,拟占用资源是计算单元被拟派到其上的待配置进程所占用的标准资源。计算拟占用资源的方式至少有这样两种:Since each process in the preliminary configuration scheme is only intended to be configured on the corresponding computing unit, but has not been configured in practice, the standard resources occupied by the processes to which the computing units are configured in the preliminary configuration scheme are calculated. It is also only to calculate the resources that are occupied in the assumed situation. It is assumed that the occupied resources in the case are intended to occupy resources, and the resources to be occupied are the standard resources occupied by the to-be-configured process to which the computing unit is to be allocated. There are at least two ways to calculate the resources to be occupied:
第一种,先根据等效量化关系将各待配置进程在运行的过程中需要占用资源转化成标准资源,然后根据转化后的标准资源计算各计算单元被拟派到其上的进程所占用 的标准资源。The first type firstly converts the resources to be used in the running process of the to-be-configured process into standard resources according to the equivalent quantization relationship, and then calculates the processes occupied by the processes to which the computing units are to be dispatched according to the converted standard resources. Standard resources.
第二种,先计算各计算单元被拟派到其上的进程所占用的真实资源,然后根据等效量化关系将得到的真实资源的计算结果转化为标准资源。Secondly, the real resources occupied by the processes to which the computing units are to be dispatched are first calculated, and then the calculated results of the obtained real resources are converted into standard resources according to the equivalent quantitative relationship.
简单来说,第一种方案就是先以进程作为计算对象,对资源进行等效量化,转化成标准资源,然后以计算单元为对象,计算被占用的标准资源。而第二种计算方式的计算过程正好相反,是先以计算单元计算资源占用情况,然后才根据等效量化关系将真实资源转化成标准资源。本领域技术人员应当明白的是,这两种计算方式虽然顺序不同,但是计算得到的结果应当是相同的。例如,一个计算单元有A、B、C三个进程,PA=[3core,64GB,1000MB/s,500Mbps],PB=[2core,64GB,1000MB/s,1000Mbps],PC=[2core,128GB,550MB/s,500Mbps],等效量化关系为“2core的CPU=64GB的内存=100MB/s的硬盘I/O=1000Mbps的网络带宽=1v”,为了得到该计算单元的拟占用资源,可以采用如下所示的两种计算方式:To put it simply, the first solution is to use the process as the computing object, to quantify the resources, convert them into standard resources, and then calculate the occupied standard resources by using the computing unit as the object. The calculation method of the second calculation method is just the opposite. The calculation unit calculates the resource occupancy first, and then converts the real resources into standard resources according to the equivalent quantization relationship. It should be understood by those skilled in the art that although the two calculation methods are different in order, the calculated results should be the same. For example, a computing unit has three processes A, B, and C, P A = [3core, 64GB, 1000MB/s, 500Mbps], P B = [2core, 64GB, 1000MB/s, 1000Mbps], P C = [2core , 128GB, 550MB/s, 500Mbps], the equivalent quantization relationship is "2core CPU = 64GB of memory = 100MB / s of hard disk I / O = 1000Mbps network bandwidth = 1v", in order to obtain the intended resources of the computing unit You can use the two calculation methods shown below:
第一种,先对各进程运行时所占用的资源进行标准量化:The first is to standardize the resources occupied by each process at the first run:
PA=[3core,64GB,1000MB/s,500Mbps]=[1.5v,1v,10v,0.5v];P A = [3core, 64GB, 1000MB/s, 500Mbps] = [1.5v, 1v, 10v, 0.5v];
PB=[2core,64GB,1000MB/s,1000Mbps]=[1v,1v,10v,1v];P B = [2core, 64GB, 1000MB/s, 1000Mbps] = [1v, 1v, 10v, 1v];
PC=[2core,128GB,550MB/s,500Mbps]=[1v,2v,5.5v,0.5v]。P C = [2core, 128 GB, 550 MB/s, 500 Mbps] = [1v, 2v, 5.5v, 0.5v].
然后再以计算单元为对象,计算该计算单元的拟资源占用情况:Then calculate the pseudo-resource occupancy of the computing unit by using the computing unit as an object:
P=[3.5v,4v,25.5v,2v]。P mark = [3.5v, 4v, 25.5v, 2v].
第二种方式是先计算计算单元被进程A、B、C所占用的真实资源:The second way is to first calculate the real resources occupied by the computing unit by processes A, B, and C:
P=[7core,256GB,2550MB/s,2000Mbps];P true = [7core, 256GB, 2550MB / s, 2000Mbps];
接着根据等效量化关系——“2core的CPU=64GB的内存=100MB/s的硬盘I/O=1000Mbps的网络带宽=1v”计算得到该计算单元的拟占用资源:Then, according to the equivalent quantization relationship - "2core CPU=64GB memory=100MB/s hard disk I/O=1000Mbps network bandwidth=1v", the calculated occupied resources of the computing unit are calculated:
P=[(7core/2core)*v,(256GB/64GB)*v,((2550MB/s)/(100MB/s))*v,(2000Mbps/1000Mbps)*v]=[3.5v,4v,25.5v,2v]。P mark = [(7core/2core) * v, (256GB / 64GB) * v, ((2550MB / s) / (100MB / s)) * v, (2000Mbps / 1000Mbps) * v] = [3.5v, 4v , 25.5v, 2v].
S104、根据计算结果选择各计算单元的拟占用资源满足预设条件的初步配置方案作为目的配置方案。S104. Select, according to the calculation result, a preliminary configuration scheme that the planned occupied resources of each computing unit meet the preset condition as the destination configuration scheme.
在上述步骤中对各个初步配置方案都进行了计算之后,可以根据计算结果从多个方案中选择出至少一个方案作为目的配置方案。由于分布式系统中的计算单元的硬件资源一般都是相同的,越是平均的分配就意味着空闲的资源越少,这样就越优化,用自然语言来描述就是:分配到不同计算单元内的进程所占用的资源差值最小,即各计算单元的拟占用资源的产值最小的方案是较为理想的资源配置方案。所以在本实施例中,选择计算单元的拟占用资源最平均的初步配置方案作为目的配置方案。After the initial configuration schemes are calculated in the foregoing steps, at least one scheme may be selected from the multiple schemes as the destination configuration scheme according to the calculation result. Since the hardware resources of the computing units in the distributed system are generally the same, the more even the allocation means the less resources are available, so the more optimized, the description in natural language is: assigned to different computing units. The difference in the resources occupied by the process is the smallest, that is, the scheme that the output value of the planned occupied resources of each computing unit is the smallest is an ideal resource allocation scheme. Therefore, in this embodiment, a preliminary configuration scheme in which the calculation unit is most averaging the resources to be occupied is selected as the destination configuration scheme.
如何确定各计算单元的拟占用资源是否平均呢?本实施例的一种示例提供一种选择方案,请参考图3:How to determine whether the estimated resources occupied by each computing unit are average? An example of this embodiment provides an option, please refer to FIG. 3:
S301、计算初步配置方案中各计算单元的拟占用资源的两两差值,例如,得到一 个初步配置方案中的三个计算单元的拟占用资源分别为:S301. Calculate a difference between the two occupied resources of each computing unit in the preliminary configuration scheme, for example, obtain one The planned occupied resources of the three computing units in the initial configuration scheme are:
P标1=[3.5v,4v,20v,2v]、P标2=[2.5v,6v,10v,4v]、P标3=[3v,2v,5v,4v]。P = 1 = [3.5v, 4v, 20v, 2v], P 2 = [2.5v, 6v, 10v, 4v], P 3 = [3v, 2v, 5v, 4v].
三个计算单元的拟占用资源之间的两两差值分别为:The difference between the two occupied resources of the three computing units is:
ΔB1-2=|P标1-P标2|=[1v,2v,10v,2v]=15v;ΔB 1-2 =|P mark 1 -P mark 2 |=[1v,2v,10v,2v]=15v;
ΔB2-3=|P标2-P标3|=[0.5v,4v,5v,0v]=9.5v;ΔB 2-3 =|P mark 2 -P mark 3 |=[0.5v,4v,5v,0v]=9.5v;
ΔB1-3=|P标1-P标3|=[0.5v,2v,15v,2v]=19.5v。ΔB 1-3 =|P is 1 -P is 3 |=[0.5v, 2v, 15v, 2v] = 19.5v.
S302、选择初步配置方案中拟占用资源间的最大差值作为表征值来表征初步配置方案。S302. Select a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to represent the initial configuration scheme.
在上述示例当中,应当选择19.5v作为表征值来表征该初步配置方案。In the above example, 19.5v should be selected as the characterization value to characterize the preliminary configuration scheme.
S303、选择表征值最小的初步配置方案作为目的配置方案。S303. Select a preliminary configuration scheme with the smallest characterization value as the destination configuration scheme.
假设现在有三个初步配置方案,表征值分别为16v、17v、19.5v,那么根据本公开的方案,应当选择第一种初步配置方案作为目的配置方案对各计算单元进行配置。Assuming that there are three preliminary configuration schemes, the characterization values are 16v, 17v, 19.5v, respectively, then according to the scheme of the present disclosure, the first preliminary configuration scheme should be selected as the destination configuration scheme to configure each computing unit.
值的注意的是,如果采用图3所示的方法进行目的配置方案的选择,在计算出各计算单元的拟占用资源之间的两两差值之前,都不应当将进程各资源对应的标准资源合并计算,例如,不能将上面的P标1计算为29.5v。因为两两差值是绝对差值,如果事先将各资源对应的标准资源合并,那么会导致两种初步配置方案的计算结果相近,但是实际占用资源极不平衡的情况。It is noted that if the method of the configuration shown in FIG. 3 is used to select the destination configuration scheme, the standard corresponding to each resource of the process should not be used until the two-two difference between the planned occupied resources of each computing unit is calculated. The resource combination calculation, for example, cannot calculate the above P standard 1 as 29.5v. Because the difference between the two pairs is an absolute difference, if the standard resources corresponding to the resources are combined in advance, the calculation results of the two preliminary configuration schemes are similar, but the actual occupied resources are extremely unbalanced.
由于方差具备表征各数值的分配是否平均的能力,所以,在本实施例提供的另外一种优选示例当中,可以选择计算各计算单元的拟占用资源之间的方差,然后根据方差的计算结果选择目的配置方案。第二种选择目的配置方案的方式如图4所示:Since the variance has the ability to represent whether the distribution of the respective values is averaged, in another preferred example provided by the embodiment, the variance between the pseudo-occupied resources of each computing unit may be selected, and then the calculation result of the variance is selected according to the calculation result of the variance. Destination configuration scheme. The second way to select the destination configuration scheme is shown in Figure 4:
S401、计算各初步配置方案中各计算单元的拟占用资源的方差。S401. Calculate a variance of a planned occupied resource of each computing unit in each preliminary configuration scheme.
例如,一个初步配置方案中的三个计算单元的拟占用资源分别为:For example, the proposed occupied resources of three computing units in a preliminary configuration scheme are:
P标1=[3.5v,4v,20v,2v]、P标2=[2.5v,6v,10v,4v]、P标3=[3v,2v,5v,4v]。P = 1 = [3.5v, 4v, 20v, 2v], P 2 = [2.5v, 6v, 10v, 4v], P 3 = [3v, 2v, 5v, 4v].
那么,P标1=29.5v,P标2=22.5v,P标3=14v。三个计算单元的拟占用资源的平均值为P=22v,根据方差的计算公式可以得到方差值为40.17。Then, P is 1 = 29.5v, P is 2 = 22.5v, and P is 3 = 14v. Three unit calculates an average value for the proposed resource intensive, P = 22v, the variance value of 40.17 can be obtained according to the formula of the variance.
S402、选择方差值最小的初步配置方案作为目的配置方案。S402. The initial configuration scheme with the smallest variance value is selected as the destination configuration scheme.
方差越小,说明各计算单元的拟占用资源之间越平均,资源配置越优化也,即该初步配置方案越理想。The smaller the variance, the more average the resources to be occupied by each computing unit, and the more optimized the resource allocation, that is, the more ideal the initial configuration scheme.
本实施例提供的分布式系统的资源配置方法,通过各资源的等效量化关系可以将进程占用的各种不同的资源进行统一量化,使得不同资源之间具备进行计算、比较的 条件,在此基础上,可以根据预设要求选择出最优的资源配置方案,实现分布式系统的资源优化配置,提高资源利用率。The resource allocation method of the distributed system provided in this embodiment can uniformly quantize various resources occupied by the process by using the equivalent quantization relationship of each resource, so that different resources have calculation and comparison between them. Conditions, on this basis, the optimal resource allocation scheme can be selected according to the preset requirements, the resource optimization configuration of the distributed system is realized, and the resource utilization rate is improved.
实施例二:Embodiment 2:
本实施例提供一种分布式系统的资源配置装置,实施例一提供的分布式系统的资源配置方法可以在该装置上使用,请参考图5:This embodiment provides a resource configuration apparatus for a distributed system. The resource configuration method of the distributed system provided in Embodiment 1 can be used on the device. Please refer to FIG. 5:
分布式系统的资源配置装置50包括关系获取模块501、初步确定模块502、占用计算模块503和方案选择模块504。The resource configuration apparatus 50 of the distributed system includes a relationship acquisition module 501, a preliminary determination module 502, an occupancy calculation module 503, and a scheme selection module 504.
关系获取模块501用于获取各待配置进程所占用的各资源的等效量化关系。The relationship obtaining module 501 is configured to obtain an equivalent quantization relationship of each resource occupied by each to-be-configured process.
一个进程在计算单元上运行的时候,会占用该计算单元的CPU、内存、硬盘、网络带宽等资源。通常,CPU以core(“核”)作为计量单位,内存的单位为GB(千兆字节),硬盘I/O(Input/Output,输入/输出)的单位为MB/s(兆比特每秒),而网络带宽以bps来计量。这几种资源由于性质不同,计量的单位也不同,所以在通常意义上,是没有办法将它们放在一起进行衡量比较的。这也就是为什么现有技术中还没有提出一种资源分配方案,能够全面考虑进程运行时所消耗的各方面的资源。例如,一个进程a在计算单元A上运行,其需要占用A计算单元2core的CPU和64GB的内存,几乎不占用硬盘与网络带宽。而进程b在计算单元B上运行,由于算法不是很复杂,所以对CPU的要求很低,但是需要占用32GB的内存和100MB/s的硬盘I/O,根据现有技术的方案,很难评判进程a和b哪一个的对计算单元的消耗更大,也很难说明是计算单元A的资源占用更大还是计算单元B的资源占用更大。就如同现在有甲乙两个金属块,甲金属块重0.5千克,体积为3立方厘米,乙的重量为0.2千克,体积为10立方厘米。从这些信息中很难比较个金属块会更值钱一些。又或者说现在有一个甲工程项目,是要修建一座桥,而乙工程项目是要铺设一条路,由于桥跟路的修建方案、地理环境等有很大的不同,所以我们不能简单的从桥和路的长短、宽窄来说明这两个工程项目哪一个更宏大一些。When a process runs on a computing unit, it consumes resources such as CPU, memory, hard disk, and network bandwidth of the computing unit. Usually, the CPU uses core ("core") as the unit of measurement, the unit of memory is GB (gigabytes), and the unit of hard disk I/O (Input/Output, input/output) is MB/s (megabits per second). ), while network bandwidth is measured in bps. These kinds of resources have different units of measurement because of their different natures. Therefore, in the usual sense, there is no way to put them together for comparison and comparison. This is why there is no resource allocation scheme in the prior art, which can fully consider all aspects of resources consumed by the process. For example, a process a runs on computing unit A, which requires CPUs of A computing unit 2core and 64 GB of memory, and hardly occupies hard disk and network bandwidth. Process b runs on computing unit B. Since the algorithm is not very complicated, the CPU requirements are very low, but it requires 32 GB of memory and 100 MB/s of hard disk I/O. According to the prior art scheme, it is difficult to judge. Which of the processes a and b consumes more of the computing unit, and it is difficult to say whether the resource occupancy of the computing unit A is larger or the resource occupancy of the computing unit B is larger. Just as there are two metal blocks of A and B, the metal block weighs 0.5 kilograms and the volume is 3 cubic centimeters. The weight of B is 0.2 kilograms and the volume is 10 cubic centimeters. It's hard to compare a piece of metal from this information. Or maybe there is an A project, which is to build a bridge, and the B project is to lay a road. Because the construction of the bridge and the geographical environment are very different, we can’t simply take the bridge. The length and width of the roads indicate which of the two projects is more ambitious.
在本实施例中,可以根据等效量化关系将各种不同的资源转换成一种标准的资源,使得各种不同的资源能够具备进行比较的基础。等效量化关系是将各资源量化为标准资源的转换关系,就相当于将甲和乙的项目统一根据耗费资金来比较项目的大小,例如甲工程项目的资金耗费是100万,而乙的资金消耗为87万,当甲和乙这两个工程被统一按照资金耗费计量后,甲乙工程的大小也就能够进行比较了,相当于有一个资金耗费为100万的工程和一个资金耗费为87万的工程,这时,很明显,甲工程项目更大。修桥工程和建路工程到资金之间的换算关系就相当于本实施例中的等效量化关系。In this embodiment, various different resources can be converted into a standard resource according to the equivalent quantization relationship, so that various different resources can have the basis for comparison. The equivalent quantitative relationship is to convert each resource into a standard resource conversion relationship, which is equivalent to comparing the items of A and B according to the cost of the project. For example, the capital cost of a project is 1 million, and the funds of B are The consumption is 870,000. When the two projects of A and B are uniformly measured according to the capital expenditure, the size of the project can be compared, which is equivalent to a project with a capital cost of 1 million and a capital cost of 870,000. At the time of the project, it was obvious that the A project was even bigger. The conversion relationship between the bridge repairing project and the road construction project to the fund is equivalent to the equivalent quantitative relationship in the present embodiment.
在本实施例中,关系获取模块501获取的等效量化关系可以由用户自定义。用户可以根据自己的考量,设定CPU、内存、硬盘、网络带宽之间的转换关系,例如简单地,用户从资金耗费方面来确定等效关系,如果扩展一个2core的CPU和扩展一 个64GB的内存所需要的花费一样多,那么就可以认为2core的CPU等效于64GB的内存。同理,如果扩展1000Mbps的网络带宽与扩展2core的CPU的价格相同,那么1000Mbps的网络带宽可以等效于2core的CPU,100MB/s的硬盘I/O也可以等效于64GB的内存,只要扩展100MB/s的硬盘I/O和扩展64GB的内存的花费一样多。In this embodiment, the equivalent quantization relationship acquired by the relationship obtaining module 501 can be customized by the user. Users can set the conversion relationship between CPU, memory, hard disk and network bandwidth according to their own considerations. For example, the user can determine the equivalent relationship from the aspect of capital consumption, if you extend a 2core CPU and expand one. A 64GB of memory costs as much, so you can think of a 2core CPU equivalent to 64GB of memory. Similarly, if the network bandwidth of 1000Mbps is the same as the price of the CPU of the extended 2core, the network bandwidth of 1000Mbps can be equivalent to the CPU of 2core, and the hard disk I/O of 100MB/s can be equivalent to the memory of 64GB, as long as it expands. 100MB/s of hard disk I/O costs as much as 64GB of expanded memory.
标准资源是实现各类型资源进行比较的基础,标准资源可以是需要被标准量化的资源以外的任意一种。例如,在上面的示例中,可以将“修桥工程”和“建路工程”统一换算成“资金耗费”,这时“资金耗费”属于“修桥工程”和“修桥工程”以外的一种,““资金耗费”也可以用“人力耗费”等来代替。回到本实施例中,标准资源可以是需要被量化统一的CPU、内存、硬盘I/O以及网络带宽以外的任意一种,例如用户自定义一种“虚拟资源”,例如用户自定义“2core的CPU=64GB的内存=100MB/s的硬盘I/O=1000Mbps的网络带宽=1v”,这里1v就是一种虚拟资源,可以将CPU、内存、硬盘I/O以及网络带宽都统一换算成这种虚拟资源之后在进行比较。The standard resource is the basis for realizing the comparison of various types of resources, and the standard resource may be any one other than the resource that needs to be quantified by the standard. For example, in the above example, “bridge repair project” and “road construction project” can be uniformly converted into “funding cost”. At this time, “funding cost” belongs to one other than “bridge repair project” and “bridge repair project”. Kind of, ""funding cost" can also be replaced by "manpower cost", etc. In this embodiment, the standard resource can be any one of the CPU, memory, hard disk I/O, and network bandwidth that need to be quantized and unified. For example, the user customizes a kind of "virtual resource", for example, user-defined "2core CPU=64GB memory=100MB/s hard disk I/O=1000Mbps network bandwidth=1v", where 1v is a virtual resource. The CPU, memory, hard disk I/O, and network bandwidth can be uniformly converted into such virtual resources and then compared.
在本实施例中通过“进程=[CPU、内存、硬盘I/O、网络带宽]”的方式来表示进程,假定当前一个进程P的运行需要3core的CPU、64GB的内存、1000MB/s的硬盘I/O以及500Mbps的网络带宽,那么进程P=[3croe,64GB,1000MB/s,500Mbps],如果标准资源为虚拟资源时,那么进程P=[1.5v,1v,10v,0.5v]。In this embodiment, the process is represented by "process=[CPU, memory, hard disk I/O, network bandwidth]", and it is assumed that the current process P requires 3 core CPU, 64 GB of memory, and 1000 MB/s hard disk. I / O and 500Mbps network bandwidth, then the process P = [3croe, 64GB, 1000MB / s, 500Mbps], if the standard resource is a virtual resource, then the process P = [1.5v, 1v, 10v, 0.5v].
可以理解的是,标准资源也可以是需要被标准量化的资源中的任意一种,例如,直接将CPU作为标准资源,那么进程P=[3croe,2core,20core,1core],这就相当于将分别以“修桥工程”和“建路工程”统一换算成以“修桥工程”或者“修桥工程”中的任意一种,例如从资金消耗的角度来说,“修桥工程”等于1个“修桥工程”,“建路工程”可以等于0.87个“修桥工程”。It can be understood that the standard resource can also be any one of the resources that need to be quantified by the standard. For example, if the CPU is directly used as a standard resource, then the process P=[3croe, 2core, 20core, 1core], which is equivalent to The “bridge repair project” and the “road construction project” are uniformly converted into any one of “bridge repair project” or “bridge repair project”. For example, from the perspective of capital consumption, “bridge repair project” is equal to 1 A "bridge repair project" and "road construction project" can be equal to 0.87 "bridge repair projects".
在上述实施例中,关系获取模块501获取是用户根据扩展各种资源的资金花费来设置的等效量化关系,可以理解的是,本公开并不限定关系获取模块501获取到的等效量化关系是如何确定的,因为用户可以根据其主观意愿对等效量化关系做任何形式的设置。当然根据资金耗损以外的其他因素来设置等效量化关系也是可行的,例如有的资源在扩展的时候难度较大,需要耗费用户更多的时间,而有的资源可能比较容易就能实现扩展,显然,用户也可以根据扩展各种资源的难度来设置等效量化关系。In the above embodiment, the relationship obtaining module 501 is an equivalent quantitative relationship that is set by the user according to the cost of expanding various resources. It can be understood that the present disclosure does not limit the equivalent quantitative relationship acquired by the relationship obtaining module 501. How is it determined? Because users can make any form of equivalent quantitative relationship according to their subjective wishes. Of course, it is also feasible to set the equivalent quantitative relationship according to other factors than the capital consumption. For example, some resources are more difficult to expand, and it takes more time for the user, and some resources may be easier to expand. Obviously, the user can also set the equivalent quantization relationship according to the difficulty of expanding various resources.
初步确定模块502获取当前各待配置进程在各计算单元上的初步配置方案。The preliminary determining module 502 obtains a preliminary configuration scheme of each current configuration process on each computing unit.
初步配置方案一般包括多种,由于初步配置方案只是满足最基本的配置要求,所以有许多的初步配置方案中的进程分配得不合理,而得到最终的目的配置方案需要对这些初步配置方案进行筛选。The initial configuration scheme generally includes multiple types. Since the initial configuration scheme only meets the most basic configuration requirements, there are many initial configuration schemes in which the process allocation is unreasonable, and the final destination configuration scheme needs to be filtered. .
下面,本实施例提出一种初步确定模块502,请参考图6:In the following, this embodiment provides a preliminary determination module 502, please refer to FIG. 6:
初步确定模块502包括第一子模块5021、第二子模块5022、第三子模块5023。第一子模块5021用于根据预设要求确定计算单元的单元数目和特定进程。假定现在的预设要求是将A、B、C、D、E五个进程配置到分布式系统的三个计算单元甲、乙、 丙上。那么,初步配置方案可以有
Figure PCTCN2017076347-appb-000003
种,即60种。在实际应用过程中,有一些进程的配置会有特定的要求,这种进程即为特定进程,特定进程是预先确定所属计算单元的进程。例如,在一个分布式系统中,明确要求要将进程B分配到甲计算单元上,那么进程B就是特定进程。
The preliminary determination module 502 includes a first sub-module 5021, a second sub-module 5022, and a third sub-module 5023. The first sub-module 5021 is configured to determine a unit number and a specific process of the computing unit according to a preset requirement. It is assumed that the current preset requirement is to configure the five processes A, B, C, D, and E to the three computing units A, B, and C of the distributed system. Then, the preliminary configuration scheme can have
Figure PCTCN2017076347-appb-000003
Kind, that is, 60 species. In the actual application process, there are specific requirements for the configuration of some processes. This process is a specific process, and a specific process is a process that predetermines the owning computing unit. For example, in a distributed system, it is explicitly required to assign process B to a computing unit, then process B is a specific process.
第二子模块5022用于将特定进程配置到其所属的计算单元上。第二子模块5022可以根据预设要求将特定进程B分配到分布式系统的计算单元甲上,由于进程B的分配方案已经确定,那么可以形成的初步配置方案已经没有60种了。The second sub-module 5022 is configured to configure a particular process onto the computing unit to which it belongs. The second sub-module 5022 can allocate the specific process B to the computing unit A of the distributed system according to the preset requirement. Since the allocation scheme of the process B has been determined, there are no 60 preliminary configuration schemes that can be formed.
第三子模块5023将特定进程以外的待配置进程随机配置到各计算单元上。除了进程B以外,此时还剩下四个进程A、C、D、E需要被分配到三个计算单元上,第三子模块5023可以将A、C、D、E四个进程随机地分配到甲、乙、、丙三个计算单元上。这时,能够形成的初步配置方案为
Figure PCTCN2017076347-appb-000004
种,即24种。
The third sub-module 5023 randomly configures the processes to be configured outside the specific process to the respective computing units. In addition to process B, there are four processes A, C, D, and E that need to be assigned to three computing units. The third sub-module 5023 can randomly assign four processes A, C, D, and E. Go to the three calculation units of A, B, and C. At this time, the preliminary configuration that can be formed is
Figure PCTCN2017076347-appb-000004
Kind, that is, 24 kinds.
本实施例中,由占用计算模块503根据等效量化关系计算各初步配置方案中各计算单元的拟占用资源。In this embodiment, the occupancy calculation module 503 calculates the planned occupied resources of each computing unit in each preliminary configuration scheme according to the equivalent quantization relationship.
由于在初步配置方案中的各个进程只是拟将被配置到对应的计算单元上,而实际上还并未被配置,所以计算初步配置方案中各计算单元被配置到其上的进程占用的标准资源还只是计算假定情况中被占用的资源,假定情况中被占用的资源即拟占用资源,拟占用资源是计算单元被拟派到其上的待配置进程所占用的标准资源。占用计算模块503至少可以为以下两种中的任意一种,请进一步参考图7和图8所示:Since each process in the preliminary configuration scheme is only intended to be configured on the corresponding computing unit, but has not been configured in practice, the standard resources occupied by the processes to which the computing units are configured in the preliminary configuration scheme are calculated. It is also only to calculate the resources that are occupied in the assumed situation. It is assumed that the occupied resources in the case are intended to occupy resources, and the resources to be occupied are the standard resources occupied by the to-be-configured process to which the computing unit is to be allocated. The occupancy calculation module 503 can be at least one of the following two types. Please refer to FIG. 7 and FIG. 8 for further reference:
图7所示的占用计算模块503包括第一计算模块5031和第二计算模块5032。第一计算模块5031先根据等效量化关系将各待配置进程在运行的过程中需要占用资源转化成标准资源,然后第二计算模块5032根据转化后的标准资源计算各计算单元被拟派到其上的进程所占用的标准资源。The occupancy calculation module 503 shown in FIG. 7 includes a first calculation module 5031 and a second calculation module 5032. The first calculating module 5031 first converts the resources that need to be configured in the running process to the standard resources according to the equivalent quantization relationship, and then the second calculating module 5032 calculates, according to the converted standard resources, each computing unit is proposed to be The standard resources occupied by the process.
图8所示的占用计算模块503包括第三计算模块5033和第四计算模块5034。第三计算模块5033先计算各计算单元被拟派到其上的进程所占用的真实资源,然后第四计算模块5034根据等效量化关系将得到的真实资源的计算结果转化为标准资源。The occupancy calculation module 503 shown in FIG. 8 includes a third calculation module 5033 and a fourth calculation module 5034. The third calculating module 5033 first calculates the real resources occupied by the processes to which the computing units are to be dispatched, and then the fourth calculating module 5034 converts the calculated results of the obtained real resources into standard resources according to the equivalent quantization relationship.
简单来说,图7所示的占用计算模块503就是先以进程作为计算对象,对资源进行等效量化,转化成标准资源,然后以计算单元为对象,计算器被占用的标准资源。而图8中占用计算模块503的计算过程正好相反,是先以计算单元计算资源占用情况,然后才根据等效量化关系将真实资源转化成标准资源。本领域技术人员应当明白的是,虽然这两种占用计算模块进行计算的顺序不同,但是计算得到的结果应当是相同的。例如,一个计算单元有A、B、C三个进程,PA=[3core,64GB,1000MB/s,500Mbps],PB=[2core,64GB,1000MB/s,1000Mbps],PC=[2core,128GB,550MB/s,500Mbps],等效量化关系为“2core的CPU=64GB的内存=100MB/s的硬盘I/O=1000Mbps的网络带宽=1v”。为了得到该计算单元的拟占用资源,第一种占用计算模块会先对各进程运行时所占用的资源进行标准量化: In brief, the occupancy calculation module 503 shown in FIG. 7 is a standard resource that is first occupied by a process by using a process as a calculation object, equivalently quantizing a resource, converting it into a standard resource, and then taking the calculation unit as an object. The calculation process of the occupancy calculation module 503 in FIG. 8 is just the opposite. The calculation unit calculates the resource occupancy first, and then converts the real resource into a standard resource according to the equivalent quantization relationship. It should be understood by those skilled in the art that although the order in which the two occupancy calculation modules perform calculations is different, the calculated results should be the same. For example, a computing unit has three processes A, B, and C, P A = [3core, 64GB, 1000MB/s, 500Mbps], P B = [2core, 64GB, 1000MB/s, 1000Mbps], P C = [2core , 128GB, 550MB/s, 500Mbps], the equivalent quantization relationship is "2core CPU = 64GB of memory = 100MB / s of hard disk I / O = 1000Mbps network bandwidth = 1v". In order to obtain the intended occupied resources of the computing unit, the first type of occupancy calculation module first performs standard quantization on the resources occupied by each process:
PA=[3core,64GB,1000MB/s,500Mbps]=[1.5v,1v,10v,0.5v];P A = [3core, 64GB, 1000MB/s, 500Mbps] = [1.5v, 1v, 10v, 0.5v];
PB=[2core,64GB,1000MB/s,1000Mbps]=[1v,1v,10v,1v];P B = [2core, 64GB, 1000MB/s, 1000Mbps] = [1v, 1v, 10v, 1v];
PC=[2core,128GB,550MB/s,500Mbps]=[1v,2v,5.5v,0.5v]。P C = [2core, 128 GB, 550 MB/s, 500 Mbps] = [1v, 2v, 5.5v, 0.5v].
然后再以计算单元为对象,计算该计算单元的拟资源占用情况:Then calculate the pseudo-resource occupancy of the computing unit by using the computing unit as an object:
P=[3.5v,4v,25.5v,2v]。P mark = [3.5v, 4v, 25.5v, 2v].
第二种占用计算模块会先计算计算单元被进程A、B、C所占用的真实资源:The second occupancy calculation module first calculates the real resources occupied by the calculation unit by processes A, B, and C:
P=[7core,256GB,2550MB/s,2000Mbps];P true = [7core, 256GB, 2550MB / s, 2000Mbps];
接着根据等效量化关系——“2core的CPU=64GB的内存=100MB/s的硬盘I/O=1000Mbps的网络带宽=1v”计算得到该计算单元的拟占用资源:Then, according to the equivalent quantization relationship - "2core CPU=64GB memory=100MB/s hard disk I/O=1000Mbps network bandwidth=1v", the calculated occupied resources of the computing unit are calculated:
P=[(7core/2core)*v,(256GB/64GB)*v,((2550MB/s)/(100MB/s))*v,(2000Mbps/1000Mbps)*v]=[3.5v,4v,25.5v,2v]。P mark = [(7core/2core) * v, (256GB / 64GB) * v, ((2550MB / s) / (100MB / s)) * v, (2000Mbps / 1000Mbps) * v] = [3.5v, 4v , 25.5v, 2v].
方案选择模块504用于根据计算结果选择各计算单元的拟占用资源满足预设条件的初步配置方案作为目的配置方案。The solution selection module 504 is configured to select, according to the calculation result, a preliminary configuration scheme that each of the computing units whose planned occupied resources meet the preset condition is used as the destination configuration solution.
在上述步骤中对各个初步配置方案都进行了计算之后,方案选择模块504可以根据计算结果从多个方案中选择出至少一个方案作为目的配置方案。由于分布式系统中的计算单元的硬件资源一般都是相同的,越是平均的分配就意味着空闲的资源越少,这样就越优化,用自然语言来描述就是:分配到不同计算单元内的进程所占用的资源差值最小,即各计算单元的拟占用资源的产值最小的方案是较为理想的资源配置方案。所以在本实施例中,如图9所示,方案选择模块504包括均匀选择模块5041,均匀选择模块5041用于选择计算单元的拟占用资源最平均的初步配置方案作为目的配置方案。After the calculation of each preliminary configuration scheme is performed in the foregoing steps, the scheme selection module 504 may select at least one scheme from the multiple schemes as the destination configuration scheme according to the calculation result. Since the hardware resources of the computing units in the distributed system are generally the same, the more even the allocation means the less resources are available, so the more optimized, the description in natural language is: assigned to different computing units. The difference in the resources occupied by the process is the smallest, that is, the scheme that the output value of the planned occupied resources of each computing unit is the smallest is an ideal resource allocation scheme. Therefore, in this embodiment, as shown in FIG. 9, the scheme selection module 504 includes a uniform selection module 5041, and the uniform selection module 5041 is configured to select a preliminary configuration scheme of the calculation unit that is the most averaging of the resources to be used as the destination configuration scheme.
如何确定各计算单元的拟占用资源是否平均呢?在一种本实施例的一种示例提供一种均匀选择模块,请参考图10:How to determine whether the estimated resources occupied by each computing unit are average? In an example of this embodiment, a uniform selection module is provided, please refer to FIG. 10:
均匀选择模块5041包括第六计算模块50411和表征选择模块50412,以及最值选择模块50413,The uniform selection module 5041 includes a sixth calculation module 50411 and a characterization selection module 50412, and a maximum value selection module 50413,
第六计算模块50411用于计算初步配置方案中各计算单元的拟占用资源的两两差值,例如,得到一个初步配置方案中的三个计算单元的拟占用资源分别为:The sixth calculation module 50411 is configured to calculate the difference between the two occupied resources of each computing unit in the preliminary configuration scheme. For example, the estimated occupied resources of the three computing units in a preliminary configuration scheme are:
P标1=[3.5v,4v,20v,2v]、P标2=[2.5v,6v,10v,4v]、P标3=[3v,2v,5v,4v]。P = 1 = [3.5v, 4v, 20v, 2v], P 2 = [2.5v, 6v, 10v, 4v], P 3 = [3v, 2v, 5v, 4v].
第六计算模块50411计算得到这三个计算单元的拟占用资源之间的两两差值分别为:The sixth calculation module 50411 calculates that the difference between the two occupied resources of the three computing units is:
ΔB1-2=|P标1-P标2|=[1v,2v,10v,2v]=15v;ΔB 1-2 =|P mark 1 -P mark 2 |=[1v,2v,10v,2v]=15v;
ΔB2-3=|P标2-P标3|=[0.5v,4v,5v,0v]=9.5v; ΔB 2-3 =|P mark 2 -P mark 3 |=[0.5v,4v,5v,0v]=9.5v;
ΔB1-3=|P标1-P标3|=[0.5v,2v,15v,2v]=19.5v。ΔB 1-3 =|P is 1 -P is 3 |=[0.5v, 2v, 15v, 2v] = 19.5v.
表征选择模块50412用于选择初步配置方案中拟占用资源间的最大差值作为表征值来表征初步配置方案。例如,在在上述示例当中,表征选择模块50412应当选择19.5v作为表征值来表征该初步配置方案。The characterization selection module 50412 is configured to select a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme. For example, in the above example, the characterization selection module 50412 should select 19.5v as the characterization value to characterize the preliminary configuration scheme.
最值选择模块50413用于选择表征值最小的初步配置方案作为目的配置方案。假设现在有三个初步配置方案,表征值分别为16v、17v、19.5v,那么根据本公开的方案,最值选择模块50413应当选择第一种初步配置方案作为目的配置方案对各计算单元进行配置。The most value selection module 50413 is configured to select a preliminary configuration scheme with the smallest characterization value as the destination configuration scheme. Assuming that there are three preliminary configuration schemes, the characterization values are 16v, 17v, 19.5v, respectively, then according to the solution of the present disclosure, the maximum value selection module 50413 should select the first preliminary configuration scheme as the destination configuration scheme to configure each computing unit.
值的注意的是,如果均匀选择模块5041如图10所示,在计算出各计算单元的拟占用资源之间的两两差值之前,都不应当将进程各资源对应的标准资源合并计算,例如,不能将上面的P标1计算为29.5v。因为两两差值是绝对差值,如果事先将各资源对应的标准资源合并,那么会导致两种初步配置方案的计算结果相近,但是实际占用资源极不平衡的情况。It should be noted that if the uniform selection module 5041 is as shown in FIG. 10, the standard resources corresponding to the resources of the process should not be combined before calculating the difference between the two resources of the computing units. For example, the above P label 1 cannot be calculated as 29.5v. Because the difference between the two pairs is an absolute difference, if the standard resources corresponding to the resources are combined in advance, the calculation results of the two preliminary configuration schemes are similar, but the actual occupied resources are extremely unbalanced.
由于方差具备表征各数值的分配是否平均的能力,所以,在本实施例提供的另外一种优选示例当中,请结合图11,均匀选择模块5041包括第五计算模块50414和方差选择模块50415。该均匀选择模块5041可以计算各计算单元的拟占用资源之间的方差,然后根据方差的计算结果选择目的配置方案。In the other preferred example provided by this embodiment, the uniform selection module 5041 includes a fifth calculation module 50414 and a variance selection module 50415. The uniform selection module 5041 can calculate a variance between the pseudo-occupied resources of each computing unit, and then select a destination configuration scheme according to the calculation result of the variance.
第五计算模块50414用于计算各初步配置方案中各计算单元的拟占用资源的方差。例如,一个初步配置方案中的三个计算单元的拟占用资源分别为:The fifth calculating module 50414 is configured to calculate a variance of the planned occupied resources of each computing unit in each preliminary configuration scheme. For example, the proposed occupied resources of three computing units in a preliminary configuration scheme are:
P标1=[3.5v,4v,20v,2v]、P标2=[2.5v,6v,10v,4v]、P标3=[3v,2v,5v,4v]。P = 1 = [3.5v, 4v, 20v, 2v], P 2 = [2.5v, 6v, 10v, 4v], P 3 = [3v, 2v, 5v, 4v].
那么,P标1=29.5v,P标2=22.5v,P标3=14v。三个计算单元的拟占用资源的平均值为P=22v,第五计算模块50414根据方差的计算公式可以得到方差值为40.17。Then, P is 1 = 29.5v, P is 2 = 22.5v, and P is 3 = 14v. Three unit calculates an average value for the proposed resource intensive, P = 22v, the fifth block 50414 calculates the variance value of 40.17 can be obtained according to the formula of the variance.
方差选择模块50415根据第五计算模块50414的计算结果选择方差值最小的初步配置方案作为目的配置方案。方差越小,说明各计算单元的拟占用资源之间越平均,资源配置越优化也,即该初步配置方案越理想。The variance selection module 50415 selects a preliminary configuration scheme in which the variance value is the smallest according to the calculation result of the fifth calculation module 50414 as the destination configuration scheme. The smaller the variance, the more average the resources to be occupied by each computing unit, and the more optimized the resource allocation, that is, the more ideal the initial configuration scheme.
本实施例提供的分布式系统的资源配置装置,通过各资源的等效量化关系可以将进程占用的各种不同的资源进行统一量化,使得不同资源之间具备进行计算、比较的条件,在此基础上,可以根据预设要求选择出最优的资源配置方案,实现分布式系统的资源优化配置,提高资源利用率。The resource configuration apparatus of the distributed system provided by the embodiment can uniformly quantize various resources occupied by the process by using the equivalent quantization relationship of each resource, so that different resources have conditions for calculation and comparison. Based on the preset requirements, the optimal resource configuration scheme can be selected to optimize resource allocation of the distributed system and improve resource utilization.
显然,本领域的技术人员应该明白,上述本公开的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将 它们存储在存储介质(ROM/RAM、磁碟、光盘)中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。所以,本公开不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the above modules or steps of the present disclosure can be implemented by a general computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that They are stored in a storage medium (ROM/RAM, disk, optical disk) by a computing device, and in some cases, the steps shown or described may be performed in a different order than here, or they may be separately It is made by making individual integrated circuit modules, or by making a plurality of modules or steps of them into a single integrated circuit module. Therefore, the present disclosure is not limited to any specific combination of hardware and software.
以上内容是结合具体的实施方式对本公开所作的进一步详细说明,不能认定本公开的具体实施只局限于这些说明。对于本公开所属技术领域的普通技术人员来说,在不脱离本公开构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本公开的保护范围。The above content is a further detailed description of the present disclosure in conjunction with the specific embodiments, and the specific implementation of the present disclosure is not limited to the description. It is to be understood by those skilled in the art that the present invention may be construed as being limited to the scope of the present disclosure.
工业实用性Industrial applicability
本公开适用于计算机技术领域,用以通过各资源的等效量化关系将进程占用的各种不同的资源进行统一量化,使得不同资源之间具备进行计算、比较的条件,在此基础上,可以根据预设要求选择出最优的资源配置方案,实现分布式系统的资源优化配置,提高资源利用率。 The present disclosure is applicable to the field of computer technology, and is used to uniformly quantify various resources occupied by processes through the equivalent quantitative relationship of resources, so that different resources have conditions for calculation and comparison, and on this basis, According to the preset requirements, the optimal resource configuration scheme is selected to implement resource optimization configuration of the distributed system and improve resource utilization.

Claims (11)

  1. 一种分布式系统的资源配置方法,包括:A resource configuration method for a distributed system includes:
    获取各资源的等效量化关系,所述等效量化关系为将各所述资源量化为标准资源的转换关系;Obtaining an equivalent quantitative relationship of each resource, where the equivalent quantization relationship is a conversion relationship that quantizes each of the resources into a standard resource;
    获取当前各待配置进程在各计算单元上的初步配置方案;Obtaining a preliminary configuration scheme of each current configuration process on each computing unit;
    根据所述等效量化关系计算各所述初步配置方案中各所述计算单元的拟占用资源,所述拟占用资源为所述计算单元被拟派到其上的所述待配置进程所占用的标准资源;And calculating, according to the equivalent quantization relationship, a planned occupied resource of each of the computing units in each of the preliminary configuration scenarios, where the planned occupied resource is occupied by the to-be-configured process to which the computing unit is to be allocated Standard resources
    根据计算结果选择各所述计算单元的所述拟占用资源满足预设条件的初步配置方案作为目的配置方案。And selecting, according to the calculation result, a preliminary configuration scheme that the planned occupied resource of each of the computing units meets a preset condition is used as a destination configuration scheme.
  2. 如权利要求1所述的分布式系统的资源配置方法,其中,所述标准资源为所述资源中的任意一种或者为所述资源以外的任意一种。The resource configuration method of a distributed system according to claim 1, wherein the standard resource is any one of the resources or any one of the resources.
  3. 如权利要求1所述的分布式系统的资源配置方法,其中,所述获取当前各待配置进程在各计算单元上的初步配置方案包括:The resource configuration method of the distributed system according to claim 1, wherein the obtaining a preliminary configuration scheme of each current configuration process on each computing unit comprises:
    根据预设要求确定所述计算单元的单元数目和特定进程,所述特定进程为预先确定所属计算单元的待配置进程;Determining, according to a preset requirement, a number of units of the computing unit and a specific process, where the specific process is a process to be configured in advance to be determined by the associated computing unit;
    将所述特定进程配置到其所属的所述计算单元上;Configuring the particular process to the computing unit to which it belongs;
    将所述特定进程以外的所述待配置进程随机配置到各所述计算单元上。The to-be-configured processes other than the specific process are randomly configured to each of the computing units.
  4. 如权利要求1所述的分布式系统的资源配置方法,其中,所述根据所述等效量化关系计算各所述初步配置方案中各所述计算单元的拟占用资源的方式包括:The method for configuring a resource of a distributed system according to claim 1, wherein the manner of calculating the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios according to the equivalent quantization relationship comprises:
    根据所述等效量化关系计算各所述待配置进程运行时所需要占用的标准资源;Calculating, according to the equivalent quantization relationship, standard resources that are required to be occupied when each of the to-be-configured processes is running;
    计算各所述初步配置方案中各所述计算单元被所述待配置进程占用的标准资源;Calculating, by each of the preliminary configuration schemes, a standard resource occupied by each of the computing units by the to-be-configured process;
    或者,or,
    计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的实际资源;Calculating actual resources occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes;
    根据所述等效量化关系计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的标准资源。Calculating, according to the equivalent quantization relationship, standard resources occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes.
  5. 如权利要求1-4任一项所述的分布式系统的资源配置方法,其中,所述根据计算结果选择各所述计算单元的所述拟占用资源满足预设条件的初步配置方案作为目的配置方案包括:The resource configuration method of the distributed system according to any one of claims 1 to 4, wherein the preliminary configuration scheme in which the pseudo-occupied resources of each of the computing units meet a preset condition is selected as a destination configuration according to a calculation result. The plan includes:
    选择各所述计算单元的所述拟占用资源最平均的初步配置方案作为所述目的配置方案。The preliminary configuration scheme of the most averaging resources of each of the computing units is selected as the destination configuration scheme.
  6. 如权利要求5所述的分布式系统的资源配置方法,其中,所述选择各所述计算单元的所述拟占用资源最平均的初步配置方案作为所述目的配置方案包括: The method for configuring a resource of a distributed system according to claim 5, wherein the preliminary configuration scheme of selecting the most-occupied resource of each of the computing units as the destination configuration scheme comprises:
    计算各所述初步配置方案中各所述计算单元的所述拟占用资源的方差;Calculating a variance of the planned occupied resources of each of the computing units in each of the preliminary configuration scenarios;
    选择方差值最小的所述初步配置方案作为所述目的配置方案;Selecting the preliminary configuration scheme with the smallest variance value as the destination configuration scheme;
    或者,or,
    计算各所述初步配置方案中各所述计算单元的所述拟占用资源之间的两两差值;Calculating a difference between the two occupied resources of each of the computing units in each of the preliminary configuration schemes;
    选择所述初步配置方案中拟占用资源间的最大差值作为表征值来表征所述初步配置方案;Selecting a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme;
    选择所述表征值最小的所述初步配置方案作为所述目的配置方案。The preliminary configuration scheme in which the characterization value is the smallest is selected as the destination configuration scheme.
  7. 一种分布式系统的资源配置装置,包括:A resource configuration device for a distributed system, comprising:
    关系获取模块,设置为获取各资源的等效量化关系,所述等效量化关系为将各所述资源量化为标准资源的转换关系;The relationship obtaining module is configured to obtain an equivalent quantization relationship of each resource, where the equivalent quantization relationship is a conversion relationship that quantizes each of the resources into a standard resource;
    初步确定模块,设置为获取当前各待配置进程在各计算单元上的初步配置方案;Initially determining a module, configured to obtain a preliminary configuration scheme of each current configuration process on each computing unit;
    占用计算模块,设置为根据所述等效量化关系计算各所述初步配置方案中各所述计算单元的拟占用资源,所述拟占用资源为所述计算单元被拟派到其上的所述待配置进程所占用的标准资源;An occupancy calculation module, configured to calculate, according to the equivalent quantization relationship, a planned occupied resource of each of the computing units in each of the preliminary configuration scenarios, where the planned occupied resource is the one to which the computing unit is to be dispatched Standard resources occupied by the process to be configured;
    方案选择模块,设置为根据计算结果选择各所述计算单元的所述拟占用资源满足预设条件的初步配置方案作为目的配置方案。The solution selection module is configured to select, according to the calculation result, a preliminary configuration scheme that the planned occupied resource of each of the computing units meets a preset condition as a destination configuration scheme.
  8. 如权利要求7所述的分布式系统的资源配置装置,其中,所述占用计算模块包括以下至少一种:The resource configuration apparatus of a distributed system according to claim 7, wherein the occupancy calculation module comprises at least one of the following:
    第一计算模块,设置为根据所述等效量化关系计算各所述待配置进程运行时所需要占用的标准资源;a first calculation module, configured to calculate, according to the equivalent quantization relationship, a standard resource that is required to be used when each of the to-be-configured processes is running;
    第二计算模块,设置为计算各所述初步配置方案中各所述计算单元被所述待配置进程占用的标准资源;a second calculating module, configured to calculate a standard resource occupied by each of the computing units in each of the preliminary configuration schemes by the to-be-configured process;
    或者,or,
    第三计算模块,设置为计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的实际资源;a third calculating module, configured to calculate an actual resource occupied by each of the computing units in each of the preliminary configuration schemes by each of the to-be-configured processes;
    第四计算模块,设置为根据所述等效量化关系计算各所述初步配置方案中各所述计算单元被各所述待配置进程占用的标准资源。And a fourth calculating module, configured to calculate, according to the equivalent quantization relationship, a standard resource occupied by each of the computing units in each of the preliminary configuration scenarios by each of the to-be-configured processes.
  9. 如权利要求7或8所述的分布式系统的资源配置装置,其中,所述方案选择模块包括:The resource configuration apparatus of the distributed system according to claim 7 or 8, wherein the scheme selection module comprises:
    均匀选择模块,设置为选择各所述计算单元的所述拟占用资源最平均的初步配置方案作为所述目的配置方案。The uniform selection module is configured to select a preliminary configuration scheme of the most averaging resources of each of the computing units as the destination configuration scheme.
  10. 如权利要求9所述的分布式系统的资源配置装置,其中,所述均匀选择模块包括:The resource configuration apparatus of a distributed system according to claim 9, wherein the uniform selection module comprises:
    第五计算模块,设置为计算各所述初步配置方案中各所述计算单元的所述拟占 用资源的方差;a fifth calculating module, configured to calculate the proposed occupancy of each of the computing units in each of the preliminary configuration scenarios The variance of the resources used;
    方差选择模块,设置为选择方差值最小的所述初步配置方案作为所述目的配置方案;a variance selection module, configured to select the preliminary configuration scheme with the smallest variance value as the destination configuration scheme;
    或者,or,
    第六计算模块,设置为计算各所述初步配置方案中各所述计算单元的所述拟占用资源之间的两两差值;a sixth calculation module, configured to calculate a difference between the two occupied resources of each of the computing units in each of the preliminary configuration scenarios;
    表征选择模块,设置为选择所述初步配置方案中拟占用资源间的最大差值作为表征值来表征所述初步配置方案;Characterizing a selection module, configured to select a maximum difference between the resources to be occupied in the preliminary configuration scheme as a characterization value to characterize the preliminary configuration scheme;
    最值选择模块,设置为选择所述表征值最小的所述初步配置方案作为所述目的配置方案。The most value selection module is configured to select the preliminary configuration scheme in which the representation value is the smallest as the destination configuration scheme.
  11. 一种计算机存储介质,所述计算机存储介质存储有执行指令,所述执行指令用于执行权利要求1至6中任一项所述的方法。 A computer storage medium storing execution instructions for performing the method of any one of claims 1 to 6.
PCT/CN2017/076347 2016-05-23 2017-03-10 Resource allocation method and apparatus for distributed system WO2017202108A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610345039.6A CN107423129A (en) 2016-05-23 2016-05-23 The resource allocation method and device of a kind of distributed system
CN201610345039.6 2016-05-23

Publications (1)

Publication Number Publication Date
WO2017202108A1 true WO2017202108A1 (en) 2017-11-30

Family

ID=60411078

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076347 WO2017202108A1 (en) 2016-05-23 2017-03-10 Resource allocation method and apparatus for distributed system

Country Status (2)

Country Link
CN (1) CN107423129A (en)
WO (1) WO2017202108A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130124726A1 (en) * 2009-01-22 2013-05-16 International Business Machines Corporation Dynamic resource adjustment for a distributed process on a multi-node computer system
CN104580338A (en) * 2013-10-29 2015-04-29 华为技术有限公司 Service processing method, system and equipment
CN104778079A (en) * 2014-01-10 2015-07-15 国际商业机器公司 Method and device used for dispatching and execution and distributed system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130124726A1 (en) * 2009-01-22 2013-05-16 International Business Machines Corporation Dynamic resource adjustment for a distributed process on a multi-node computer system
CN104580338A (en) * 2013-10-29 2015-04-29 华为技术有限公司 Service processing method, system and equipment
CN104778079A (en) * 2014-01-10 2015-07-15 国际商业机器公司 Method and device used for dispatching and execution and distributed system

Also Published As

Publication number Publication date
CN107423129A (en) 2017-12-01

Similar Documents

Publication Publication Date Title
CN110086650B (en) Cloud resource online scheduling method and device for distributed machine learning task
US20180198855A1 (en) Method and apparatus for scheduling calculation tasks among clusters
US8032846B1 (en) Efficient provisioning of resources in public infrastructure for electronic design automation (EDA) tasks
TWI547817B (en) Method, system and apparatus of planning resources for cluster computing architecture
US10783002B1 (en) Cost determination of a service call
CN104239123B (en) Virtual Machine Manager dispatching method and system towards campus cloud platform
WO2016165392A1 (en) Genetic algorithm-based cloud computing resource scheduling method
WO2018176385A1 (en) System and method for network slicing for service-oriented networks
US20130346614A1 (en) Workload adaptive cloud computing resource allocation
CN104123189A (en) Web multilayer application dynamic resource adjustment method based on IaaS layer application perception
WO2017166643A1 (en) Method and device for quantifying task resources
CN103401939A (en) Load balancing method adopting mixing scheduling strategy
CN105657449B (en) A kind of video code conversion distribution method, device and video code conversion system
US20150271023A1 (en) Cloud estimator tool
WO2016172848A1 (en) Method and device for adjusting virtual resources in cloud computing
CN103699443A (en) Task distributing method and scanner
CN104331332A (en) Virtual resource pre-allocation algorithm based on SLA
CN108132840A (en) Resource regulating method and device in a kind of distributed system
CN116684420A (en) Cluster resource scheduling method, device, cluster system and readable storage medium
JP2015011365A (en) Provisioning apparatus, system, provisioning method, and provisioning program
CN104598311A (en) Method and device for real-time operation fair scheduling for Hadoop
CN105786626B (en) The Storm platform thread distribution method divided based on K
CN107872405A (en) Distributed bandwidth allocation and regulation
CN113205128A (en) Distributed deep learning performance guarantee method based on serverless computing
WO2017202108A1 (en) Resource allocation method and apparatus for distributed system

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17801958

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17801958

Country of ref document: EP

Kind code of ref document: A1