Movatterモバイル変換


[0]ホーム

URL:


CN111258751A - Method, device and medium for controlling resource access - Google Patents

Method, device and medium for controlling resource access
Download PDF

Info

Publication number
CN111258751A
CN111258751ACN202010016711.3ACN202010016711ACN111258751ACN 111258751 ACN111258751 ACN 111258751ACN 202010016711 ACN202010016711 ACN 202010016711ACN 111258751 ACN111258751 ACN 111258751A
Authority
CN
China
Prior art keywords
resource
amount corresponding
type
target operation
resource type
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
CN202010016711.3A
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 Xiaomi Pinecone Electronic Co Ltd
Original Assignee
Beijing Pinecone Electronics 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 Pinecone Electronics Co LtdfiledCriticalBeijing Pinecone Electronics Co Ltd
Priority to CN202010016711.3ApriorityCriticalpatent/CN111258751A/en
Publication of CN111258751ApublicationCriticalpatent/CN111258751A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Disclosed herein are a method, apparatus, and medium for controlling resource access, the method comprising: receiving a resource request; determining a target operation to which a task initiating the resource request belongs; and determining the resource allocation state of the target operation, and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request. The granularity of resource control is thinned to the job level, when the same user submits a plurality of jobs, one job does not accord with the set resource allocation condition and other jobs of the user cannot be influenced after the execution fails, so that the jobs of the user are processed smoothly as much as possible, and the job processing efficiency is improved.

Description

Method, device and medium for controlling resource access
Technical Field
The present disclosure relates to the field of network data processing technologies, and in particular, to a method, an apparatus, and a medium for controlling resource access.
Background
There is a need in the art for a distributed computing system that allows for the control of resource access to prevent overloading of the system. In a conventional server design, throttling (thrott l e) control is generally performed according to users or clients, for example, to limit the capacity that can be used by a certain user or to limit the capacity that can be used by each client. When one job has excessive resource access and other jobs have normal access, resource access limitation is performed according to the user, so that the user cannot perform any job processing, and the jobs with normal access in the user cannot normally run.
Disclosure of Invention
To overcome the problems in the related art, a method, apparatus, and medium for controlling resource access are provided.
According to a first aspect of embodiments herein, there is provided a method for controlling resource access, applied to a distributed system, including:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
In another embodiment, the resource allocation status of the target job comprises at least one of:
the resource occupation amount corresponding to each resource type of the target operation, the resource available amount corresponding to each resource type of the target operation and the resource application amount corresponding to each resource type in the resource request are calculated;
the resource occupation amount corresponding to each resource type of the target operation is the sum of the resource occupation amounts corresponding to the corresponding resource types of all the tasks under the target operation;
and the resource available amount corresponding to each resource type of the target operation is the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
In another embodiment, the setting of the resource allocation condition includes at least one of:
the sum of the resource occupation amount corresponding to one resource type of the target operation and the resource application amount corresponding to the same resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
a resource occupation amount corresponding to a resource type of the target job is less than or equal to a first proportion of a resource quota amount corresponding to the same resource type of the target job, and the first proportion is less than 1 and greater than 0;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource available amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource available amount corresponding to a resource type of the target job is greater than or equal to a second proportion of the resource quota amount corresponding to the same resource type of the target job, and the second proportion is less than 1 and greater than 0.
In another embodiment, the determining the resource allocation status of the target job comprises at least one of:
calculating the resource occupation amount corresponding to each resource type of the target operation;
calculating the resource available quantity corresponding to each resource type of the target operation;
the calculating the resource occupation amount corresponding to each resource type of the target operation comprises the following steps:
acquiring a one-to-many mapping relation between the target operation and all tasks under the target operation;
determining all tasks under the target operation according to the one-to-many mapping relation;
calculating the sum of the resource occupation amounts corresponding to the same resource types of all tasks under the target operation;
the calculating the resource available amount corresponding to each resource type of the target job includes:
and calculating the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
In another embodiment, the method further comprises:
acquiring the resource occupation amount of each resource type of all jobs of a user in a set historical time period;
calculating the reference resource occupation amount of each resource type of the user according to the resource occupation amounts of all the jobs of the user in each resource type in a set historical time period;
and setting the resource quota amount of each resource type corresponding to the operation of the user as the reference resource occupation amount of the corresponding resource type of the user.
In another embodiment, the method further comprises:
detecting a user priority of a user;
and when the user priority of the user changes, adjusting the resource quota amount of each resource type corresponding to the operation of the user according to the user priority change amplitude of the user.
According to a second aspect of the embodiments herein, there is further provided an apparatus for controlling resource access, which is applied to a distributed system, and includes:
a receiving module, configured to receive a resource request;
the first determining module is used for determining a target job to which a task initiating the resource request belongs;
a second determination module for determining a resource allocation status of the target job;
and the control module is used for refusing the resource request when the resource allocation state does not accord with the set resource allocation condition.
In another embodiment, the resource allocation status of the target job comprises at least one of:
the resource occupation amount corresponding to each resource type of the target operation, the resource available amount corresponding to each resource type of the target operation and the resource application amount corresponding to each resource type in the resource request are calculated;
the resource occupation amount corresponding to each resource type of the target operation is the sum of the resource occupation amounts corresponding to the corresponding resource types of all the tasks under the target operation;
and the resource available amount corresponding to each resource type of the target operation is the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
In another embodiment, the setting of the resource allocation condition includes at least one of:
the sum of the resource occupation amount corresponding to one resource type of the target operation and the resource application amount corresponding to the same resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
a resource occupation amount corresponding to a resource type of the target job is less than or equal to a first proportion of a resource quota amount corresponding to the same resource type of the target job, and the first proportion is less than 1 and greater than 0;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource available amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource available amount corresponding to a resource type of the target job is greater than or equal to a second proportion of the resource quota amount corresponding to the same resource type of the target job, and the second proportion is less than 1 and greater than 0.
In another embodiment, the second determining module comprises at least one of:
the first calculation module is used for calculating the resource occupation amount corresponding to each resource type of the target operation;
the second calculation module is used for calculating the resource available amount corresponding to each resource type of the target operation;
the first computing module includes:
the first acquisition module is used for acquiring the one-to-many mapping relation between the target operation and all tasks under the target operation;
a third determining module, configured to determine all tasks under the target operation according to the one-to-many mapping relationship;
the third calculation module is used for calculating the sum of the resource occupation amounts corresponding to the same resource types of all the tasks under the target operation;
the second calculation module includes:
and the fourth calculation module is used for calculating the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
In another embodiment, the apparatus further comprises:
the second acquisition module is used for acquiring the resource occupation amount of each resource type of all the jobs of the user in a set historical time period;
the fifth calculation module is used for calculating the reference resource occupation amount of each resource type of the user according to the resource occupation amounts of all the resource types of all the jobs of the user in a set historical time period;
and the setting module is used for setting the resource quota of each resource type corresponding to the operation of the user as the reference resource occupation amount of the corresponding resource type of the user.
In another embodiment, the apparatus further comprises:
the detection module is used for detecting the user priority of the user;
and the adjusting module is used for adjusting the resource quota amount of each resource type corresponding to the operation of the user according to the user priority change amplitude of the user when the user priority of the user changes.
According to a third aspect of embodiments herein, there is also provided an apparatus for controlling resource access, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
According to a fourth aspect of embodiments herein, there is also provided a non-transitory computer readable storage medium having instructions which, when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of controlling access to resources, the method comprising:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
The technical solutions provided by the embodiments herein may include the following beneficial effects: the resource allocation state of the target operation is determined after the resource request is received, when the resource allocation state does not accord with the set resource allocation condition, the resource request is rejected, so that the granularity of resource control is refined to the operation level, when the same user submits a plurality of operations, one of the operations does not accord with the set resource allocation condition, and other operations of the user cannot be influenced after the execution fails, so that the user can smoothly process as many operations as possible, and the operation processing efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow diagram illustrating a method of controlling resource access in accordance with an exemplary embodiment;
FIG. 2 is a system block diagram illustrating a method for application controlled resource access in accordance with an exemplary embodiment;
FIG. 3 is a flow diagram illustrating a method of controlling resource access in accordance with an exemplary embodiment;
FIG. 4 is a flow diagram illustrating a method of controlling resource access in accordance with an exemplary embodiment;
FIG. 5 is a flow diagram illustrating a method of controlling resource access in accordance with an exemplary embodiment;
FIG. 6 is a block diagram illustrating an apparatus for controlling access to resources in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating an apparatus for controlling access to resources in accordance with an exemplary embodiment;
FIG. 8 is a block diagram illustrating an apparatus for controlling access to resources in accordance with an exemplary embodiment;
FIG. 9 is a block diagram illustrating an apparatus for controlling access to resources in accordance with an exemplary embodiment;
fig. 10 is a block diagram illustrating an apparatus for controlling resource access in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects herein, as detailed in the appended claims.
The embodiment of the disclosure provides a method for controlling resource access. Referring to FIG. 1, FIG. 1 is a flow diagram illustrating a method of controlling resource access in accordance with an exemplary embodiment. The method is applied to a distributed system, and as shown in fig. 1, the method comprises the following steps:
in step S11, a resource request is received.
Step S12, determine the target job to which the task that initiated the resource request belongs.
In step S13, the resource allocation status of the target job is determined.
Step S14, if the resource allocation status does not meet the set resource allocation condition, rejecting the resource request.
In another embodiment, in step S14, if the resource allocation status meets the set resource allocation condition, the resource request is allowed.
The method comprises the steps of determining the resource allocation state of a target operation after receiving a resource request, rejecting the resource request when the resource allocation state does not accord with a set resource allocation condition, thereby refining the granularity of resource control to an operation level, and when a plurality of operations are submitted by a same user, one of the operations does not accord with the set resource allocation condition and other operations of the user cannot be influenced after the execution fails, so that the user can smoothly process as many operations as possible, and the operation processing efficiency is improved.
Fig. 2 is a system block diagram illustrating a method for controlling resource access by an application in accordance with an exemplary embodiment. The resource control center in fig. 2 is used to perform the above-described method. The resource control center may be a separate device or a function running in the master node. In the system, a client for serving a user submits a plurality of jobs of the user to a master node of a computer cluster, the master node decomposes each job into a plurality of tasks to be scheduled to a plurality of slave nodes in the computer cluster, the slave nodes submit resource requests to a resource control center before executing the tasks, and the resource control center allows or rejects the resource requests according to the method. After the resource control center allows the resource request, the slave node executes the corresponding task, and the resource pool records the resource amount of each resource type consumed by each task and reports the resource amount to the resource control center. After the resource control center refuses the resource request, the corresponding task fails to execute, or the task is paused for a period of time and then the resource request is reinitiated.
The embodiment of the disclosure also provides a method for controlling resource access. In this method, the resource allocation status of the target job includes at least one of:
the resource occupation amount corresponding to each resource type of the target operation, the resource available amount corresponding to each resource type of the target operation and the resource application amount corresponding to each resource type in the resource request;
the resource occupation amount corresponding to each resource type of the target operation is the sum of the resource occupation amounts corresponding to the corresponding resource types of all the tasks under the target operation; the resource available amount corresponding to each resource type of the target operation is the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
The embodiment of the disclosure also provides a method for controlling resource access. Referring to fig. 3, fig. 3 is a flow diagram illustrating a method of controlling resource access in accordance with an example embodiment. In this method, step S13 in fig. 1 further includes a process of calculating a resource occupation amount corresponding to each resource type of the target job, where the process includes:
step S31, acquiring a one-to-many mapping relation between the target operation and all tasks under the target operation;
step S32, determining all tasks under the target operation according to the one-to-many mapping relation;
step S33, calculating the sum of the occupied resource amounts corresponding to the same resource type of all tasks under the target job.
When the resource control center is an independent device with the main node, the resource control center obtains the one-to-many mapping relation between the target operation and all tasks under the target operation from the main node. When the resource control center is a function running on the main node, the one-to-many mapping relation between the target job and all tasks under the target job is obtained from the job scheduling function of the main node.
In another embodiment, step S13 of fig. 1 further includes a process of calculating a resource availability corresponding to each resource type of the target job, where the process includes step S34: and calculating the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation, and obtaining the resource available amount corresponding to each resource type of the target operation.
The embodiment of the disclosure also provides a method for controlling resource access. In the method, setting the resource allocation condition includes at least one of:
under the condition one, the sum of the resource occupation amount corresponding to one resource type of the target operation and the resource application amount corresponding to the same resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
under the second condition, the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
a third condition is that the resource occupation amount corresponding to one resource type of the target operation is less than or equal to a first proportion of the resource quota amount corresponding to the same resource type of the target operation, and the first proportion is less than 1 and greater than 0;
the resource application amount corresponding to one resource type in the resource request is smaller than or equal to the resource available amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is smaller than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the sixth condition is that the available resource amount corresponding to a resource type of the target job is greater than or equal to a second proportion of the resource quota amount corresponding to the same resource type of the target job, and the second proportion is less than 1 and greater than 0.
In the method, the resource allocation condition may be configured and set by the administrator device, for example, the first configuration condition is the set resource allocation condition, for example, the second configuration condition is the set resource allocation condition, for example, the set of the first configuration condition and the second configuration condition is the set resource allocation condition, and so on.
The resource type in the method comprises at least one of the following: CPU usage (e.g., percentage of usage), memory resources, storage resources, network bandwidth, and various other resources that may be used in the network in addition to the types of resources described above.
Examples are as follows:
example one
User 1 initiates two jobs, specificallyjob 1 and job 2.
Thejob 1 includes 4 tasks, specifically,task 1, task 2, task 3, and task 4, and the resource usage of each task is shown in table 1:
TABLE 1
Figure BDA0002359163350000101
The slave node executing the task 4 initiates a resource request related to the task 4, wherein the resource request comprises: the resource application amount of the CPU resource percentage type is 12%, and the resource application amount of the memory resource is 100M.
The set resource allocation condition comprises a first condition, when thejob 1 is judged to be in accordance with the set resource allocation condition, according to the first condition, the sum of the resource occupation amount (12%) of the CPU resource percentage type of thejob 1 and the resource application amount (5%) of the CPU resource percentage type is 17% and is greater than the resource quota (10%) of the corresponding type, so that thejob 1 is judged to be in accordance with the set resource allocation condition.
And setting a resource allocation condition comprising a second condition, and judging whether thejob 1 meets the set resource allocation condition, wherein according to the second condition, the resource application amount (12%) of the CPU resource percentage type is greater than the quota amount (10%) of the CPU resource percentage type in the resource quota of thejob 1, so that thejob 1 is judged not to meet the set resource allocation condition.
And when the set resource allocation condition comprises a third condition, judging whether thejob 1 meets the set resource allocation condition, according to the third condition, the resource occupation amount (8%) corresponding to the CPU resource percentage type of thejob 1 is greater than the first proportion (7%) of the quota amount corresponding to the same resource type in the resource quota (10%) of thejob 1, so that thejob 1 is judged not to meet the set resource allocation condition.
Based on the determination thatjob 1 does not meet the set resource allocation condition, the resource request is rejected, task 4 ofjob 1 will fail to execute, and job 4 may also fail to execute, but job 2 still runs normally.
Example two:
user 1 initiates two jobs, specificallyjob 1 and job 2.
Job 1 includes 4 tasks, specificallytask 1, task 2, task 3, and task 4, and the resource usage of each task is shown in table 1.
The slave node executing the task 4 initiates a resource request of the task 4, wherein the resource request comprises: the resource application amount of the CPU resource percentage type is 12%, and the resource application amount of the memory resource is 100M.
Calculating the resource available quantity corresponding to each resource type of thejob 1 according to the quota quantity corresponding to each resource type of thejob 1, and obtaining the results shown in table 2:
TABLE 2
Figure BDA0002359163350000111
Figure BDA0002359163350000121
And setting a resource allocation condition comprising a condition four, and when judging whether thejob 1 meets the set resource allocation condition, according to the condition four, judging that thejob 1 does not meet the set resource allocation condition because the resource application amount (12%) of the CPU resource percentage type of thejob 1 is greater than the resource available amount (10%) of the CPU resource percentage type in the resource quota of thejob 1.
And when judging whether thejob 1 meets the set resource allocation condition, according to the condition five, the resource application amount (12%) of the CPU resource percentage type of thejob 1 is larger than the resource quota amount (2%) of the CPU resource percentage type in the resource quota of thejob 1, so that thejob 1 is judged not to meet the set resource allocation condition, and thejob 1 is judged not to meet the set resource allocation condition.
And when judging whether thejob 1 meets the set resource allocation condition, calculating the resource available quantity corresponding to each resource type of thejob 1 according to the quota quantity corresponding to each resource type of thejob 1 according to the condition six, and obtaining the result shown in the table 2. The resource available amount of the CPU resource percentage type ofjob 1, that is, 2%, is smaller than the second proportion (3%) of the quota amount of the CPU resource percentage type in the resource quota ofjob 1, that is, 10%, so it is determined thatjob 1 does not meet the set resource allocation condition.
Depending on the result of the determination, this resource request is denied and task 4 ofjob 1 will fail to execute, but job 2 will still run normally.
The embodiment of the disclosure also provides a method for controlling resource access. Referring to fig. 4, fig. 4 is a flow diagram illustrating a method of controlling resource access in accordance with an example embodiment. The method further includes a step S40 of adjusting the resource quota amount based on the method shown in fig. 1, where the step S40 specifically includes:
in step S41, the resource occupation amounts of the respective resource types of all jobs of the user within the set history period are acquired.
Step S42, determining the reference resource occupation amount of each resource type of the user according to the resource occupation amounts of each resource type of all the jobs of the user in the set history time period.
For example, an average value of the resource occupation amounts of all the jobs of the user in each resource type in the set history period is calculated, and the average resource occupation amount of each resource type is used as a reference resource occupation amount of the corresponding resource type.
For another example: and calculating the average value of the resource occupation amount of each resource type of all the jobs of the user in a set historical time period, and taking the weighted value of the average resource occupation amount of each resource type as the reference resource occupation amount of the corresponding resource type.
Step S43, setting the resource quota amount of each resource type corresponding to the job of the user as the reference resource occupation amount of the corresponding resource type of the user.
The embodiment of the disclosure also provides a method for controlling resource access. Referring to fig. 5, fig. 5 is a flow diagram illustrating a method of controlling resource access in accordance with an example embodiment. The method further includes a step S50 of adjusting the resource quota amount based on the method shown in fig. 1, where the step S50 specifically includes:
step S51, detecting the user priority of the user;
step S52, when the user priority of the user changes, adjusting the resource quota amount of each resource type corresponding to the job of the user according to the user priority change width of the user.
The embodiment of the disclosure also provides a device for controlling resource access. Referring to fig. 6, fig. 6 is a block diagram illustrating an apparatus for controlling resource access according to an example embodiment. As shown in fig. 6, the apparatus includes:
areceiving module 601, configured to receive a resource request;
a first determiningmodule 602, configured to determine a target job to which a task that initiates the resource request belongs;
a second determiningmodule 603, configured to determine a resource allocation status of the target job;
acontrol module 604, configured to reject the resource request when the resource allocation status does not meet the set resource allocation condition.
In another embodiment, the resource allocation status of the target job comprises at least one of:
the resource occupation amount corresponding to each resource type of the target operation, the resource available amount corresponding to each resource type of the target operation and the resource application amount corresponding to each resource type in the resource request are calculated;
the resource occupation amount corresponding to each resource type of the target operation is the sum of the resource occupation amounts corresponding to the corresponding resource types of all the tasks under the target operation;
and the resource available amount corresponding to each resource type of the target operation is the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
In another embodiment, the setting of the resource allocation condition includes at least one of:
under the condition one, the sum of the resource occupation amount corresponding to one resource type of the target job and the resource application amount corresponding to the same resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target job;
under the second condition, the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
a third condition is that the resource occupation amount corresponding to one resource type of the target job is less than or equal to a first proportion of the resource quota amount corresponding to the same resource type of the target job, and the first proportion is less than 1 and greater than 0;
a fourth condition is that the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource available amount corresponding to the same resource type of the target operation;
a fifth condition, that the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target job;
in a sixth condition, the available amount of resources corresponding to a resource type of the target job is greater than or equal to a second proportion of the quota amount of resources corresponding to the same resource type of the target job, where the second proportion is less than 1 and greater than 0.
The embodiment of the disclosure also provides a device for controlling resource access. Referring to fig. 7, fig. 7 is a block diagram illustrating an apparatus for controlling resource access according to an example embodiment. As shown in fig. 7, the second determiningmodule 603 in fig. 6 includes at least one of the following modules:
afirst calculating module 701, configured to calculate a resource occupation amount corresponding to each resource type of the target job;
asecond calculating module 702, configured to calculate resource availability corresponding to each resource type of the target job;
thefirst calculation module 701 includes:
a first obtainingmodule 703, configured to obtain a one-to-many mapping relationship between the target job and all tasks under the target job;
a third determiningmodule 704, configured to determine all tasks under the target job according to the one-to-many mapping relationship;
athird calculating module 705, configured to calculate a sum of resource occupancy amounts corresponding to the same resource types of all tasks under the target job;
thesecond calculation module 702 includes:
a fourth calculating module 706, configured to calculate a difference between the amount of the resource quota corresponding to each resource type of the target job and the resource occupation amount corresponding to the corresponding resource type of the target job.
The embodiment of the disclosure also provides a device for controlling resource access. Referring to fig. 8, fig. 8 is a block diagram illustrating an apparatus for controlling resource access according to an example embodiment. As shown in fig. 8, the apparatus further includes, on the basis of fig. 6:
a second obtainingmodule 801, configured to obtain resource occupancy amounts of all resource types of all jobs of a user in a set history time period;
afifth calculating module 802, configured to calculate, according to resource occupancy amounts of all resource types of all jobs of the user in a set historical time period, reference resource occupancy amounts of all resource types of the user;
thesetting module 803 is configured to set the resource quota of each resource type corresponding to the job of the user to the reference resource occupancy of each resource type of the user.
The embodiment of the disclosure also provides a device for controlling resource access. Referring to fig. 9, fig. 9 is a block diagram illustrating an apparatus for controlling resource access according to an example embodiment. As shown in fig. 9, the apparatus further includes, on the basis of fig. 6:
a detectingmodule 901, configured to detect a user priority of a user;
anadjusting module 902, configured to adjust, when a user priority of a user changes, a resource quota amount of each resource type corresponding to a job of the user according to the user priority change width of the user.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The embodiment of the present disclosure further provides a device for controlling resource access, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
Also provided in an embodiment of the present disclosure is a non-transitory computer-readable storage medium, wherein instructions, when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of controlling resource access, the method comprising:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job; and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
Fig. 10 is a block diagram illustrating anapparatus 1000 for controlling resource access in accordance with an example embodiment. For example, theapparatus 1000 may be provided as a server. Referring to fig. 10, theapparatus 1000 includes aprocessing component 1022 that further includes one or more processors and memory resources, represented bymemory 1032, for storing instructions, such as application programs, that are executable by theprocessing component 1022. The application programs stored inmemory 1032 may include one or more modules that each correspond to a set of instructions. Further, theprocessing component 1022 is configured to execute instructions to perform the above-described methods.
Thedevice 1000 may also include apower supply component 1026 configured to perform power management for thedevice 1000, a wired orwireless network interface 1050 configured to connect thedevice 1000 to a network, and an input/output (I/O) interface 1059. Theapparatus 1000 may operate based on an operating system stored inmemory 1032, such as a Wi ndows Server, MacOS XTM, UnixTM, Li nuxTM, FreeBSDTM, or the like.
Other embodiments of the invention herein will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles herein and including such departures from the present disclosure as come within known or customary practice in the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (14)

1. A method for controlling resource access is applied to a distributed system, and is characterized by comprising the following steps:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
2. The method of claim 1,
the resource allocation status of the target job comprises at least one of:
the resource occupation amount corresponding to each resource type of the target operation, the resource available amount corresponding to each resource type of the target operation and the resource application amount corresponding to each resource type in the resource request are calculated;
the resource occupation amount corresponding to each resource type of the target operation is the sum of the resource occupation amounts corresponding to the corresponding resource types of all the tasks under the target operation;
and the resource available amount corresponding to each resource type of the target operation is the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
3. The method of claim 2,
the set resource allocation condition includes at least one of:
the sum of the resource occupation amount corresponding to one resource type of the target operation and the resource application amount corresponding to the same resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
a resource occupation amount corresponding to a resource type of the target job is less than or equal to a first proportion of a resource quota amount corresponding to the same resource type of the target job, and the first proportion is less than 1 and greater than 0;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource available amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource available amount corresponding to a resource type of the target job is greater than or equal to a second proportion of the resource quota amount corresponding to the same resource type of the target job, and the second proportion is less than 1 and greater than 0.
4. The method of claim 2,
the determining the resource allocation status of the target job comprises at least one of:
calculating the resource occupation amount corresponding to each resource type of the target operation;
calculating the resource available quantity corresponding to each resource type of the target operation;
the calculating the resource occupation amount corresponding to each resource type of the target operation comprises the following steps:
acquiring a one-to-many mapping relation between the target operation and all tasks under the target operation;
determining all tasks under the target operation according to the one-to-many mapping relation;
calculating the sum of the resource occupation amounts corresponding to the same resource types of all tasks under the target operation;
the calculating the resource available amount corresponding to each resource type of the target job includes:
and calculating the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
5. The method of claim 1,
the method further comprises the following steps:
acquiring the resource occupation amount of each resource type of all jobs of a user in a set historical time period;
calculating the reference resource occupation amount of each resource type of the user according to the resource occupation amounts of all the jobs of the user in each resource type in a set historical time period;
and setting the resource quota amount of each resource type corresponding to the operation of the user as the reference resource occupation amount of the corresponding resource type of the user.
6. The method of claim 1,
the method further comprises the following steps:
detecting a user priority of a user;
and when the user priority of the user changes, adjusting the resource quota amount of each resource type corresponding to the operation of the user according to the user priority change amplitude of the user.
7. An apparatus for controlling resource access, applied to a distributed system, comprising:
a receiving module, configured to receive a resource request;
the first determining module is used for determining a target job to which a task initiating the resource request belongs;
a second determination module for determining a resource allocation status of the target job;
and the control module is used for refusing the resource request when the resource allocation state does not accord with the set resource allocation condition.
8. The apparatus of claim 7,
the resource allocation status of the target job comprises at least one of:
the resource occupation amount corresponding to each resource type of the target operation, the resource available amount corresponding to each resource type of the target operation and the resource application amount corresponding to each resource type in the resource request are calculated;
the resource occupation amount corresponding to each resource type of the target operation is the sum of the resource occupation amounts corresponding to the corresponding resource types of all the tasks under the target operation;
and the resource available amount corresponding to each resource type of the target operation is the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
9. The apparatus of claim 8,
the set resource allocation condition includes at least one of:
the sum of the resource occupation amount corresponding to one resource type of the target operation and the resource application amount corresponding to the same resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
a resource occupation amount corresponding to a resource type of the target job is less than or equal to a first proportion of a resource quota amount corresponding to the same resource type of the target job, and the first proportion is less than 1 and greater than 0;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource available amount corresponding to the same resource type of the target operation;
the resource application amount corresponding to a resource type in the resource request is less than or equal to the resource quota amount corresponding to the same resource type of the target operation;
the resource available amount corresponding to a resource type of the target job is greater than or equal to a second proportion of the resource quota amount corresponding to the same resource type of the target job, and the second proportion is less than 1 and greater than 0.
10. The apparatus of claim 8,
the second determination module comprises at least one of:
the first calculation module is used for calculating the resource occupation amount corresponding to each resource type of the target operation;
the second calculation module is used for calculating the resource available amount corresponding to each resource type of the target operation;
the first computing module includes:
the first acquisition module is used for acquiring the one-to-many mapping relation between the target operation and all tasks under the target operation;
a third determining module, configured to determine all tasks under the target operation according to the one-to-many mapping relationship;
the third calculation module is used for calculating the sum of the resource occupation amounts corresponding to the same resource types of all the tasks under the target operation;
the second calculation module includes:
and the fourth calculation module is used for calculating the difference between the resource quota amount corresponding to each resource type of the target operation and the resource occupation amount corresponding to the corresponding resource type of the target operation.
11. The apparatus of claim 7,
the device further comprises:
the second acquisition module is used for acquiring the resource occupation amount of each resource type of all the jobs of the user in a set historical time period;
the fifth calculation module is used for calculating the reference resource occupation amount of each resource type of the user according to the resource occupation amounts of all the resource types of all the jobs of the user in a set historical time period;
and the setting module is used for setting the resource quota of each resource type corresponding to the operation of the user as the reference resource occupation amount of the corresponding resource type of the user.
12. The apparatus of claim 7,
the device further comprises:
the detection module is used for detecting the user priority of the user;
and the adjusting module is used for adjusting the resource quota amount of each resource type corresponding to the operation of the user according to the user priority change amplitude of the user when the user priority of the user changes.
13. An apparatus for controlling access to a resource, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
14. A non-transitory computer readable storage medium having instructions therein which, when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of controlling access to resources, the method comprising:
receiving a resource request;
determining a target operation to which a task initiating the resource request belongs;
determining a resource allocation status of the target job;
and if the resource allocation state does not accord with the set resource allocation condition, rejecting the resource request.
CN202010016711.3A2020-01-082020-01-08Method, device and medium for controlling resource accessPendingCN111258751A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010016711.3ACN111258751A (en)2020-01-082020-01-08Method, device and medium for controlling resource access

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010016711.3ACN111258751A (en)2020-01-082020-01-08Method, device and medium for controlling resource access

Publications (1)

Publication NumberPublication Date
CN111258751Atrue CN111258751A (en)2020-06-09

Family

ID=70948589

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010016711.3APendingCN111258751A (en)2020-01-082020-01-08Method, device and medium for controlling resource access

Country Status (1)

CountryLink
CN (1)CN111258751A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113988582A (en)*2021-10-252022-01-28必要鸿源(北京)科技有限公司Ordering resource allocation method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20080103861A1 (en)*2006-04-272008-05-01International Business Machines CorporationFair share scheduling for mixed clusters with multiple resources
CN103369041A (en)*2013-07-092013-10-23北京奇虎科技有限公司Cloud-computing-based resource allocation method and device
WO2018192412A1 (en)*2017-04-182018-10-25腾讯科技(深圳)有限公司Method and device for processing resource request
CN110362409A (en)*2019-07-192019-10-22深圳前海微众银行股份有限公司Based on a plurality of types of resource allocation methods, device, equipment and storage medium
CN110532087A (en)*2018-05-242019-12-03阿里巴巴集团控股有限公司A kind of resource allocation methods, resource manager

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20080103861A1 (en)*2006-04-272008-05-01International Business Machines CorporationFair share scheduling for mixed clusters with multiple resources
CN103369041A (en)*2013-07-092013-10-23北京奇虎科技有限公司Cloud-computing-based resource allocation method and device
WO2018192412A1 (en)*2017-04-182018-10-25腾讯科技(深圳)有限公司Method and device for processing resource request
CN110532087A (en)*2018-05-242019-12-03阿里巴巴集团控股有限公司A kind of resource allocation methods, resource manager
CN110362409A (en)*2019-07-192019-10-22深圳前海微众银行股份有限公司Based on a plurality of types of resource allocation methods, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
林东岱;姜中华;: "一种网格资源优化分配方案"*

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113988582A (en)*2021-10-252022-01-28必要鸿源(北京)科技有限公司Ordering resource allocation method and device, storage medium and electronic equipment

Similar Documents

PublicationPublication DateTitle
CN112711479B (en) Server cluster load balancing system, method, device and storage medium
US7117499B2 (en)Virtual computer systems and computer virtualization programs
CN108710540B (en)Resource scheduling method, device and equipment in distributed cluster
Mekala et al.A DRL-based service offloading approach using DAG for edge computational orchestration
US8572621B2 (en)Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria
US11949737B1 (en)Allocation of server resources in remote-access computing environments
CN112181613B (en)Heterogeneous resource distributed computing platform batch task scheduling method and storage medium
CN111611050A (en)Information processing method, device, equipment and storage medium
US11438271B2 (en)Method, electronic device and computer program product of load balancing
CN111796933A (en)Resource scheduling method, device, storage medium and electronic equipment
CN112163734A (en)Cloud platform based dynamic scheduling method and device for setting computing resources
CN116185623A (en) Task distribution method, device, electronic device and storage medium
US11303546B2 (en)Service system and control method of the same
CN109117280A (en)The method that is communicated between electronic device and its limiting process, storage medium
CN112000477B (en)Method, device, equipment and medium for load balancing in pod
CN112463361A (en)Method and equipment for distributing elastic resources of distributed computation
CN109117279A (en)The method that is communicated between electronic device and its limiting process, storage medium
CN113672382B (en)Service resource allocation method and device, electronic equipment and storage medium
CN111258751A (en)Method, device and medium for controlling resource access
CN111782364B (en)Service calling method, device, electronic equipment and storage medium
US20140047454A1 (en)Load balancing in an sap system
CN113419863A (en)Data distribution processing method and device based on node capability
CN114675973B (en) Resource management method, device, storage medium and program product
CN111045819A (en)Resource request method, device, equipment and storage medium of distributed system
CN111459651A (en)Load balancing method, device, storage medium and scheduling system

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
CB02Change of applicant information
CB02Change of applicant information

Address after:100085 unit C, building C, lin66, Zhufang Road, Qinghe, Haidian District, Beijing

Applicant after:Beijing Xiaomi pinecone Electronic Co.,Ltd.

Address before:100085 unit C, building C, lin66, Zhufang Road, Qinghe, Haidian District, Beijing

Applicant before:BEIJING PINECONE ELECTRONICS Co.,Ltd.

SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20200609


[8]ページ先頭

©2009-2025 Movatter.jp