CN111045819A - Resource request method, device, equipment and storage medium of distributed system - Google Patents

Resource request method, device, equipment and storage medium of distributed system Download PDF

Info

Publication number
CN111045819A
CN111045819A CN201911158069.6A CN201911158069A CN111045819A CN 111045819 A CN111045819 A CN 111045819A CN 201911158069 A CN201911158069 A CN 201911158069A CN 111045819 A CN111045819 A CN 111045819A
Authority
CN
China
Prior art keywords
resource
request
quota
request end
allocated
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201911158069.6A
Other languages
Chinese (zh)
Inventor
高华龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yunkuanzhiye Network Technology Co Ltd
Original Assignee
Beijing Yunkuanzhiye Network Technology Co Ltd
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 Beijing Yunkuanzhiye Network Technology Co Ltd filed Critical Beijing Yunkuanzhiye Network Technology Co Ltd
Priority to CN201911158069.6A priority Critical patent/CN111045819A/en
Publication of CN111045819A publication Critical patent/CN111045819A/en
Pending legal-status Critical Current

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]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • 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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • 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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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/5061Partitioning or combining of resources
    • G06F9/5066Algorithms for mapping a plurality of inter-dependent sub-tasks onto a plurality of physical CPUs

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a resource request method, a resource request device, equipment and a storage medium of a distributed system. The resource allocation method of the distributed system comprises the following steps: allocating resource quotas for a plurality of request terminals in the distributed system; receiving resource request information sent by a first request end in a plurality of request ends; acquiring the resource request quantity of a first request end according to the resource request information; the resource request amount is the resource demand amount under the condition that the resource demand amount of the first request end is smaller than or equal to the resource quota corresponding to the first request end; under the condition that the resource demand of the first request end is larger than the resource quota corresponding to the first request end, the resource demand is the resource quota; providing resources of the resource request quantity for the first request end, and acquiring a first difference between the resource demand quantity of the first request end and the corresponding resource quota; and reallocating the resource quota for the plurality of request ends according to the first difference. The method and the device can improve the resource utilization rate and the system efficiency.

Description

Resource request method, device, equipment and storage medium of distributed system
Technical Field
The present application relates to a distributed system, and in particular, to a method, an apparatus, a device, and a storage medium for requesting resources of a distributed system.
Background
With the technological changes brought by cloud computing, virtualization technology, container technology, micro-service and the like, distributed systems are widely applied to various industries and fields. With the widespread application of distributed systems, the different resources required by each specific application system face respective levels of quality control problems, which create many new challenges as the service for controlling the resources changes from a single node to a distributed plurality of nodes, and the biggest challenge is the problem of distributed deadlock. In a distributed environment, deadlock prevention and detection becomes extremely difficult due to the existence of factors such as uncertainty of communication delay, distribution of regions, and high sharing of resources and data. In a distributed computing system, more than two processes are executed concurrently, and each process waits for system resources occupied by other processes and cannot continue to run, that is, any process in the system cannot run, and a dead loop is formed, so that a deadlock is generated.
Currently, deadlock prevention can be achieved by breaking the conditions under which the deadlock arises. For example, it is specified that a requesting process starts execution only if a resource is allocated to a requesting end when a resource providing end is able to satisfy all resource requests of the requesting end process, so that no resource wait occurs. However, these methods require a large amount of resource reservation, and the resource utilization rate is low, which affects the system efficiency.
Disclosure of Invention
The embodiment of the application provides a resource request method, a resource request device, a resource request equipment and a storage medium of a distributed system, which are used for solving the problems in the related technology, and the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a resource allocation method for a distributed system, including:
allocating resource quotas for a plurality of request terminals in the distributed system;
receiving resource request information sent by a first request end in a plurality of request ends;
acquiring a resource request quantity of a first request end according to the resource request information, wherein the resource request quantity is the resource demand quantity under the condition that the resource demand quantity of the first request end is less than or equal to a resource quota corresponding to the first request end; under the condition that the resource demand of the first request end is larger than the resource quota corresponding to the first request end, the resource demand is the resource quota;
providing resources of the resource request quantity for the first request end, and acquiring a first difference between the resource demand quantity of the first request end and the corresponding resource quota;
and reallocating the resource quota for the plurality of request ends according to the first difference.
In one embodiment, the resource request information includes a resource request amount and a first deficit;
after allocating resource quotas for a plurality of requesters in the distributed system, the method further comprises:
and sending the information of the allocated resource quotas to a plurality of request ends, so that the plurality of request ends determine a first difference and a resource request amount according to the resource demand amount of the request ends and the corresponding resource quotas.
In one embodiment, before reallocating the resource quotas for the plurality of requestors according to the first deficit, the method further comprises:
determining whether a preset quota redistribution condition is met, and if the preset quota redistribution condition is met, redistributing resource quotas for the plurality of request ends according to the first difference;
wherein the preset quota redistribution condition comprises at least one of the following conditions:
the first difference corresponding to the multiple request ends reaches a preset threshold value;
the current time reaches a preset cycle time node;
disconnecting the connection with any request end in the plurality of request ends;
and establishing connection with any request terminal in the distributed system.
In one embodiment, reallocating resource quotas for a plurality of requestors according to a first deficit comprises:
calculating the total amount of the resource quota which can be recovered from the resource quotas allocated to the plurality of request terminals;
respectively calculating the resource quota to be allocated of each request end according to the total resource quota and a first difference corresponding to each request end in the plurality of request ends;
and recovering or increasing the resource quota of each request end according to the resource quota to be allocated of each request end, so that each request end is allocated to the resource quota to be allocated.
In one embodiment, calculating the total amount of resource quotas that can be reclaimed from the resource quotas that have been allocated by the plurality of requesters comprises:
and calculating the resource quota which can be recovered from each request end according to the allocated resource quota of each request end in the plurality of request ends and a preset recovery proportion so as to obtain the total resource quota which can be recovered from the plurality of request ends.
In one embodiment, calculating the total amount of resource quotas that can be reclaimed from the resource quotas that have been allocated by the plurality of requesters comprises:
calculating a second difference between the allocated resource quota of each request end in the plurality of request ends and a preset reserved quota;
and calculating the sum of the second difference corresponding to the plurality of request ends to obtain the total amount of the resource quota capable of being recovered from the plurality of request ends.
In one embodiment, the resource quotas that can be reclaimed from each of the plurality of requestors are equal.
In one embodiment, the calculating the to-be-allocated resource quota of each request end according to the total resource quota and a first difference corresponding to each request end in a plurality of request ends respectively includes:
calculating the sum of first differences corresponding to a plurality of request ends;
and calculating the to-be-allocated resource quota of each request end according to the proportion between the first difference corresponding to each request end in the plurality of request ends and the sum of the first differences and the total amount of the resource quotas.
In one embodiment, the calculating the to-be-allocated resource quota of each request end according to the total resource quota and a first difference corresponding to each request end in a plurality of request ends respectively includes:
determining a difference level corresponding to each request end according to a first difference corresponding to each request end in a plurality of request ends;
determining the distribution weight of each request end according to the difference level corresponding to each request end; the balance level and the distribution weight have a preset mapping relation;
calculating the sum of the distribution weights of a plurality of request ends;
and calculating the resource quota to be allocated of each request end according to the proportion between the allocation weight of each request end and the sum of the allocation weights and the total amount of the resource quota.
In one embodiment, recovering or increasing the resource quota of each request end according to the resource quota to be allocated of each request end includes:
for a second request end in the plurality of request ends, determining the size relationship between the resource quota to be allocated and the resource quota already allocated of the second request end;
under the condition that the resource quota to be allocated of the second request end is smaller than the allocated resource quota, the second request end is informed to recover the resource quota;
and under the condition that the to-be-allocated resource quota of the second request end is greater than or equal to the already-allocated resource quota, increasing the resource quota of the second request end.
In one embodiment, increasing the resource quota of the second requester includes:
if the resource quota which is not distributed currently is larger than or equal to the third difference, extracting the third difference from the resource quota which is not distributed currently and adding the third difference to the resource quota of the second request end; the third difference is the difference between the resource quota to be allocated of the second request end and the reserved quota of the second request end;
and if the resource quota which is not currently allocated is smaller than the third difference, all the resource quota which is not currently allocated is allocated to the second request end, and the second request end is added into the quota waiting list.
In one embodiment, after notifying the second requester to reclaim its resource quota, the method further comprises:
determining a resource quota recovered from the second request end according to the feedback information sent by the second request end;
and allocating the resource quota for one or more requesters in the quota waiting list by using the resource quota recycled from the second requester.
In a second aspect, an embodiment of the present application provides a resource request method for a distributed system, including:
receiving a resource quota distributed by a resource provider; wherein the resource quota is less than the total resource amount of the resource provider;
determining the resource request quantity as the resource demand quantity under the condition that the resource demand quantity of the self is less than or equal to the resource quota;
determining the resource request amount as a resource quota under the condition that the resource request amount is larger than the resource quota;
acquiring a first difference between a resource request amount and a resource quota;
and sending resource request information to the resource providing end, wherein the resource request information comprises a resource request amount and a first difference, and the resource request information is used for enabling the resource providing end to provide resources of the resource request amount and reallocating resource quotas for a plurality of requesting ends connected with the resource providing end according to the first difference.
In a third aspect, an embodiment of the present application provides a resource request device for a distributed system, including:
the system comprises an initial allocation module, a resource quota allocation module and a resource quota allocation module, wherein the initial allocation module is used for allocating resource quotas to a plurality of request ends in a distributed system;
the request receiving module is used for receiving resource request information sent by a first request end in a plurality of request ends;
the first obtaining module is used for obtaining the resource request quantity of the first request end according to the resource request information, wherein the resource request quantity is the resource request quantity under the condition that the resource demand quantity of the first request end is less than or equal to the resource quota corresponding to the first request end; under the condition that the resource demand of the first request end is larger than the resource quota corresponding to the first request end, the resource demand is the resource quota;
the resource providing module is used for providing resources of the resource request quantity for the first request end and acquiring a first difference between the resource demand quantity of the first request end and the corresponding resource quota;
and the reallocation module is used for reallocating the resource quotas for the plurality of request ends according to the first difference.
In a fourth aspect, an embodiment of the present application provides a resource request device for a distributed system, including:
a quota receiving module, configured to receive a resource quota allocated by a resource provider; wherein the resource quota is less than the total resource amount of the resource provider;
the first quantitative module is used for determining the resource request quantity as the resource demand quantity under the condition that the resource demand quantity of the first quantitative module is less than or equal to the resource quota;
the second quantitative module is used for determining the resource request quantity as the resource quota under the condition that the resource request quantity is greater than the resource quota;
the second acquisition module is used for acquiring a first difference between the resource request amount and the resource quota;
the request sending module is used for sending resource request information to the resource providing end, wherein the resource request information comprises a resource request amount and a first difference, the resource request information is used for enabling the resource providing end to provide resources of the resource request amount, and the resource quota is reallocated to a plurality of request ends connected with the resource providing end according to the first difference.
In a fifth aspect, an embodiment of the present application provides an apparatus, including: a memory and a processor. Wherein the memory and the processor are in communication with each other via an internal connection path, the memory is configured to store instructions, the processor is configured to execute the instructions stored by the memory, and the processor is configured to perform the method of any of the above aspects when the processor executes the instructions stored by the memory.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium, which stores a computer program, and when the computer program runs on a computer, the method in any one of the above-mentioned aspects is executed.
The advantages or beneficial effects in the above technical solution at least include:
the resource provider divides the total amount of the resources into a plurality of resource quotas which are respectively distributed to a plurality of request ends, when the request ends request the resources, the resources in the quota range are provided for the request ends, one request end can not completely occupy all the resources of the resource provider, and the deadlock is avoided. And the resource quota of each request end is dynamically adjusted according to the difference information between the resource demand of the request end and the resource quota, so that the low resource request efficiency of other request ends caused by excessively reserving quotas for part of request ends is avoided, and the resource utilization rate and the system efficiency are improved.
The foregoing summary is provided for the purpose of description only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the present application will be readily apparent by reference to the drawings and following detailed description.
Drawings
In the drawings, like reference numerals refer to the same or similar parts or elements throughout the several views unless otherwise specified. The figures are not necessarily to scale. It is appreciated that these drawings depict only some embodiments in accordance with the disclosure and are therefore not to be considered limiting of its scope.
Fig. 1 is a flowchart illustrating a resource request method of a distributed system according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a resource request method of a distributed system according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a resource request method of a distributed system according to an embodiment of the present disclosure;
FIG. 4 is a diagram illustrating resource quotas and update flows in an application example;
FIG. 5 is a diagram illustrating a quota update process in an application example;
fig. 6 is a block diagram illustrating a resource request apparatus of a distributed system according to an embodiment of the present application;
fig. 7 is a block diagram illustrating a resource request apparatus of a distributed system according to an embodiment of the present application;
fig. 8 is a block diagram illustrating a resource request apparatus of a distributed system according to an embodiment of the present application;
fig. 9 is a block diagram of an apparatus according to an embodiment of the present application.
Detailed Description
In the following, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments may be modified in various different ways, all without departing from the spirit or scope of the present application. Accordingly, the drawings and description are to be regarded as illustrative in nature, and not as restrictive.
In a distributed system, there are multiple processes executing concurrently. According to the processing positions of the devices in the process in the distributed system, the devices can be divided into a request end for competing resources and a resource providing end for providing the resources. The request end and the resource providing end are opposite, and the same device can be used as the request end for requesting resources in one process and can also be used as the resource providing end for providing resources in other processes. One resource provider may provide resources for a plurality of requesters, and one requester may also request resources from a plurality of resource providers.
Fig. 1 shows a flowchart of a resource request method of a distributed system according to an embodiment of the present application. The method may be implemented by a resource provider of a distributed system. As shown in fig. 1, the method may include:
step S101, distributing resource quotas for a plurality of request ends in a distributed system;
step S102, receiving resource request information sent by a first request end in a plurality of request ends; the first request terminal may be any request terminal among a plurality of request terminals;
step S103, acquiring a resource request quantity of a first request end according to the resource request information, wherein the resource request quantity is the resource demand quantity under the condition that the resource demand quantity of the first request end is less than or equal to a resource quota corresponding to the first request end; under the condition that the resource demand of the first request end is larger than the resource quota corresponding to the first request end, the resource demand is the resource quota;
step S104, providing resources of the resource request quantity for the first request end, and acquiring a first difference between the resource demand quantity of the first request end and the corresponding resource quota;
and step S105, reallocating resource quotas for the plurality of request ends according to the first difference.
In the technical scheme, the resource providing end divides the total amount of the resources into multiple resource quotas which are respectively distributed to the multiple request ends, when the request ends request the resources, the resources within the quota range are only provided for the request ends, and one request end cannot completely occupy all the resources of the resource providing end, so that the generation of deadlock is avoided. And the resource quota of each request end is dynamically adjusted according to the resource demand of the request end and the difference between the resource quotas, so that the low resource request efficiency of other request ends caused by excessive quota reservation of part of request ends is avoided, and the resource utilization rate and the system efficiency are improved.
As an example, the resource request information includes a resource request amount and a first deficit. After allocating or reallocating resource quotas for a plurality of requesters in the distributed system in step S101 or step S105, the method further includes:
and sending the information of the allocated resource quotas to a plurality of request ends, so that the plurality of request ends determine a first difference and a resource request amount according to the resource demand amount of the request ends and the corresponding resource quotas.
In the above example, the requesting end knows its resource quota, and when it needs to request resources from the resource providing end, it can calculate the resource amount that it can request according to its resource demand amount and resource quota, and when sending the resource request, it carries the request amount information, and the resource providing end directly provides resources according to the request amount. Specifically, when the resource demand is greater than the resource quota, the request amount is the resource quota; and when the resource demand is less than or equal to the resource quota, the request quantity is the resource demand. The request end can also calculate a first difference between the resource demand and the resource quota, and the request quantity and the first difference are carried in the resource request. The resource provider informs the request provider of the resource quota of the request provider, the request provider calculates the request amount and the first difference, and the resource provider can directly distribute the resource quota to the request provider according to the request amount. Therefore, the calculation amount of the resource providing end is reduced, and the processing efficiency of the system is improved.
It should be noted that the first difference may refer to a number of the resource demand exceeding the resource quota, and the first difference carried in the resource request may be a negative value or may be set to 0 when the resource demand is less than or equal to the resource quota.
In another example, the resource provider may not send the information of the allocated resource quota to the request terminal, and the request terminal carries its own resource demand when initiating the resource request, and then the resource provider may determine, according to the resource demand and the resource quota of the request terminal, whether the resource quantity allocated to the request terminal is the resource demand or the resource quota, and calculate the first difference.
As an exemplary implementation manner, before reallocating the resource quotas for the multiple requesters according to the first difference at step S105, the method further includes:
and determining whether the preset quota redistribution condition is met, and if the preset quota redistribution condition is met, redistributing the resource quotas for the plurality of request ends according to the first difference.
Wherein the preset quota redistribution condition comprises at least one of the following conditions:
the first condition is as follows: the first difference corresponding to the plurality of request ends reaches a preset threshold value.
Illustratively, the first difference of the plurality of request terminals reaches a preset threshold, which may be that the sum of the first differences of the plurality of request terminals reaches the preset threshold; or the first difference of one of the request ends reaches a preset threshold; it is also possible that a number of the first differences reach a preset threshold, for example, the number of requesting terminals whose first differences reach the preset threshold exceeds the limit. If the first difference of one request end is too high or the difference of a plurality of request ends with large area exceeds the standard, which means that the current resource quota allocation is unbalanced, the resource quota can be reallocated to avoid influencing the resource allocation efficiency so as to influence the global working efficiency of the distributed system.
And a second condition: the current time reaches a preset cycle time node.
For example, the resource quotas of the multiple requesters may be reallocated at a preset frequency, that is, when the current time reaches a preset cycle time node. The timing can be started when the resource providing end is on line, or the timing can be started when the number of on lines of the request end corresponding to the resource providing end exceeds two.
And (3) carrying out a third condition: the connection with any request end in the plurality of request ends is disconnected.
When the resource providing end is connected with a plurality of request ends, resources can be provided for the plurality of request ends, and according to the embodiment of the application, resource quotas need to be allocated for the plurality of request ends. When the connection with any one of the request ends is disconnected, resources do not need to be provided for the request end and the resource quota does not need to be allocated, the resource quota originally allocated to the request end can be recycled and used for being allocated to other request ends, and at this time, the global resource amount can be reallocated.
And a fourth condition: and establishing connection with any request terminal in the distributed system.
When the resource provider establishes a connection with any request end in the distributed system, that is, a new request end is online, a resource quota needs to be allocated to the new request end, so as to prevent the new request end from being unable to obtain resources. For example, a resource quota may be reallocated for multiple online requestors when a new requester is online. Or reserving a part of the request ends for being allocated to the new online request ends in the total global resource amount, extracting the basic resource quota allocated to the new online request ends from the total global reserved quota, and then reallocating the resource quota for all the online request ends.
As an exemplary implementation manner, as shown in fig. 2, which is a flowchart of a resource request method according to an embodiment of the present application, step S105 of reallocating resource quotas to multiple requesting peers according to a first difference may include:
step S201, calculating the total amount of the resource quota which can be recovered from the resource quotas already distributed by a plurality of request terminals;
step S202, respectively calculating a to-be-allocated resource quota of each request end according to the total resource quota and a first difference corresponding to each request end in a plurality of request ends;
step S203, according to the to-be-allocated resource quota of each request end, recovering or increasing the resource quota of each request end, so that each request end is allocated to the to-be-allocated resource quota.
In the exemplary embodiment, the reallocation of the resource quota for the multiple request terminals includes that the allocated resource quotas of the multiple request terminals are recovered first, are collected together, are allocated according to the resource demand of each request terminal and the first difference of the current resource quota, and are reallocated according to the global resource quota utilization condition, so that the resource quota allocation is fairer, and the working efficiency of the system can be improved. In the exemplary embodiment, after the resource quota to be allocated of each request end is clarified according to the global resource quota utilization condition, the resource quota of each request end is recycled or increased instead of forcibly changing the resource quota of each request end, so that the resource re-allocation does not influence the occupation of each process on the resources, and the running reliability of the system process is ensured.
Step S201, calculating a total amount of resource quotas that can be recovered from the resource quotas already allocated by the multiple request terminals, which may have various embodiments. One of the implementations is to reallocate all resource quota recoveries. The embodiments of the present application further provide various other exemplary embodiments, where the exemplary embodiments reserve a certain reserved quota for multiple request ends, so as to avoid that a resource quota of a request end is too large in a multiple allocation process, and avoid that, when a demand of some request ends is smaller than the resource quota and a first difference is a negative value or zero, the resource quota may not be allocated, thereby causing long-term resource waiting. The following are several exemplary ways:
first, step S201 includes:
and calculating the resource quota which can be recovered from each request end according to the allocated resource quota of each request end in the plurality of request ends and a preset recovery proportion so as to obtain the total resource quota which can be recovered from the plurality of request ends.
In this example, the resource quotas are reclaimed proportionally. In this manner, the requestor may be left with a resource quota that is proportional to the previously allocated resource quota. When the resource demand of the requesting peer is not stressed, i.e. the first difference is a negative value or 0, the reserved quota may be the entire resource quota of the requesting peer. That is, the reserved quota of a requester may be the minimum value of the resource quota that can be obtained by the requester in the global quota reallocation process. The request end can at least reserve a resource quota in proportion to the previously allocated quota, so that the floating of the resource quota of the request end can be in a reasonable range, the quota fall is avoided, and the quota needs to be adjusted repeatedly.
Example two, step S201 includes:
calculating a second difference between the allocated resource quota of each request end in the plurality of request ends and a preset reserved quota;
and calculating the sum of the second difference corresponding to the plurality of request ends to obtain the total amount of the resource quota capable of being recovered from the plurality of request ends.
In this example, the reserved quota for each requester is preset, and the resource quotas that each requester can hold are at least equal.
Examples III,
The resource quotas that can be reclaimed from each of the multiple requesters are equal.
In this example, the resource quotas that can be reclaimed from each requester are equal, and each requester gives back the resource quotas in equal amounts.
Step S202, respectively calculating a to-be-allocated resource quota of each request end according to the total resource quota and a first difference corresponding to each request end in the plurality of request ends, which may also have various exemplary embodiments:
first, step S202 includes:
calculating the sum of first differences corresponding to a plurality of request ends;
and calculating the to-be-allocated resource quota of each request end according to the proportion between the first difference corresponding to each request end in the plurality of request ends and the sum of the first differences and the total amount of the resource quotas.
In this example, the resource provider determines the resource quota to be allocated to each request end according to the ratio between the first difference and the total difference corresponding to each request end, which may be used as a weight, and can reallocate the resource quota accurately according to the resource demand pressure of each request end. For example, the ratio is multiplied by the total amount of the resource quota, so as to obtain the resource quota to be allocated for each request end. If the reserved quota is set for the request end, the ratio can be multiplied by the total amount of the resource quota, and then the reserved quota is added, so that the resource quota to be allocated of each request end is obtained.
Example two, step S202 includes:
determining a difference level corresponding to each request end according to a first difference corresponding to each request end in a plurality of request ends;
determining the distribution weight of each request end according to the difference level corresponding to each request end; the balance level and the distribution weight have a preset mapping relation;
calculating the sum of the distribution weights of a plurality of request ends;
and calculating the resource quota to be allocated of each request end according to the proportion between the allocation weight of each request end and the sum of the allocation weights and the total amount of the resource quota.
In this example, the deficit level corresponding to each request end is determined, the allocation weight is determined according to the level, and then the allocation weight is used to determine the resource quota to be allocated of each request end. In the example, the resource demand pressure of the request ends is classified into levels, more than two request ends with the same difference level but different first differences can obtain the same resource quota, and the resource quotas obtained by the request ends with the similar first differences are also similar or identical, so that the repeated change of the resource quotas caused by accidental sudden change of the occupied amount of the resources is avoided, and the anti-jitter effect is achieved. Illustratively, the spacing between the minimum differences for each set of adjacent difference levels may be the same or different.
In some exemplary embodiments, the step S203 of reclaiming or increasing the resource quota of each request end according to the resource quota to be allocated by each request end may include:
for a second request end in the plurality of request ends, determining the size relationship between the resource quota to be allocated and the resource quota already allocated of the second request end; the second request end can be any request end in a plurality of request ends;
under the condition that the resource quota to be allocated of the second request end is smaller than the allocated resource quota, the second request end is informed to recover the resource quota;
and under the condition that the to-be-allocated resource quota of the second request end is greater than or equal to the already-allocated resource quota, increasing the resource quota of the second request end.
In the foregoing exemplary embodiment, increasing the resource quota of the second requester may include:
if the resource quota which is not currently allocated is larger than or equal to a third difference between the resource quota to be allocated of the second request end and the reserved quota of the second request end, extracting the third difference from the resource quota which is not currently allocated to be added into the resource quota of the second request end;
and if the resource quota which is not currently allocated is smaller than the third difference, all the resource quota which is not currently allocated is allocated to the second request end, and the second request end is added into the quota waiting list.
For example, the resource provider may use all of its total resource amount to allocate and reallocate resource quotas for the connected multiple requesters, or may leave a part of the resource amount to allocate the basic resource quotas for the newly online requesters. The resource provider may have all or a portion of the total amount of resources as a dynamically allocatable adjusted total quota. In the reallocation process, after the to-be-allocated resource quota of each request end is determined, the to-be-allocated quota needs to be validated. For each request end, if the resource quota to be allocated is reduced relative to the allocated resource quota, the request end is informed to recover the resource quota, so that the request end can timely release the occupation of excessive resources. If the resource quota to be allocated rises relative to the allocated resource quota, a difference portion (i.e., a third difference) between the resource quota to be allocated and the reserved quota of the requesting end needs to be extracted from the dynamically allocatable adjustment total quota and allocated to the requesting end. However, since the resource quota is dynamically adjusted, when the request end fails to timely release the resource occupancy and return the resource quota, the actually allocable resource quota (i.e., the resource quota that is not currently allocated) is smaller than the dynamically allocatable adjusted total quota, and thus the resource quota to be allocated may not be sufficiently allocated to the request end, and the request end needs to be added to the quota waiting list.
Further, after notifying the requesting end of the second recovery of its resource quota, the method further includes:
determining a resource quota recovered from the second request end according to the feedback information sent by the second request end;
and allocating the resource quota for one or more requesters in the quota waiting list by using the resource quota recycled from the second requester.
In the above technical solution, the request end returns feedback information to inform the resource provider of how much resource quota can be currently recovered by the request end for reallocation, and the resource provider can allocate quota for one or more request ends in the quota waiting list by using the recovered resource quota. The requesting end in the resource waiting list can be removed from the resource waiting list if the requesting end obtains enough resource quotas.
In some embodiments, the resource provider adds the reclaimed resource quota to the actually allocable resource quota, and extracts a part or all of the resource quota from the actually allocable resource quota to allocate to the requester in the quota wait list. As an example, the recycled resource quota may also preferentially provide the basic resource quota for the newly online requester.
Fig. 3 shows a flowchart of a resource request method of a distributed system according to an embodiment of the present application. The method may be implemented by a requesting end of a distributed system. As shown in fig. 3, the method includes:
step S301, receiving a resource quota distributed by a resource provider; wherein the resource quota is less than the total resource amount of the resource provider;
step S302, under the condition that the resource demand of the user is less than or equal to the resource quota, determining the resource request amount as the resource demand;
step S303, under the condition that the resource demand is greater than the resource quota, determining the resource demand as the resource quota;
step S304, acquiring a first difference between the resource request amount and the resource quota;
step S305, sending resource request information to the resource provider, where the resource request information includes a resource request amount and a first difference, and the resource request information is used to enable the resource provider to provide resources of the resource request amount, and reallocate resource quotas for multiple request clients connected to the resource provider according to the first difference.
According to the technical scheme, the number of the request resources of the request end is limited to the resource quota smaller than the total resource amount, when the request end requests the resources, only the resources in the quota range can be obtained, and one request end cannot completely occupy all the resources of the resource providing end, so that deadlock is avoided. And the resource quota of each request end is dynamically adjusted according to the difference information between the resource demand of the request end and the resource quota, so that the low resource request efficiency of other request ends caused by excessively reserving quotas for part of request ends is avoided, and the resource utilization rate and the system efficiency are improved.
An application example of the embodiment of the present application is given below. The implementation of various technical details in this application example should be understood as optional, not essential.
In an application example, when a resource provider goes online, a plurality of requesters connected to the resource provider may be allocated a preset basic resource quota.
When a new request end is on line, the resource providing end can execute the on-line flow of the request end. The total resource quota of the resource provider can be divided into a reserved total quota and an adjusted total quota, the adjusted total quota can be used for being dynamically distributed to the request end according to the resource demand pressure of the request end, the reserved total quota can be reserved for the newly online request end, and a basic resource quota is configured for the newly online request end, so that the possibility that the newly online request end cannot obtain resources and deadlock is generated is avoided. After the resource provider recovers the resource quota from the request end, the resource quota can be preferentially returned to the reserved total quota, so that the resource total quota always has a margin. The online flow when the request end is online comprises a step of giving a basic resource quota distributed to the online request end from the reserved total quota and a resource quota calculation and updating flow after the step.
The basic resource quota of the request end may be a preset default value default _ token _ min. However, the resource provider cannot sense the online time of the request, and the resource occupied by the request cannot be released in time, so the reserved total quota cannot be kept higher than the preset default value constantly. In this regard, the base quota token _ base for the newly online requester may be calculated as follows:
token _ base min (default _ token _ min, token _ rsvr), where token _ rsvr is the current reserved total quota.
FIG. 4 is a schematic diagram of a resource quota and update flow. The process calculates the total allocation quota which can be currently recovered from each request end, and also can calculate the reserved quota which is reserved by each request end and belongs to each request end. Then, the allocation weights of all the requesting terminals are calculated according to the resource demand pressure of the requesting terminals, i.e. the first difference, and the corresponding weighted sum. And traversing each request end, and calculating the resource quota to be allocated of the request end. The specific calculation method may refer to the exemplary embodiment of step 202. In this application example, a limit quota may be set for each requester, and if there is a limit quota, the actual to-be-allocated resource quota of the requester is to be updated to a minimum value between the limit quota and the calculated to-be-allocated resource quota. And then updating the actually allocable resource quota to be the original allocable resource quota minus the resource quota to be allocated of the request end.
Under the condition that the limited quota exists, after the request end is traversed, the actually allocable resource quota may be greater than 0, and at this time, all the remaining resource quotas may be allocated to the first request end whose allocation weight is not 0. Then, all requesters are traversed to validate the resource quota.
The validation process may refer to the quota update process diagram shown in fig. 5. And traversing each request end, judging whether the quota of the resource to be allocated is equal to the allocated quota for the current request end, and if so, finishing the effective processing of the resource quota of the current request end. If not, it is determined whether the resource quota was increased or decreased. And if the resource quota is reduced, notifying the current request end to return the resource, wherein the notification can carry a version number. And if the resource quota is increased, taking out the resource quota from the resource quota which is not distributed, and distributing the resource quota to the current request end. And if the current request end obtains the resource quota to be distributed, ending the effective processing of the resource quota of the current request end. And if the current request end cannot obtain enough resource quota to be allocated, adding the current request end to a resource quota waiting list.
After the request end is notified to return the resource quota, the request end can wait to receive the feedback information of the request end. When the feedback information of the requesting end is received, it may be checked whether the version number is the same as the version number in the notification, and the recoverable quota indicated in the feedback information is recovered only if the version number is the same as the version number in the notification. The recovered resources may be preferentially supplemented to the reserved total quota, and then supplemented to the actually allocable resource quota when there is a margin, so as to allocate a quota to the request end in the resource quota waiting list, or allocate the quota to the traversed request end in the quota updating process shown in fig. 5.
When the request end goes offline, the resource quota in the request end can be returned to the resource providing end, including returning the basic resource quota to the reserved total quota. Then, the resource quota calculation and update procedure shown in fig. 4 may be performed.
It should be noted that, although the resource request method of the distributed system is described above by taking fig. 4 and fig. 5 as an application example, those skilled in the art can understand that the present application should not be limited thereto. In fact, the user can flexibly set the technical details according to personal preference and/or actual application scene.
Thus, according to the embodiments of the present application, the resource provider divides the total amount of resources into multiple resource quotas, and allocates the resource quotas to multiple request clients, and when a request client requests a resource, only the resource in the quota range is provided for the request client, and one request client cannot fully occupy all the resources of the resource provider, thereby avoiding the occurrence of deadlock. And the resource quota of each request end is dynamically adjusted according to the difference information between the resource demand of the request end and the resource quota, so that the low resource request efficiency of other request ends caused by excessively reserving quotas for part of request ends is avoided, and the resource utilization rate and the system efficiency are improved.
Fig. 6 is a block diagram illustrating a resource request apparatus of a distributed system according to an embodiment of the present application. As shown in fig. 6, the apparatus 600 may include:
an initial allocation module 601, configured to allocate resource quotas to multiple request ends in a distributed system;
a request receiving module 602, configured to receive resource request information sent by a first request end in multiple request ends;
a first obtaining module 603, configured to obtain a resource request amount of a first request end according to the resource request information, where the resource request amount is the resource request amount when the resource request amount of the first request end is less than or equal to a resource quota corresponding to the first request end; under the condition that the resource demand of the first request end is larger than the resource quota corresponding to the first request end, the resource demand is the resource quota;
a resource providing module 604, configured to provide a resource of a resource request amount for a first request end, and obtain a first difference between a resource demand amount of the first request end and a corresponding resource quota;
a reallocation module 605, configured to reallocate the resource quotas for the multiple requesting terminals according to the first difference.
For the functions of each module in each device in the embodiment of the present application, reference may be made to the corresponding description in the above method, and details are not repeated here
In one embodiment, the resource request information includes a resource request amount and a first deficit. The apparatus 600 further comprises:
and the quota informing module is used for sending the information of the allocated resource quota to the plurality of request ends so that the plurality of request ends determine a first difference and a resource request amount according to the resource demand amount of the plurality of request ends and the corresponding resource quota.
In one embodiment, the apparatus 600 further comprises:
the redistribution judgment module is used for determining whether a preset quota redistribution condition is met, and if the preset quota redistribution condition is met, redistributing the resource quotas for the plurality of request ends according to the first difference;
wherein the preset quota redistribution condition comprises at least one of the following conditions:
the first difference corresponding to the multiple request ends reaches a preset threshold value;
the current time reaches a preset cycle time node;
disconnecting the connection with any request end in the plurality of request ends;
and establishing connection with any request terminal in the distributed system.
In one embodiment, as shown in the block diagram of the resource request device shown in fig. 7, the reallocation module 605 includes:
a total recovery amount calculation unit 701 configured to calculate a total amount of resource quotas that can be recovered from the resource quotas already allocated by the multiple request terminals;
a pre-allocation unit 702, configured to calculate a to-be-allocated resource quota for each request end according to the total resource quota and a first difference corresponding to each request end in the multiple request ends;
the quota validating unit 703 recovers or increases the resource quota of each request end according to the to-be-allocated resource quota of each request end, so that each request end is allocated to the to-be-allocated resource quota.
In one embodiment, the total recovery amount calculation unit 701 includes:
and the proportion recovery unit is used for calculating the resource quota which can be recovered from each request end according to the allocated resource quota of each request end in the plurality of request ends and a preset recovery proportion so as to obtain the total amount of the resource quota which can be recovered from the plurality of request ends.
In one embodiment, the total recovery amount calculation unit 701 includes:
the recovery calculation subunit is used for calculating a second difference between the allocated resource quota of each request end in the plurality of request ends and a preset reserved quota;
and the total amount operator unit is used for calculating the sum of the second difference corresponding to the plurality of request ends so as to obtain the total amount of the resource quotas which can be recovered from the plurality of request ends.
In one embodiment, the resource quotas that can be reclaimed from each of the plurality of requestors are equal.
In one embodiment, pre-allocation unit 702 includes:
a difference sum calculating subunit, configured to calculate a sum of first differences corresponding to the plurality of request terminals;
and the first allocating subunit is used for calculating the to-be-allocated resource quota of each request end according to the proportion between the first difference corresponding to each request end in the plurality of request ends and the sum of the first differences and the total amount of the resource quota.
In one embodiment, pre-allocation unit 702 includes:
the difference level determining subunit is used for determining the difference level corresponding to each request end according to the first difference corresponding to each request end in the plurality of request ends;
the distribution weight determining subunit is used for determining the distribution weight of each request end according to the difference level corresponding to each request end; the balance level and the distribution weight have a preset mapping relation;
a weight sum calculating subunit, configured to calculate a sum of the assigned weights of the plurality of request terminals;
and the second allocation subunit is used for calculating the resource quota to be allocated of each request end according to the proportion between the allocation weight of each request end and the sum of the allocation weights and the total amount of the resource quota.
In one embodiment, the quota validating unit 703 includes:
the judging subunit is configured to determine, for a second request peer of the multiple request peers, a size relationship between a to-be-allocated resource quota of the second request peer and an allocated resource quota;
the recovery subunit is used for notifying the second request end to recover the resource quota of the second request end under the condition that the resource quota to be allocated of the second request end is smaller than the allocated resource quota;
and the increasing subunit is configured to increase the resource quota of the second request end when the to-be-allocated resource quota of the second request end is greater than or equal to the already-allocated resource quota.
In one embodiment, the add subunit is specifically configured to:
if the resource quota which is not distributed currently is larger than or equal to the third difference, extracting the third difference from the resource quota which is not distributed currently and adding the third difference to the resource quota of the second request end; the third difference is the difference between the resource quota to be allocated of the second request end and the reserved quota of the second request end;
and if the resource quota which is not currently allocated is smaller than the third difference, all the resource quota which is not currently allocated is allocated to the second request end, and the second request end is added into the quota waiting list.
In one embodiment, the quota validating subunit 703 further includes:
a feedback determining unit, configured to determine, according to feedback information sent by the second request end, a resource quota recovered from the second request end;
and the third allocating subunit is configured to allocate the resource quota to one or more request ends in the quota waiting list by using the resource quota recovered from the second request end.
Fig. 8 is a block diagram illustrating a resource request apparatus of a distributed system according to an embodiment of the present application. As shown in fig. 8, the apparatus 800 may include:
a quota receiving module 801, configured to receive a resource quota allocated by a resource provider; wherein the resource quota is less than the total resource amount of the resource provider;
a first quantitative module 802, configured to determine, when a resource demand of the first quantitative module is less than or equal to a resource quota, that the resource request is the resource demand;
a second quantifying module 803, configured to determine, when the resource demand is greater than the resource quota, that the resource demand is the resource quota;
a second obtaining module 804, configured to obtain a first difference between the resource request amount and the resource quota;
the request sending module 805 is configured to send resource request information to the resource providing end, where the resource request information includes a resource request amount and a first difference, and the resource request information is used to enable the resource providing end to provide resources of the resource request amount, and reallocate resource quotas for multiple requesting ends connected to the resource providing end according to the first difference.
Fig. 9 shows a block diagram of an apparatus according to an embodiment of the present application. As shown in fig. 9, the apparatus includes: a memory 910 and a processor 920, the memory 910 having stored therein computer programs operable on the processor 920. The processor 920, when executing the computer program, implements the methods in the embodiments described above. The number of the memory 910 and the processor 920 may be one or more.
The apparatus further comprises:
and a communication interface 930 for communicating with an external device to perform data interactive transmission.
If the memory 910, the processor 920 and the communication interface 930 are implemented independently, the memory 910, the processor 920 and the communication interface 930 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (enhanced Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
Optionally, in an implementation, if the memory 910, the processor 920 and the communication interface 930 are integrated on a chip, the memory 910, the processor 920 and the communication interface 930 may complete communication with each other through an internal interface.
Embodiments of the present application provide a computer-readable storage medium, which stores a computer program, and when the program is executed by a processor, the computer program implements the method provided in the embodiments of the present application.
The embodiment of the present application further provides a chip, where the chip includes a processor, and is configured to call and execute the instruction stored in the memory from the memory, so that the communication device in which the chip is installed executes the method provided in the embodiment of the present application.
An embodiment of the present application further provides a chip, including: the system comprises an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected through an internal connection path, the processor is used for executing codes in the memory, and when the codes are executed, the processor is used for executing the method provided by the embodiment of the application.
It should be understood that the processor may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor or the like. It is noted that the processor may be an advanced reduced instruction set machine (ARM) architecture supported processor.
Further, optionally, the memory may include a read-only memory and a random access memory, and may further include a nonvolatile random access memory. The memory may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may include a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available. For example, Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct memory bus RAM (DR RAM).
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the present application are generated in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process. And the scope of the preferred embodiments of the present application includes other implementations in which functions may be performed out of the order shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the method of the above embodiments may be implemented by hardware that is configured to be instructed to perform the relevant steps by a program, which may be stored in a computer-readable storage medium, and which, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module may also be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. The storage medium may be a read-only memory, a magnetic or optical disk, or the like.
While the present invention has been described with reference to the preferred embodiments, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (17)

1. A method for allocating resources of a distributed system, comprising:
allocating resource quotas for a plurality of request terminals in the distributed system;
receiving resource request information sent by a first request terminal in the plurality of request terminals;
acquiring the resource request quantity of the first request terminal according to the resource request information; when the resource demand of the first request end is less than or equal to the resource quota corresponding to the first request end, the resource demand is the resource demand; under the condition that the resource demand of the first request end is greater than the resource quota corresponding to the first request end, the resource demand is the resource quota;
providing the resource of the resource request amount for the first request end, and acquiring a first difference between the resource demand amount of the first request end and the corresponding resource quota;
and reallocating resource quotas for the plurality of request ends according to the first difference.
2. The method of claim 1, wherein the resource request information comprises the resource request amount and the first deficit;
after the allocating resource quotas for the plurality of requesters in the distributed system, the method further comprises:
and sending the information of the allocated resource quotas to the plurality of request ends, so that the plurality of request ends determine the first difference and the resource request amount according to the resource demand amount of the request ends and the corresponding resource quotas.
3. The method of claim 1, wherein before reallocating resource quotas for the plurality of requestors according to the first deficit, the method further comprises:
determining whether a preset quota redistribution condition is met, and if the preset quota redistribution condition is met, redistributing resource quotas for the plurality of request ends according to the first difference;
wherein the preset quota redistribution condition comprises at least one of the following conditions:
the first difference corresponding to the plurality of request ends reaches a preset threshold value;
the current time reaches a preset cycle time node;
disconnecting from any one of the plurality of request terminals;
and establishing connection with any request terminal in the distributed system.
4. The method according to any of claims 1 to 3, wherein said reallocating resource quotas for the plurality of requesters according to the first deficit comprises:
calculating the total amount of the resource quotas which can be recovered from the resource quotas allocated to the plurality of requesting terminals;
respectively calculating the resource quota to be allocated of each request end according to the total resource quota and the first difference corresponding to each request end in the plurality of request ends;
and recovering or increasing the resource quota of each request end according to the resource quota to be allocated of each request end, so that each request end is allocated to the resource quota to be allocated.
5. The method of claim 4, wherein the calculating a total amount of resource quotas that can be reclaimed from the resource quotas already allocated to the plurality of requesters comprises:
and calculating the resource quota which can be recovered from each request end according to the allocated resource quota of each request end in the plurality of request ends and a preset recovery proportion so as to obtain the total amount of the resource quota which can be recovered from the plurality of request ends.
6. The method of claim 4, wherein the calculating a total amount of resource quotas that can be reclaimed from the resource quotas already allocated to the plurality of requesters comprises:
calculating a second difference between the allocated resource quota of each request end in the plurality of request ends and a preset reserved quota;
and calculating the sum of the second differences corresponding to the plurality of request terminals to obtain the total amount of the resource quotas which can be recovered from the plurality of request terminals.
7. The method of claim 4, wherein the resource quotas that can be reclaimed from each of the plurality of requestors are equal.
8. The method according to claim 4, wherein the calculating the to-be-allocated resource quota of each request end according to the total resource quota and the first difference corresponding to each request end in the plurality of request ends respectively comprises:
calculating the sum of first differences corresponding to the plurality of request ends;
and calculating the to-be-allocated resource quota of each request end according to the proportion between the first difference corresponding to each request end in the plurality of request ends and the sum of the first differences and the total amount of the resource quota.
9. The method according to claim 4, wherein the calculating the to-be-allocated resource quota of each request end according to the total resource quota and the first difference corresponding to each request end in the plurality of request ends respectively comprises:
determining a difference level corresponding to each request end according to a first difference corresponding to each request end in the plurality of request ends;
determining the distribution weight of each request end according to the difference level corresponding to each request end; wherein the difference level and the distribution weight have a preset mapping relation;
calculating the sum of the distribution weights of the plurality of request ends;
and calculating the resource quota to be allocated of each request end according to the proportion between the allocation weight of each request end and the sum of the allocation weights and the total amount of the resource quota.
10. The method according to claim 4, wherein the recovering or increasing the resource quota of each request end according to the resource quota to be allocated of each request end comprises:
for a second request end in the plurality of request ends, determining the size relationship between the resource quota to be allocated and the resource quota already allocated of the second request end;
under the condition that the resource quota to be allocated of the second request end is smaller than the allocated resource quota, the second request end is informed to recover the resource quota;
and under the condition that the to-be-allocated resource quota of the second request end is greater than or equal to the already-allocated resource quota, increasing the resource quota of the second request end.
11. The method of claim 10, wherein increasing the resource quota of the second requester comprises:
if the resource quota which is not distributed currently is larger than or equal to a third difference, extracting the third difference from the resource quota which is not distributed currently and adding the third difference to the resource quota of the second request end; the third difference is a difference between the resource quota to be allocated of the second request end and the reserved quota of the second request end;
and if the resource quota which is not currently allocated is smaller than the third difference, all the resource quota which is not currently allocated is allocated to the second request end, and the second request end is added into a quota waiting list.
12. The method of claim 11, wherein after notifying the second requester to reclaim its resource quota, the method further comprises:
determining a resource quota recovered from the second request end according to the feedback information sent by the second request end;
and allocating resource quotas for one or more requesters in the quota waiting list by using the resource quotas recovered from the second requester.
13. A resource request method of a distributed system is characterized by comprising the following steps:
receiving a resource quota distributed by a resource provider; wherein the resource quota is less than the total amount of resources of the resource provider;
determining the resource request quantity as the resource demand quantity under the condition that the resource demand quantity of the self is less than or equal to the resource quota;
determining the resource request amount as the resource quota under the condition that the resource request amount is larger than the resource quota;
acquiring a first difference between the resource request amount and the resource quota;
sending resource request information to the resource provider, where the resource request information includes the resource request amount and the first difference, and the resource request information is used to enable the resource provider to provide the resource of the resource request amount, and reallocate resource quotas to multiple request clients connected to the resource provider according to the first difference.
14. A resource request apparatus for a distributed system, comprising:
the system comprises an initial allocation module, a resource quota allocation module and a resource quota allocation module, wherein the initial allocation module is used for allocating resource quotas to a plurality of request ends in a distributed system;
a request receiving module, configured to receive resource request information sent by a first request end of the multiple request ends;
a first obtaining module, configured to obtain a resource request amount of the first request end according to the resource request information, where the resource request amount is the resource request amount when a resource demand amount of the first request end is less than or equal to a resource quota corresponding to the first request end; under the condition that the resource demand of the first request end is greater than the resource quota corresponding to the first request end, the resource demand is the resource quota;
a resource providing module, configured to provide the resource of the resource request amount for the first request end, and obtain a first difference between the resource demand amount of the first request end and the corresponding resource quota;
and the reallocation module is used for reallocating the resource quotas for the plurality of request ends according to the first difference.
15. A resource request apparatus for a distributed system, comprising:
a quota receiving module, configured to receive a resource quota allocated by a resource provider; wherein the resource quota is less than the total amount of resources of the resource provider;
the first quantitative module is used for determining the resource request quantity as the resource demand quantity under the condition that the resource demand quantity of the first quantitative module is less than or equal to the resource quota;
a second quantitative module, configured to determine, when the resource demand is greater than the resource quota, that the resource request amount is the resource quota;
a second obtaining module, configured to obtain a first difference between the resource request amount and the resource quota;
a request sending module, configured to send resource request information to the resource provider, where the resource request information includes the resource request amount and the first difference, and the resource request information is used to enable the resource provider to provide the resource of the resource request amount, and reallocate a resource quota for multiple request clients connected to the resource provider according to the first difference.
16. An apparatus, comprising: comprising a processor and a memory, said memory having stored therein instructions that are loaded and executed by the processor to implement the method of any of claims 1 to 13.
17. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-13.
CN201911158069.6A 2019-11-22 2019-11-22 Resource request method, device, equipment and storage medium of distributed system Pending CN111045819A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911158069.6A CN111045819A (en) 2019-11-22 2019-11-22 Resource request method, device, equipment and storage medium of distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911158069.6A CN111045819A (en) 2019-11-22 2019-11-22 Resource request method, device, equipment and storage medium of distributed system

Publications (1)

Publication Number Publication Date
CN111045819A true CN111045819A (en) 2020-04-21

Family

ID=70233154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911158069.6A Pending CN111045819A (en) 2019-11-22 2019-11-22 Resource request method, device, equipment and storage medium of distributed system

Country Status (1)

Country Link
CN (1) CN111045819A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113886078A (en) * 2021-09-28 2022-01-04 江苏安超云软件有限公司 Method and application for realizing quota unified management based on dynamic threshold mechanism
CN117369891A (en) * 2023-12-06 2024-01-09 苏州元脑智能科技有限公司 Method and device for starting and running server, server and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468755A (en) * 2014-11-27 2015-03-25 中国联合网络通信集团有限公司 Method and device capable of achieving application performance guarantee

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468755A (en) * 2014-11-27 2015-03-25 中国联合网络通信集团有限公司 Method and device capable of achieving application performance guarantee

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113886078A (en) * 2021-09-28 2022-01-04 江苏安超云软件有限公司 Method and application for realizing quota unified management based on dynamic threshold mechanism
CN117369891A (en) * 2023-12-06 2024-01-09 苏州元脑智能科技有限公司 Method and device for starting and running server, server and storage medium
CN117369891B (en) * 2023-12-06 2024-02-27 苏州元脑智能科技有限公司 Method and device for starting and running server, server and storage medium

Similar Documents

Publication Publication Date Title
US10361928B2 (en) Cluster instance management system
US10810045B2 (en) Method and apparatus for allocating central processing unit (CPU) resources in a default resource pool
CN108667748B (en) Method, device, equipment and storage medium for controlling bandwidth
US20150234670A1 (en) Management apparatus and workload distribution management method
US7698529B2 (en) Method for trading resources between partitions of a data processing system
US20090055835A1 (en) System and Method for Managing License Capacity in a Telecommunication Network
WO2011142031A1 (en) Resource management method, resource management device and program
JP2004021982A (en) Method and system for dynamically allocating computer system resource
KR101696698B1 (en) Distribution and management method of components having reliance
CN114780225B (en) Distributed model training system, method and device
CN110750336B (en) OpenStack virtual machine memory hot-expanding method
CN107343023B (en) Resource allocation method and device in Mesos management cluster and electronic equipment
CN109587220B (en) Load balancing method and device, computer equipment and storage medium
WO2019170011A1 (en) Task allocation method and device, and distributed storage system
CN111045819A (en) Resource request method, device, equipment and storage medium of distributed system
CN104158841A (en) Computing resource allocation method
US9563532B1 (en) Allocation of tasks in large scale computing systems
CN112163734B (en) Cloud platform-based setting computing resource dynamic scheduling method and device
CN115794396A (en) Resource allocation method, system and electronic equipment
CN111813564B (en) Cluster resource management method and device and container cluster management system
CN115168017A (en) Task scheduling cloud platform and task scheduling method thereof
CN111352710A (en) Process management method and device, computing equipment and storage medium
CN115442369B (en) Service resource scheduling method and device, storage medium and electronic equipment
CN115794305B (en) Method and device for adjusting memory of virtual machine, storage medium and electronic device
US11803414B2 (en) Diagonal autoscaling of serverless computing processes for reduced downtime

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination