Scheduling user requests in a distributed resource system having plurality of schedulers and coordinators
10127079 ยท 2018-11-13
Assignee
Inventors
Cpc classification
G06F3/0659
PHYSICS
G06F9/4881
PHYSICS
International classification
Abstract
According to a method for scheduling a user request in a distributed resource system, an apparatus, and a system that are provided by embodiments of the present invention, in a T.sub.n+1 period, an S.sub.d acquires, from a coordinator G.sub.k of a user z, a resource C.sub.z(T.sub.n) that is consumed by a user z request in a T.sub.n period, and the S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), a P.sup.i.sub.z,d by using a scheduling algorithm. The user z request can be scheduled without depending on a user agent. In addition, the S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), the P.sup.i.sub.z,d by using the scheduling algorithm, thereby implementing global scheduling on the user z request and ensuring a performance requirement of the user z.
Claims
1. A resource scheduling method in a distributed resource system, wherein the distributed resource system comprises multiple schedulers; a first scheduler in the multiple schedulers acquiring, from a coordinator of a first user, a sum of resources that are consumed in the multiple schedulers by a previous user request of the first user in a previous period; and the first scheduler scheduling a present user request of the first user in a present period according to a resource weight of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period, a resource that is consumed in the first scheduler by the previous user request of the first user in the previous period, and a quantity of previous user requests of the first user received by the first scheduler in the previous period; the first scheduler computing, according to the resource weight of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period, the resource that is consumed in the first scheduler by the previous user request of the first user in the previous period, and the quantity of the previous user requests of the first user received by the first scheduler in the previous period; the first scheduler computing a virtual start time and a virtual finish time of the present user request of the first user in the present period; and the first scheduler adding the present user request of the first user in the present period to a scheduling queue, wherein the scheduling queue ranks the present user request of the first user in the present period according to a value of the virtual start time of the present user request in the present period.
2. A first scheduler in a distributed resource system comprising multiple schedulers, the first scheduler comprising a central processing unit and a memory, wherein the central processing unit (CPU) executes an executable instruction in the memory to perform the following steps: acquiring, from a coordinator of a first user, a sum of resources that are consumed in the multiple schedulers by a previous user request of the first user in a previous period; and scheduling a present user request of the first user in a present period according to a resource weight of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period, a resource that is consumed in the first scheduler by the previous user request of the first user in the previous period, and a quantity of previous user requests of the first user received by the first scheduler in the previous period; computing, according to the resource weight of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period, the resource that is consumed in the first scheduler by the previous user request of the first user in the previous period, and the quantity of the previous user requests of the first user received by the first scheduler in the previous period; computing a virtual start time and a virtual finish time of the present user request of the first user in the present period; and adding the present user request of the first user in the present period to a scheduling queue; wherein the scheduling queue ranks the present user request of the first user in the present period according to a value of the virtual start time of the present user request in the present period.
3. A distributed resource system, wherein the distributed resource system comprises multiple schedulers, a coordinator, comprising a central processing unit and a memory, for a first user is configured to provide to a first scheduler in the multiple schedulers, a sum of resources that are consumed in the multiple schedulers by a previous user request of the first user in a previous period; the first scheduler comprising a central processing unit and a memory is configured to: acquire, from the coordinator of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period; and schedule a present user request of the first user in a present period according to a resource weight of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period, a resource that is consumed in the first scheduler by the previous user request of the first user in the previous period, and a quantity of previous user requests of the first user received by the first scheduler in the previous period; compute, according to the resource weight of the first user, the sum of resources that are consumed in the multiple schedulers by the previous user request of the first user in the previous period, the resource that is consumed in the first scheduler by the previous user request of the first user in the previous period, and the quantity of the previous user requests of the first user received by the first scheduler in the previous period; compute a virtual start time and a virtual finish time of the present user request of the first user in the present period; and add the present user request of the first user in the present period to a scheduling queue, wherein the scheduling queue ranks the present user request of the first user in the present period according to a value of the virtual start time of the present user request in the present period.
Description
BRIEF DESCRIPTION OF DRAWINGS
(1) To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments.
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
DESCRIPTION OF EMBODIMENTS
(15) The following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention.
(16) As shown in
(17) This embodiment of the present invention is described by using an example in which a resource is an IOPS capability, the resource-providing entity A is a storage array A, and the resource-providing entity B is a storage array B.
(18) Before this embodiment of the present invention is further described, it should be noted that, a relationship among the scheduler A, the coordinator A, and the resource-providing entity A shown in
(19) In the distributed resource system shown in
(20) There is a resource competition relationship between the user A and the user B. To ensure performance for the users, a resource weight is generally allocated to each user in the distributed resource system. The user A and the user B are used as an example in this embodiment of the present invention, where a resource weight .sub.A of the user A is 2, and a resource weight .sub.B of the user B is 1. Then a ratio of the resource weight of the user A to the resource weight of the user B is 2:1. The resource weights of the user A and the user B are configured in both the scheduler A and the scheduler B. Specifically, the resource weight of the user A may be delivered by the user A to each of the scheduler A and the scheduler B, and the resource weight of the user B is delivered by the user B to each of the scheduler A and the scheduler B; the scheduler A and the scheduler B perform the foregoing configuration. A form of a resource weight is not limited to the form described in this embodiment of the present invention, and may also be that the resource weight .sub.A of the user A is , and the resource weight .sub.B of the user B is .
(21) The scheduler A receives the user A request sent by the user A, and the scheduler A receives the user B request sent by the user B. The storage array A needs to provide the IOPS capability for both the user A request and the user B request, or in other words, both the user A request and the user B request consume the IOPS capability provided by the storage array A. Likewise, the scheduler B receives the user A request sent by the user A, and the scheduler B receives the user B request sent by the user B. When the IOPS capability of the storage array A can meet the user A request and the user B request, the scheduler A does not need to schedule the received user A request and the received user B request according to a scheduling algorithm; when the IOPS capability of the storage array B can meet the user A request and the user B request, the scheduler B does not need to schedule the received user A request and the received user B request according to a scheduling algorithm. The scheduler A only needs to compute virtual start times and virtual finish times of the received user requests according to a scheduling algorithm. Likewise, the scheduler B also only needs to compute virtual start times and virtual finish times of the received user requests according to a scheduling algorithm. For meanings of a virtual start time and a virtual finish time, refer to a Start-time Fairness Queuing (SFQ) algorithm. When the user requests need to be scheduled, the scheduler A needs to add, according to a scheduling algorithm, the received user A request and the received user B request to a scheduling queue of the scheduler A for scheduling; the scheduler B also needs to add, according to the scheduling algorithm, the received user A request and the received user B request to a scheduling queue of the scheduler B for scheduling.
(22) As shown in
(23) The scheduler A acquires, in the T.sub.n period and according to a resource that is provided by the resource-providing entity A and consumed by each received user A request, the resource C.sub.A,A(T.sub.n) that is provided by the resource-providing entity A and consumed by the N.sub.A,A(T.sub.n) user A requests processed by the scheduler A in the T.sub.n period; and the scheduler A acquires, in the T.sub.n period and according to a resource that is provided by the resource-providing entity A and consumed by each received user B request, the resource C.sub.B,A(T.sub.n) that is provided by the resource-providing entity A and consumed by the N.sub.B,A(T.sub.n) user B requests processed by the scheduler A in the T.sub.n period. Likewise, the scheduler B acquires, in the T.sub.n period and according to a resource that is provided by the resource-providing entity B and consumed by each received user A request, the resource C.sub.A,B(T.sub.n) that is provided by the resource-providing entity B and consumed by the N.sub.A,B (T.sub.n) user A requests processed by the scheduler B in the T.sub.n period; and the scheduler B acquires, in the T.sub.n period and according to a resource that is provided by the resource-providing entity B and consumed by each received user B request, the resource C.sub.B,B(T.sub.n) that is provided by the resource-providing entity B and consumed by the N.sub.B,B(T.sub.n) user B requests processed by the scheduler B in the T.sub.n period. Resources consumed by the user A requests processed in the T.sub.n period are C.sub.A(T.sub.n)=C.sub.A,A(T.sub.n)+C.sub.A,B(T.sub.n), and resources consumed by the user B requests processed in the T.sub.n period are C.sub.B(T.sub.n)=C.sub.B,A(T.sub.n)+C.sub.B,B(T.sub.n).
(24) Specifically, the coordinator A acquires C.sub.A,A(T.sub.n) and C.sub.A,B(T.sub.n). An implementation manner is that the scheduler A proactively sends the C.sub.A,A(T.sub.n) to the coordinator A, and the scheduler B proactively sends the C.sub.A,B(T.sub.n) to the coordinator A. Another implementation manner is that the coordinator A requests to acquire the C.sub.A,A(T.sub.n) from the scheduler A, and the coordinator A requests to acquire the C.sub.A,B(T.sub.n) from the scheduler B. Specifically, the coordinator A may acquire the C.sub.A,A(T.sub.n) and the C.sub.A,B(T.sub.n) at one time, or the coordinator A may communicate with the scheduler A and the scheduler B in real time, to acquire, in real time, the resource that is provided by the resource-providing entity A and consumed by each user A request received by the scheduler A, and acquire, in real time, the resource that is provided by the resource-providing entity B and consumed by each user A request received by the scheduler B. For a manner in which the coordinator B acquires the resources C.sub.B(T.sub.n) consumed for processing the user B requests, refer to the manner of the coordinator A, and details are not described herein again.
(25) The scheduler A acquires, from the home coordinator A of the user A, the resource C.sub.A(T.sub.n) consumed by the user A requests in the T.sub.n period, and acquires, from the home coordinator B of the user B, the resource C.sub.B(T.sub.n) consumed by the user B requests in the T.sub.n period. In an implementation manner, in a T.sub.n+1 period, the coordinator A sends the C.sub.A (T.sub.n) to each of the scheduler A and the scheduler B, and the coordinator B sends the C.sub.B(T.sub.n) to each of the scheduler A and the scheduler B. In another implementation manner, in a T.sub.n+1 period, the scheduler A requests the C.sub.A (T.sub.n) from the coordinator A, the scheduler A requests the C.sub.B(T.sub.n) from the coordinator B; and the scheduler B requests the C.sub.A(T.sub.n) from the coordinator A, the scheduler B requests the C.sub.B(T.sub.n) from the coordinator B. The foregoing two manners are both described as: in a T.sub.n+1 period, the scheduler A acquires, from the home coordinator A of the user A, the resources C.sub.A(T.sub.n) consumed by the user A requests in the T.sub.n period, and acquires, from the home coordinator B of the user B, the resources C.sub.B(T.sub.n) consumed by the user B requests in the T.sub.n period. It can be known from the foregoing description that, in either of the foregoing implementation manners, the scheduler A stores the N.sub.A,A(T.sub.n), N.sub.B,A(T.sub.n), C.sub.A,A(T.sub.n), and C.sub.B,A(T.sub.n); and the scheduler B stores the N.sub.A,B(T.sub.n), N.sub.B,B(T.sub.n), C.sub.A,B(T.sub.n), and C.sub.B,B(T.sub.n).
(26) As for determining of a home coordinator of a user, a manner may be that a coordinator is configured as a home coordinator of a user; or when an identifier of a user is an integer, a modulo operation is performed on a total quantity of coordinators according to the identifier of the user, to determine a home coordinator of the user; or a hash function may be used to perform computation on an identifier of a user to obtain a hash value, and then a modulo operation is performed on a total quantity of coordinators by using the hash value, to determine a home coordinator of the user. For example, there are 100 users and 20 coordinators, and identifiers of the users are from 1 to 100, the 20 coordinators are numbered from 1 to 20, and a modulo operation is performed on a total quantity of the coordinators according to the identifiers of the users, to determine a home coordinator of each user. The present invention sets no limitation thereto. A total quantity of coordinators may be less than or equal to a quantity of schedulers, and each coordinator can communicate with any scheduler.
(27) Step 402. The scheduler A schedules, according to .sub.A, C.sub.A(T.sub.n), C.sub.A,A(T.sub.n), and N.sub.A,A(T.sub.n), the received user A request by using a scheduling algorithm; and the scheduler A schedules, according to .sub.B, C.sub.B(T.sub.n), C.sub.B,A(T.sub.n), and N.sub.B,A(T.sub.n), the received user B request by using the scheduling algorithm.
(28) Likewise, the scheduler B schedules, according to .sub.A, C.sub.A(T.sub.n), C.sub.A,B(T.sub.n), and N.sub.A,B(T.sub.n), a received user A request by using a scheduling algorithm; and the scheduler B schedules, according to .sub.B, C.sub.B(T.sub.n), C.sub.B,B(T.sub.n), and N.sub.B,B(T.sub.n), a received user B request by using the scheduling algorithm.
(29) When a user request in a scheduler is scheduled according to the method shown in
(30) When the scheduler A schedules the user B request, or the scheduler B schedules the user A request, or the scheduler B schedules the user B request, the same foregoing effect can also be achieved. In a user agent-based architecture in the prior art, a scheduler can acquire only a user request and statistics of the user request that are sent by one user agent; therefore, it is difficult to implement global scheduling on a same user request.
(31) In this embodiment of the present invention, that a scheduler A schedules a user A request is used as an example. During global scheduling on the user A request, the scheduler A needs to consider C.sub.A(T.sub.n) in addition to .sub.A, C.sub.A,A(T.sub.n), and N.sub.A,A(T.sub.n) in a previous period, thereby implementing scheduling of the user A request and further ensuring performance for a user A.
(32) Specifically, in this embodiment of the present invention, P.sup.i.sub.A,A indicates the i.sup.th user A request that is sent by the user A and received by the scheduler A, where a storage array A provides a resource for the P.sup.i.sub.A,A; and P.sup.i.sub.A,B indicates the i.sup.th user A request that is sent by the user A and received by a scheduler B, where a storage array B provides a resource for the P.sup.i.sub.A,B. P.sup.k.sub.B,A indicates the k.sup.th user B request that is sent by a user B and received by the scheduler A, where the storage array A provides a resource for the P.sup.k.sub.B,A; and P.sup.k.sub.B,B indicates the k.sup.th user B request that is sent by the user B and received by the scheduler B, where the storage array B provides a resource for the P.sup.k.sub.B,B. In this embodiment of the present invention, .sub.A=2, and .sub.B=1.
(33) In a T.sub.n period, when a quantity of user A requests and user B requests that are received by the scheduler A is less than an IOPS capability of the storage array A, there is no need to schedule, by using a scheduling algorithm, the user A requests and the user B requests that are received by the scheduler A, and the user A requests and the user B requests are directly processed by the storage array A. When a quantity of user A requests and user B requests that are received by the scheduler B is less than an IOPS capability of the storage array B, there is also no need to schedule, by using a scheduling algorithm, the user A requests and the user B requests that are received by the scheduler B, and the user A requests and the user B requests are directly processed by the storage array B. However, a home coordinator A of the user A needs to acquire resources that are consumed by user A requests received by schedulers in the T.sub.n period. In this embodiment of the present invention, the home coordinator A of the user A acquires a resource C.sub.A(T.sub.n) that is consumed by the user A requests that are received by the scheduler A and the scheduler B in the T.sub.n period. A home coordinator B of the user B also acquires a resource C.sub.B(T.sub.n) that is consumed by the user B requests that are received by the scheduler A and the scheduler B in the T.sub.n period. The coordinator A sends C.sub.A(T.sub.n) to the scheduler A and the scheduler B, and the coordinator B sends C.sub.B(T.sub.n) to the scheduler A and the scheduler B. When a quantity of the user A requests received by the scheduler A in the T.sub.n period is N.sub.A,A(T.sub.n), a consumed resource that is provided by the storage array A is C.sub.A,A(T.sub.n); when a quantity of the user B requests received by the scheduler A in the T.sub.n period is N.sub.B,A(T.sub.n) a consumed resource that is provided by the storage array A is C.sub.B,A(T.sub.n). When a quantity of the user A requests received by the scheduler B in the T.sub.n period is N.sub.A,B(T.sub.n), a consumed resource that is provided by the storage array B is C.sub.A,B(T.sub.n); when a quantity of the user B requests received by the scheduler B in the T.sub.n period is N.sub.B,B(T.sub.n), a consumed resource that is provided by the storage array A is C.sub.B,B(T.sub.n).
(34) The scheduler A is used as an example. In a T.sub.n+1 period, the scheduler A acquires, from the home coordinator A of the user A, a resource C.sub.A(T.sub.n) that is consumed by a user A request in the T.sub.n period. In the T.sub.n+1 period, when an IOPS capability of the storage array A cannot meet a user A request and a user B request, the scheduler A adds, by using a scheduling algorithm, the received user A request and the received user B request to a scheduling queue of the scheduler A for scheduling. When receiving the user A request and the user B request, the scheduler A computes a virtual start time and a virtual finish time of the user A request, and a virtual start time and a virtual finish time of the user B request. The user A request and the user B request are added to the scheduling queue, and the user A request and the user B request are ranked in the scheduling queue in ascending order of the virtual start times for processing. A user request whose virtual start time is the earliest is ranked at the queue head of the scheduling queue, and a user request whose virtual start time is the latest is ranked at the queue tail of the scheduling queue. The queue head of the scheduling queue refers to a position at which the storage array A performs user request processing first in the scheduling queue. When processing the user requests, the storage array A acquires a user request from the queue head of the scheduling queue for processing, that is, a user request whose virtual start time is the earliest is processed first. The storage array A processes the user requests in the scheduling queue in ascending order of the virtual start times of the user requests.
(35) In a first implementation manner, a virtual start time of a P.sup.i.sub.A,A that is received by the scheduler A is represented by S(P.sup.i.sub.A,A), and a virtual finish time of the P.sup.i.sub.A,A is represented by F(P.sup.i.sub.A,A). S(P.sup.i.sub.A,A)=max{v(P.sup.i.sub.A,A), F(P.sup.i1.sub.A,A)}, where v(P.sup.i.sub.A,A) indicates a virtual time of the scheduler A when the scheduler A receives the P.sup.i.sub.A,A, F(P.sup.i1.sub.A,A) indicates a virtual finish time of a P.sup.i1.sub.A,A, and max{v(P.sup.i.sub.A,A), F(P.sup.i1.sub.A,A)} indicates a maximum value in v(P.sup.i.sub.A,A) and F(P.sup.i1.sub.A,A).
(36)
For meanings of the virtual start time S(P.sup.i.sub.A,A), the virtual finish time F(P.sup.i.sub.A,A), and the virtual time v(P.sup.i.sub.A,A), refer to a Start-time Fairness Queuing (SFQ) algorithm, and details are not described in this embodiment of the present invention again. c(P.sup.i.sub.A,A) indicates a resource that is provided by the storage array A and consumed by the P.sup.i.sub.A,A, which is one IOPS in this embodiment of the present invention; and d(P.sub.A,A(T.sub.n+1)) indicates a value of a delay of each user A request that is received by the scheduler A in a T.sub.n+1 period, and
(37)
Likewise, a virtual start time of a P.sup.k.sub.B,A that is received by the scheduler A is represented by S(P.sup.k.sub.B,A), and a virtual finish time of the P.sup.k.sub.B,A is represented by F(P.sup.k.sub.B,A). S(P.sup.k.sub.B,A)=max{v(P.sup.k.sub.B,A), F(P.sup.k1.sub.B,A)}, where v(P.sup.k.sub.B,A) indicates a virtual time of the scheduler A when the scheduler A receives the P.sup.k.sub.B,A, F(P.sup.k1.sub.B,A) indicates a virtual finish time of a P.sup.k1.sub.B,A, and max{v(P.sup.k.sub.B,A), F(P.sup.k1.sub.B,A)} indicates a maximum value in v(P.sup.k.sub.B,A) and
(38)
where c(P.sup.k.sub.B,A) indicates a resource that is provided by the storage array B and consumed by the P.sup.k.sub.B,A, which is one IOPS in this embodiment of the present invention; and d(P.sub.B,A(T.sub.n+1)) indicates a value of a delay of each user B request that is received by the scheduler A in a T.sub.n+1 period, and
(39)
(40) A virtual start time of a P.sup.i.sub.A,B that is received by the scheduler B is represented by S(P.sup.i.sub.A,B), and a virtual finish time of the P.sup.i.sub.A,B is represented by F(P.sup.i.sub.A,B). S(P.sup.i.sub.A,B)=max{v(P.sup.i.sub.A,B), F(P.sup.i1.sub.A,B)}, where v(P.sup.i.sub.A,B) indicates a virtual time of the scheduler B when the scheduler B receives the P.sup.i.sub.A,B, F(P.sup.i1.sub.A,B) indicates a virtual finish time of a P.sup.i1.sub.A,B, and max{v(P.sup.i.sub.A,B), F(P.sup.i1.sub.A,B)} indicates a maximum value in v(P.sup.i.sub.A,B) and F(P.sup.i1.sub.A,B).
(41)
where c(P.sup.i.sub.A,B) indicates a resource that is provided by the storage array B and consumed by the P.sup.i.sub.A,B, which is one IOPS in this embodiment of the present invention; and d(P.sub.A,B(T.sub.n+1)) indicates a value of a delay of each user A request that is received by the scheduler B in a T.sub.n+1 period, and
(42)
Likewise, a virtual start time of a P.sup.k.sub.B,B that is received by the scheduler B is represented by S(P.sup.k.sub.B,B), and a virtual finish time of the P.sup.k.sub.B,B is represented by F(P.sup.k.sub.B,B). S(P.sup.k.sub.B,B)=max{v(P.sup.k.sub.B,B), F(P.sup.K1.sub.B,B)}, where v(P.sup.k.sub.B,B) indicates a virtual time of the scheduler B when the scheduler B receives the P.sup.i.sub.B,B, F(P.sup.k1.sub.B,B) indicates a virtual finish time of a P.sup.k1.sub.B,B, and max{v(P.sup.k.sub.B,B), F(P.sup.k1.sub.B,B)} indicates a maximum value in v(P.sup.k.sub.B,B) and F(P.sup.k1.sub.B,B).
(43)
where c(P.sup.k.sub.B,B) indicates a resource that is provided by the storage array B and consumed by the P.sup.k.sub.B,B, which is one IOPS in this embodiment of the present invention; and d(P.sub.B,B(T.sub.n+1)) indicates a value of a delay of each user B request that is received by the scheduler B in a T.sub.n+1 period, and
(44)
(45) In a second implementation manner, a virtual start time of a P.sup.i.sub.A,A that is received by the scheduler A is represented by S(P.sup.i.sub.A,A), and a virtual finish time of the P.sup.i.sub.A,A is represented by
(46)
where v(P.sup.i.sub.A,A) indicates a virtual time of the scheduler A when the scheduler A receives the P.sup.i.sub.A,A; d(P.sub.A,A(T.sub.n+1)) indicates a value of a delay of each user A request that is received by the scheduler A in a T.sub.n+1 period, and
(47)
F(P.sup.i1.sub.A,A) indicates a virtual finish time of a P.sup.i1.sub.A,A; and
(48)
indicates a maximum value in v(P.sup.i.sub.A,A) and
(49)
For meanings of the virtual start time S(P.sup.i.sub.A,A), the virtual finish time F(P.sup.i.sub.A,A) and the virtual time v(P.sup.i.sub.A,A), refer to a Start-time Fairness Queuing (SFQ) algorithm, and details are not described in this embodiment of the present invention again. c(P.sup.i.sub.A,A) indicates a resource that is provided by the storage array A and consumed by the P.sup.i.sub.A,A, which is one IOPS in this embodiment of the present invention. Likewise, a virtual start time of a P.sup.k.sub.B,A that is received by the scheduler A is represented by S(P.sup.k.sub.B,A), and a virtual finish time of the P.sup.k.sub.B,A is represented by F(P.sup.k.sub.B,A).
(50)
where v(P.sup.k.sub.B,A) indicates a virtual time of the scheduler A when the scheduler A receives the P.sup.k.sub.B,A; d(P.sub.B,A(T)) indicates a value of a delay of each user B request that is received by the scheduler A in a T.sub.n+1 period, and
(51)
F(P.sup.k1.sub.B,A) indicates a virtual finish time of a P.sup.k1.sub.B,A; and
(52)
indicates a maximum value in v(P.sup.k.sub.B,A) and
(53)
where c(P.sup.k.sub.B,A) indicates a resource that is provided by the storage array B and consumed by the P.sup.k.sub.B,A, which is one IOPS in this embodiment of the present invention.
(54) A virtual start time of a P.sup.i.sub.A,B that is received by the scheduler B is represented by S(P.sup.i.sub.A,B), and a virtual finish time of the P.sup.i.sub.A,B is represented by F(P.sup.i.sub.A,B).
(55)
where v(P.sup.i.sub.A,B) indicates a virtual time of the scheduler B when the scheduler B receives the P.sup.i.sub.A,B; d(P.sub.A,B(T.sub.n+1)) indicates a value of a delay of each user A request that is received by the scheduler B in a T.sub.n+1 period, and
(56)
F(P.sup.i1.sub.A,B) indicates a virtual finish time of a P.sup.i1.sub.A,B; and
(57)
indicates a maximum value in v(P.sup.i.sub.A,B) and
(58)
where c(P.sup.i.sub.A,B) indicates a resource that is provided by the storage array B and consumed by the P.sup.i.sub.A,B which is one IOPS in this embodiment of the present invention. Likewise, a virtual start time of a P.sup.k.sub.B,B that is received by the scheduler B is represented by S(P.sup.k.sub.B,B), and a virtual finish time of the P.sup.k.sub.B,B is represented by
(59)
where v(P.sup.k.sub.B,B) indicates a virtual time of the scheduler B when the scheduler B receives the P.sup.k.sub.B,B; d(P.sub.B,B(T.sub.n+1)) indicates a value of a delay of each user B request received by the scheduler A in a T.sub.n+1 period, and
(60)
indicates a virtual finish time of a P.sup.k1.sub.B,B; and
(61)
indicates a maximum value in v(P.sup.k.sub.B,B) and
(62)
where c(P.sup.k.sub.B,B) indicates a resource that is provided by the storage array B and consumed by the P.sup.k.sub.B,B which is one IOPS in this embodiment of the present invention.
(63) The first manner of computing a virtual start time and a virtual finish time of a user request is used as an example. As shown in
(64)
then d(P.sub.A,A(T.sub.n+1))=0, and F(P.sup.1.sub.A,A)=S(P.sup.1.sub.A,A)+=0.5. Likewise, a virtual start time of the P.sup.2.sub.A,A is 0.5, and a virtual finish time of the P.sup.2.sub.A,A is 1; a virtual start time of the P.sup.3.sub.A,A is 1, and a virtual finish time of the P.sup.3.sub.A,A is 1.5; a virtual start time of the P.sup.4.sub.A,A is 1.5, and a virtual finish time of the P.sup.4.sub.A,A is 2; and a virtual start time of the P.sup.5.sub.A,A is 2, and a virtual finish time of the P.sup.5.sub.A,A is 2.5.
(65)
in
(66)
and details are not described herein again.
(67) For the user B request P.sup.1.sub.B,A that is received by the scheduler A, a virtual start time of the P.sup.1.sub.B,A is computed: S(P.sup.1.sub.B,A)=max{v(P.sup.1.sub.B,A), F(P.sup.0.sub.B,A)}. Because the T.sub.n+1 period is actually the first period, that is, the scheduler A does not receive any P.sup.k.sub.B,A previously, F(P.sup.0.sub.B,A) is empty, the P.sup.1.sub.B,A is received after initialization of the scheduler A is completed, and v(P.sup.1.sub.B,A)=0. A virtual finish time of the P.sup.1.sub.B,A is
(68)
where
(69)
C.sub.B,B(T.sub.n)=0, and N.sub.B,A(T.sub.n)=0; then d(P.sub.B,A(T.sub.n+1))=0, .sub.B=1, and F(P.sup.1.sub.B,A)=1. Likewise, a virtual start time of the P.sup.2.sub.B,A is 1, and a virtual finish time of the P.sup.2.sub.B,A is 2; a virtual start time of the P.sup.3.sub.B,A is 2, and a virtual finish time of the P.sup.3.sub.B,A is 3; and a virtual start time of the P.sup.4.sub.B,A is 3, and a virtual finish time of the P.sup.4.sub.B,A is 4.
(70) In this case, for the user B request P.sup.1.sub.B,B that is received by the scheduler B, the received P.sup.1.sub.B,B needs to be scheduled, and a virtual start time of the P.sup.1.sub.B,B is computed: S(P.sup.1.sub.B,B)=max{v(P.sup.1.sub.B,B), F(P.sup.0.sub.B,B)}. Because the T.sub.n+1 period is actually the first period, that is, the scheduler B does not receive any P.sup.k.sub.B,B previously, F(P.sup.0.sub.B,B) is empty, the P.sup.1.sub.B,B is received after initialization of the scheduler B is completed, and v(P.sup.1.sub.B,B)=0. A virtual finish time of the P.sup.1.sub.B,B is
(71)
where
(72)
C.sub.B,A(T.sub.n)=0, and N.sub.B,B(T.sub.n)=0; then d(P.sub.B,B(T.sub.n+1))=0, .sub.B=1, and F(P.sup.1.sub.B,B)=1. Likewise, a virtual start time of the P.sup.2.sub.B,B is 1, and a virtual finish time of the P.sup.2.sub.B,B is 2; a virtual start time of the P.sup.3.sub.B,B is 2, and a virtual finish time of the P.sup.3.sub.B,B is 3; a virtual start time of the P.sup.4.sub.B,B is 3, and a virtual finish time of the P.sup.4.sub.B,B is 4; and a virtual start time of the P.sup.5.sub.B,B is 4, and a virtual finish time of the P.sup.5.sub.B,B is 5.
(73) The scheduler A computes virtual start times and virtual finish times of the P.sup.1.sub.A,A, P.sup.2.sub.A,A, P.sup.3.sub.A,A, P.sup.4.sub.A,A, and P.sup.5.sub.A,A, and computes virtual start times and virtual finish times of the P.sup.1.sub.B,A, P.sup.2.sub.B,A, P.sup.3.sub.B,A, and P.sup.4.sub.B,A. According to the virtual start times of the user requests that are received by the scheduler A, the user requests are ranked in a scheduling queue in ascending order of the virtual start times for processing, that is, an order from the queue head to the queue tail in the scheduling queue is P.sup.1.sub.A,A, P.sup.2.sub.A,A, P.sup.1.sub.B,A, P.sup.3.sub.A,A, P.sup.4.sub.A,A, P.sup.2.sub.B,A, P.sup.5.sub.A,A, P.sup.3.sub.B,A, and P.sup.4.sub.B,A, as shown in
(74) The scheduler B computes virtual start times and virtual finish times of the P.sup.1.sub.B,B, P.sup.2.sub.B,B, P.sup.3.sub.B,B, P.sup.4.sub.B,B, and P.sup.5.sub.B,B respectively. According to the virtual start times of all the user requests that are received by the scheduler B, the user requests are ranked in a scheduling queue in ascending order of the virtual start times for processing, that is, an order from the queue head to the queue tail in the scheduling queue is P.sup.1.sub.B,B, P.sup.2.sub.B,B, P.sup.3.sub.B,B, P.sup.4.sub.B,B, and P.sup.5.sub.B,B, as shown in
(75) A person skilled in the art should understand that, in specific implementation, a quantity of user requests that are received by the scheduler A and the scheduler B in a T.sub.n+1 period may be much greater than the quantity of the user requests provided in the embodiment. A quantity of users is not limited to two. For ease of description in this embodiment of the present invention, in the T.sub.n+1 period, the user A requests that are received by the scheduler A are P.sup.1.sub.A,A, P.sup.2.sub.A,A, P.sup.3.sub.A,A, P.sup.4.sub.A,A, and P.sup.5.sub.A,A, and the user B requests that are received by the scheduler A are P.sup.1.sub.B,A, P.sup.2.sub.B,A, P.sup.3.sub.B,A, and P.sup.4.sub.B,A; and the user B requests that are received by the scheduler B are P.sup.1.sub.B,B, P.sup.2.sub.B,B, P.sup.3.sub.B,B, P.sup.4.sub.B,B, and P.sup.5.sub.B,B.
(76) According to the manner described above, the scheduler A computes a resource C.sub.A,A(T.sub.n+1) that is provided by the storage array A and consumed by N.sub.A,A(T.sub.n+1) user A requests received in the T.sub.n+1 period, and a resource C.sub.B,A(T.sub.n) that is provided by the storage array A and consumed by N.sub.B,A(T.sub.n) received user B requests. The scheduler A computes a resource C.sub.A,A(T.sub.n+1) that is provided by the storage array A and consumed by N.sub.A,A(T.sub.n+1) user A requests received in the T.sub.n+1 period, which is specifically that: in this embodiment of the present invention, one user A request consumes one IOPS, and a quantity of the user A requests received by the scheduler A in the T.sub.n+1 period is N.sub.A,A(T.sub.n+1)=5, and the consumed resource C.sub.A,A(T.sub.n+1) that is provided by the storage array A is five IOPSs. Likewise, a quantity of the user B requests that are received by the scheduler A in the T.sub.n+1 period is N.sub.B,A(T.sub.n+1)=4, and the consumed resource C.sub.B,A(T.sub.n+1) that is provided by the storage array A is four IOPSs. A quantity of the user A requests that are received by the scheduler B in the T.sub.n+1 period is N.sub.A,B(T.sub.n+1)=0, and the consumed resource C.sub.A,B(T.sub.n+1) that is provided by the storage array B is 0 IOPS. Likewise, a quantity of the user B requests that are received by the scheduler B in the T.sub.n+1 period is N.sub.B,B(T.sub.n+1)=5, and the consumed resource C.sub.B,B(T.sub.n+1) that is provided by the storage array B is five IOPSs. The coordinator A acquires that the resource C.sub.A,A(T.sub.n+1) that is provided by the storage array A and consumed by the user A requests processed by the scheduler A in the T.sub.n+1 period is five IOPSs, and the resource that is provided by the storage array B and consumed by the user A requests processed by the scheduler B in the T.sub.n+1 period is zero IOPS. Therefore, a total quantity of resources that are consumed by the user A requests in the T.sub.n+1 period is C.sub.A(T.sub.n+1)=C.sub.A,A(T.sub.n+1)+C.sub.A,B(T.sub.n+1), where C.sub.A(T.sub.n+1)=5 IOPSs. Likewise, the coordinator B acquires that a total quantity of the resources that are consumed by the user B requests in the T.sub.n+1 period is C.sub.B(T.sub.n+1)=C.sub.B,A(T.sub.n+1)+C.sub.B,B(T.sub.n+1), where C.sub.B(T.sub.n+1)=9 IOPSs. The coordinator A sends a message to each of the scheduler A and the scheduler B, where the message carries C.sub.A(T.sub.n+1), so that the scheduler A and the scheduler B acquire, from the coordinator A, that the quantity of IOPSs that are consumed by the user A requests in the T.sub.n+1 period is 5. Likewise, the coordinator B sends a message to each of the scheduler A and the scheduler B, where the message carries C.sub.B(T.sub.n+1), so that the scheduler A and the scheduler B acquire, from the coordinator B, that the quantity of IOPSs that are consumed by the user B requests in the T.sub.n+1 period is 9.
(77) As shown in
(78)
where
(79)
and C.sub.A,B(T.sub.n+1)=0 and N.sub.A,A(T.sub.n+1)=5 in the T.sub.n+1 period; then d(P.sub.A,A(T.sub.n+2))=0; c(P.sup.6.sub.A,A)=1, .sub.A=2, and therefore, F(P.sup.6.sub.A,A)=3. Likewise, a virtual start time of a P.sup.7.sub.A,A is 3, and a virtual finish time of the P.sup.7.sub.A,A is 3.5; a virtual start time of a P.sup.8.sub.A,A is 3.5, and a virtual finish time of the P.sup.8.sub.A,A is 4; and a virtual start time of a P.sup.9.sub.A,A is 4, and a virtual finish time of the P.sup.9.sub.A,A is 4.5.
(80) In the T.sub.n+2 period, the scheduler A receives the first user B request P.sup.5.sub.B,A, where S(P.sup.5.sub.B,A)=max{v(P.sup.5.sub.B,A), F(P.sup.4.sub.B,A)}, v(P.sup.5.sub.B,A)=F(P.sup.4.sub.B,A)=4, and therefore, S(P.sup.5.sub.B,A)=4. A virtual finish time of the P.sup.5.sub.B,A is
(81)
where c(P.sup.5.sub.B,A)=1,
(82)
C.sub.B,B(T.sub.n+1)=5, N.sub.B,A(T.sub.n+1)=4, d(P.sub.B,A(T.sub.n+2))=1.25, .sub.B=1, and therefore, F(P.sup.5.sub.B,A)=6.25. Likewise, a virtual start time of a P.sup.6.sub.B,A is 6.25, and a virtual finish time of the P.sup.6.sub.B,A is 8.5; a virtual start time of a P.sup.7.sub.B,A is 8.5, and a virtual finish time of the P.sup.7.sub.B,A is 10.75; and a virtual start time of a P.sup.8.sub.B,A is 10.75, and a virtual finish time of the P.sup.8.sub.B,A is 13.
(83) The scheduler A computes virtual start times and virtual finish times of the P.sup.6.sub.A,A, P.sup.7.sub.A,A, P.sup.8.sub.A,A, and P.sup.9.sub.A,A, and the scheduler A computes virtual start times and virtual finish times of the P.sup.5.sub.B,A, P.sup.6.sub.B,A, P.sup.7.sub.B,A, and P.sup.8.sub.B,A. According to the virtual start times of the user requests that are received by the scheduler A, the user requests are ranked in a scheduling queue in ascending order of the virtual start times for processing, that is, an order from the queue head to the queue tail in the scheduling queue is P.sup.6.sub.A,A, P.sup.7.sub.A,A, P.sup.8.sub.A,A, P.sup.9.sub.A,A, P.sup.5.sub.B,A, P.sup.6.sub.B,A, P.sup.7.sub.B,A, and P.sup.8.sub.B,A, as shown in
(84) In the T.sub.n+2 period, the scheduler B receives the first user A request P.sup.1.sub.A,B and the first user B request P.sup.6.sub.B,B. It is assumed that the scheduler B receives the P.sup.1.sub.A,B and the P.sup.6.sub.B,B at a same moment. A virtual start time of the P.sup.6.sub.B,B is S(P.sup.6.sub.B,B)=max{v(P.sup.6.sub.B,B), F(P.sup.5.sub.B,B)}, where v(P.sup.6.sub.B,B)=F(P.sup.5.sub.B,B)=5, and therefore, S(P.sup.6.sub.B,B)=5. A virtual finish time of the P.sup.6.sub.B,B is
(85)
where
(86)
and .sub.B=1, and therefore, F(P.sup.6.sub.B,B)=6.8. Likewise, a virtual start time of a P.sup.7.sub.B,B is 6.8, and a virtual finish time of the P.sup.7.sub.B,B is 8.6; a virtual start time of a P.sup.8.sub.B,B is 8.6, and a virtual finish time of the P.sup.8.sub.B,B is 10.4. A virtual start time of the P.sup.1.sub.A,B is S(P.sup.1.sub.A,B)=max{v(P.sup.1.sub.A,B), F(P.sup.0.sub.A,B)}, where F(P.sup.0.sub.A,B)=0 and v(P.sup.1.sub.A,B)=v(P.sup.6.sub.B,B)=5, and therefore, S(P.sup.1.sub.A,B)=5. A virtual finish time of the P.sup.1.sub.A,B is
(87)
where c(P.sup.1.sub.A,B)=1,
(88)
C.sub.A,A(T.sub.n+1)=5, and N.sub.A,A(T.sub.n+1)=0; then d(P.sub.A,B(T.sub.n+2))=0, and .sub.A=2, and therefore, F(P.sup.1.sub.A,B)=5.5. Likewise, a virtual start time of a P.sup.2.sub.A,B is 5.5, and a virtual finish time of the P.sup.2.sub.A,B is 6; and a virtual start time of a P.sup.3.sub.A,B is 6, and a virtual finish time of the P.sup.3.sub.A,B is 6.5.
(89) The scheduler B adds the user requests to a scheduling queue, and the user requests are ranked in the scheduling queue in ascending order of the virtual start times, that is, an order from the queue head to the queue tail in the scheduling queue is P.sup.1.sub.A,B, P.sup.6.sub.B,B, P.sup.2.sub.A,B, P.sup.3.sub.A,B, P.sup.7.sub.B,B, and P.sup.8.sub.B,B, as shown in
(90) The method for scheduling a user request in a distributed resource system provided by this embodiment of the present invention may be further applied to a scenario shown in
(91) Step 1201. The S.sub.d acquires, in the T.sub.n+1 period and from a coordinator G.sub.k of a user z, a resource C.sub.z(T.sub.n) that is consumed by the user z request in a T.sub.n period, where
(92)
d and k are natural numbers, 1dM, and 1kY; a resource weight of the user z is .sub.z; C.sub.z,x(T.sub.n) is a quantity of resources that are provided by the R.sub.x and consumed by N.sub.z,x(T.sub.n) user z requests received by the S.sub.x in the T.sub.n period; z indicates an identifier of the user; and
(93)
indicates the sum of resources that are provided by the R.sub.1 to the R.sub.M and consumed by user z requests received by the S.sub.1 to the S.sub.M in the T.sub.n period.
(94) In step 1201, C.sub.z,x(T.sub.n) specifically includes the sum of resources that are provided by the R.sub.x and consumed by N.sub.z,x(T.sub.n) user z requests received by the S.sub.x in the T.sub.n period. N.sub.z,x(T.sub.n) indicates a quantity of user z requests that are received by the S.sub.x in the T.sub.n period. The S.sub.x sends C.sub.z,x(T.sub.n) to a G.sub.k, and the G.sub.k acquires C.sub.z(T.sub.n) according to
(95)
A manner of acquiring C.sub.z(T.sub.n) is that the S.sub.x proactively sends C.sub.z,x(T.sub.n) to the G.sub.k. Another manner is that the S.sub.x receives a G.sub.k request, and sends C.sub.z,x(T.sub.n) to the G.sub.k according to the G.sub.k request. The G.sub.k acquires C.sub.z,x(T.sub.n) according to
(96)
The S.sub.x stores N.sub.z,x(T.sub.n) and C.sub.z,x(T.sub.n).
(97) Step 1202. The S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), a P.sup.i.sub.z,d by using a scheduling algorithm, where the P.sup.i.sub.z,d is the i.sup.th user z request received by the S.sub.d, and C.sub.z,d(T.sub.n) is a quantity of resources that are provided by an R.sub.d and consumed by N.sub.z,d(T.sub.n) user z requests received by the S.sub.d in the T.sub.n period.
(98) The S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), the P.sup.i.sub.z,d by using a scheduling algorithm, thereby implementing global scheduling on the user z request and ensuring a performance requirement of the user z. Step 1202 specifically includes:
(99) That the S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), the P.sup.i.sub.z,d by using a scheduling algorithm specifically includes that: the S.sub.d computes a virtual start time S(P.sup.i.sub.z,d) and a virtual finish time F(P.sup.i.sub.z,d) of the P.sup.i.sub.z,d according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n) and adds the P.sup.i.sub.z,d to a scheduling queue, where the scheduling queue ranks the user request according to a value of the virtual start time of the user request.
(100)
where v(P.sup.i.sub.z,d) indicates a virtual time of the S.sub.d when the S.sub.d receives the P.sup.i.sub.z,d, and c(P.sup.i.sub.z,d) indicates a resource that is provided by the R.sub.d and consumed by the P.sup.i.sub.z,d; or,
(101)
where v(P.sup.i.sub.z,d) indicates a virtual time of the S.sub.d when the S.sub.d receives the P.sup.i.sub.z,d, and c(P.sup.i.sub.z,d) indicates a resource that is provided by the R.sub.d and consumed by the P.sup.i.sub.z,d.
(102) For meanings of the virtual start time S(P.sup.i.sub.A,A) the virtual finish time F(P.sup.i.sub.A,A), and the virtual time v(P.sup.i.sub.A,A), refer to a Start-time Fairness Queuing (SFQ) algorithm, and details are not described in this embodiment of the present invention again.
(103) d(P.sub.z,d(T.sub.n+1)) indicates a value of a delay of each P.sup.i.sub.z,d received by the S.sub.d in the T.sub.n+1 period.
(104) When either of C.sub.z(T.sub.n)-C.sub.z,d(T.sub.n) and N.sub.z,d(T.sub.n) is 0, d(P.sub.z,d(T.sub.n+1))=0.
(105) c(P.sup.i.sub.z,d) may be specifically an IOPS or bandwidth that is consumed by the P.sup.i.sub.z,d.
(106) Step 1201 specifically includes:
(107) the G.sub.k is determined according to z % Y=k, where z % Y indicates that a modulo operation is performed on z and Y; or the G.sub.k is determined according to Hash(z) % Y=k, where Hash(z) indicates that z is computed by using a hash function, and Hash(z) % Y indicates that a modulo operation is performed on a value and Y, where the value is obtained by computing z by using the hash function.
(108) In the application scenario shown in
(109) In the application scenario shown in
(110) In the application scenario shown in
(111) In a system architecture in this embodiment of the present invention, the user z request can be scheduled without depending on a user agent.
(112) In this embodiment of the present invention, that a resource is an IOPS is used as an example, and generally, one user request consumes one IOPS; or that a resource is network bandwidth is used as an example, and a resource that is consumed by one user request is network bandwidth for the user request. When a resource consumed by a user request is network bandwidth, a size of a resource that is provided by a resource-providing entity and consumed by each user request is determined by the user request.
(113) In this embodiment of the present invention, scheduling a user request by using a scheduling algorithm includes: computing a virtual start time and a virtual finish time of the user request according to the scheduling algorithm in this embodiment of the present invention; and adding the user request to a scheduling queue, where the user request is ranked in the scheduling queue according to a value of the virtual start time of the user request. When it is not required to schedule the user request, the virtual start time and the virtual finish time of the user request need to be computed according to the scheduling algorithm in this embodiment of the present invention, and the user request does not need to be added to a scheduling queue for ranking.
(114) In this embodiment of the present invention, S.sub.d, S.sub.x, R.sub.x, G.sub.y, and G.sub.k are merely used to mark a specific device each, where the device herein may be a physical device or a logical device. Likewise, a device may also be expressed in a manner of first, second, and the like. There is only a difference in specific expression manners, which does not impose a limitation on the solution of the present invention.
(115) As shown in
(116) the acquiring unit 1301 is configured to acquire, in a T.sub.n+1 period and from a coordinator G.sub.k of a user z, a resource C.sub.z(T.sub.n) that is consumed by a user z request in a T.sub.n period, where
(117)
k is a natural number, and 1kY; a resource weight of the user z is .sub.z; C.sub.z,x(T.sub.n) is a quantity of resources that are provided by the R.sub.x and consumed by N.sub.z,x(T.sub.n) user z requests received by the S.sub.x in the T.sub.n period; and z indicates an identifier of the user; and
(118) the scheduling unit 1302 is configured to schedule, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), a P.sup.i.sub.z,d by using a scheduling algorithm, where the P.sup.i.sub.z,d is the i.sup.th user z request received by the S.sub.d, and C.sub.z,d(T.sub.n) is a quantity of resources that are provided by an R.sub.d and consumed by N.sub.z,d(T.sub.n) user z requests received by the S.sub.d in the T.sub.n period.
(119) Specifically, that the scheduling unit 1302 is configured to schedule, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), a P.sup.i.sub.z,d by using a scheduling algorithm specifically includes:
(120) computing a virtual start time S(P.sup.i.sub.z,d) and a virtual finish time F(P.sup.i.sub.z,d) of the P.sup.i.sub.z,d according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n); and adding the P.sup.i.sub.z,d to a scheduling queue, where the scheduling queue ranks the user request according to a value of the virtual start time of the user request.
(121) Specifically, S(P.sup.i.sub.z,d)=max{v(P.sup.i.sub.z,d), F(P.sup.i1.sub.z,d)},
(122)
where v(P.sup.i.sub.z,d) indicates a virtual time of the S.sub.d when the S.sub.d receives the P.sup.i.sub.z,d, and c(P.sup.i.sub.z,d) indicates a resource that is provided by the R.sub.d and consumed by the P.sup.i.sub.z,d.
(123) Specifically, S(P.sup.i.sub.z,d)=max{v(P.sup.i.sub.z,d),
(124)
where v(P.sup.i.sub.z,d) indicates a virtual time of the S.sub.d when the S.sub.d receives the P.sup.i.sub.z,d, and c(P.sup.i.sub.z,d) indicates a resource that is provided by the R.sub.d and consumed by the P.sup.i.sub.z,d.
(125) For meanings of the virtual start time S(P.sup.i.sub.A,A) the virtual finish time F(P.sup.i.sub.A,A), and the virtual time v(P.sup.i.sub.A,A), refer to a Start-time Fairness Queuing (SFQ) algorithm, and details are not described in this embodiment of the present invention again.
(126) Specifically, when either of C.sub.z(T.sub.n)-C.sub.z,d(T.sub.n) and N.sub.z,d (T.sub.n) is 0, d(P.sub.z,d(T.sub.n+1))=0.
(127) The S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n) the P.sup.i.sub.z,d by using the scheduling algorithm. The user z request can be scheduled without depending on a user agent. In addition, the S.sub.d schedules, according to .sub.z, C.sub.z(T.sub.n), C.sub.z,d(T.sub.n), and N.sub.z,d(T.sub.n), the P.sup.i.sub.z,d by using the scheduling algorithm, thereby implementing global scheduling on the user z request and ensuring a performance requirement of the user z.
(128) In an implementation manner of another resource scheduling method in a distributed resource system, the distributed resource system includes multiple schedulers, where a first scheduler in the multiple schedulers acquires, from a coordinator of a first user, the sum of resources that are consumed by a user request of the first user in the multiple schedulers in a previous period; and
(129) the first scheduler schedules the user request of the first user according to a resource weight of the first user, the sum of resources that are consumed by the user request of the first user in the multiple schedulers in the previous period, a resource that is consumed by the user request of the first user in the first scheduler in the previous period, and a quantity of user requests of the first user received by the first scheduler in the previous period.
(130) Further, that the first scheduler schedules the user request of the first user according to a resource weight of the first user, the sum of resources that are consumed by the user request of the first user in the multiple schedulers in the previous period, a resource that is consumed by the user request of the first user in the first scheduler in the previous period, and a quantity of user requests of the first user received by the first scheduler in the previous period specifically includes that:
(131) the first scheduler computes a virtual start time and a virtual finish time of the user request of the first user according to the resource weight of the first user, the sum of resources that are consumed by the user request of the first user in the multiple schedulers in the previous period, the resource that is consumed by the user request of the first user in the first scheduler in the previous period, and the quantity of user requests of the first user received by the first scheduler in the previous period; and adds the user request of the first user to a scheduling queue, where the scheduling queue ranks the user request of the first user according to a value of the virtual start time of the user request.
(132) Another distributed resource system includes multiple schedulers. As shown in
(133) the first acquiring unit 1301 is configured to acquire, from a coordinator of a first user, the sum of resources that are consumed by a user request of the first user in the multiple schedulers in a previous period; and
(134) the scheduling unit 1302 is configured to schedule the user request of the first user according to a resource weight of the first user, the sum of resources that are consumed by the user request of the first user in the multiple schedulers in the previous period, a resource that is consumed by the user request of the first user in the first scheduler in the previous period, and a quantity of user requests of the first user received by the first scheduler in the previous period.
(135) Further, the scheduling unit 1302 is specifically configured to compute a virtual start time and a virtual finish time of the user request of the first user according to the resource weight of the first user, the sum of resources that are consumed by the user request of the first user in the multiple schedulers in the previous period, the resource that is consumed by the user request of the first user in the first scheduler in the previous period, and the quantity of user requests of the first user received by the first scheduler in the previous period; and add the user request of the first user to a scheduling queue, where the scheduling queue ranks the user request of the first user according to a value of the virtual start time of the user request.
(136) The technical solutions provided by the embodiments of the present invention may also be applied to another scenario. For example, a distributed resource system is a distributed computing system, and a resource-providing entity provides a computing resource for a user request; or, a distributed resource system may be a distributed network system, and a resource-providing entity provides network bandwidth for a user request; or, a resource-providing entity may further provide a memory resource for a user request.
(137) A person of ordinary skill in the art may be aware that, in combination with the examples described in the embodiments disclosed in this specification, units and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions.
(138) It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and unit, refer to a corresponding process in the foregoing method embodiments, and details are not described herein again.
(139) In the several embodiments provided in the present application, it should be understood that the unit division is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
(140) The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
(141) In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit.
(142) When the functions are implemented in the form of a software functional unit and sold or used as an independent product, the functions may be stored in a computer-readable non-volatile storage medium. Based on such an understanding, the technical solutions of the present invention essentially, or the part contributing to the prior art, or some of the technical solutions may be implemented in a form of a software product. The software product is stored in a non-volatile storage medium, and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) to perform all or some of the steps of the methods described in the embodiments of the present invention. The foregoing non-volatile storage medium includes: any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disc.