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
CN111258751A CN202010016711.3A CN202010016711A CN111258751A CN 111258751 A CN111258751 A CN 111258751A CN 202010016711 A CN202010016711 A CN 202010016711A CN 111258751 A CN111258751 A CN 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 Ltd filed Critical Beijing Pinecone Electronics Co Ltd
Priority to CN202010016711.3A priority Critical patent/CN111258751A/en
Publication of CN111258751A publication Critical patent/CN111258751A/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
    • G06F9/5016Allocation 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 the resource being the memory
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

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, specifically job 1 and job 2.
The job 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 the job 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 the job 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 the job 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 the job 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 the job 1, so that the job 1 is judged not to meet the set resource allocation condition.
And when the set resource allocation condition comprises a third condition, judging whether the job 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 the job 1 is greater than the first proportion (7%) of the quota amount corresponding to the same resource type in the resource quota (10%) of the job 1, so that the job 1 is judged not to meet the set resource allocation condition.
Based on the determination that job 1 does not meet the set resource allocation condition, the resource request is rejected, task 4 of job 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, specifically job 1 and job 2.
Job 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.
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 the job 1 according to the quota quantity corresponding to each resource type of the job 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 the job 1 meets the set resource allocation condition, according to the condition four, judging that the job 1 does not meet the set resource allocation condition because the resource application amount (12%) of the CPU resource percentage type of the job 1 is greater than the resource available amount (10%) of the CPU resource percentage type in the resource quota of the job 1.
And when judging whether the job 1 meets the set resource allocation condition, according to the condition five, the resource application amount (12%) of the CPU resource percentage type of the job 1 is larger than the resource quota amount (2%) of the CPU resource percentage type in the resource quota of the job 1, so that the job 1 is judged not to meet the set resource allocation condition, and the job 1 is judged not to meet the set resource allocation condition.
And when judging whether the job 1 meets the set resource allocation condition, calculating the resource available quantity corresponding to each resource type of the job 1 according to the quota quantity corresponding to each resource type of the job 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 of job 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 of job 1, that is, 10%, so it is determined that job 1 does not meet the set resource allocation condition.
Depending on the result of the determination, this resource request is denied and task 4 of job 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:
a receiving module 601, configured to receive a resource request;
a first determining module 602, configured to determine a target job to which a task that initiates the resource request belongs;
a second determining module 603, configured to determine a resource allocation status of the target job;
a control 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 determining module 603 in fig. 6 includes at least one of the following modules:
a first calculating module 701, configured to calculate a resource occupation amount corresponding to each resource type of the target job;
a second calculating module 702, configured to calculate resource availability corresponding to each resource type of the target job;
the first calculation module 701 includes:
a first obtaining module 703, configured to obtain a one-to-many mapping relationship between the target job and all tasks under the target job;
a third determining module 704, configured to determine all tasks under the target job according to the one-to-many mapping relationship;
a third 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;
the second 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 obtaining module 801, configured to obtain resource occupancy amounts of all resource types of all jobs of a user in a set history time period;
a fifth 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;
the setting 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 detecting module 901, configured to detect a user priority of a user;
an adjusting 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 an apparatus 1000 for controlling resource access in accordance with an example embodiment. For example, the apparatus 1000 may be provided as a server. Referring to fig. 10, the apparatus 1000 includes a processing component 1022 that further includes one or more processors and memory resources, represented by memory 1032, for storing instructions, such as application programs, that are executable by the processing component 1022. The application programs stored in memory 1032 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1022 is configured to execute instructions to perform the above-described methods.
The device 1000 may also include a power supply component 1026 configured to perform power management for the device 1000, a wired or wireless network interface 1050 configured to connect the device 1000 to a network, and an input/output (I/O) interface 1059. The apparatus 1000 may operate based on an operating system stored in memory 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.3A 2020-01-08 2020-01-08 Method, device and medium for controlling resource access Pending CN111258751A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010016711.3A CN111258751A (en) 2020-01-08 2020-01-08 Method, device and medium for controlling resource access

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010016711.3A CN111258751A (en) 2020-01-08 2020-01-08 Method, device and medium for controlling resource access

Publications (1)

Publication Number Publication Date
CN111258751A true CN111258751A (en) 2020-06-09

Family

ID=70948589

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010016711.3A Pending CN111258751A (en) 2020-01-08 2020-01-08 Method, device and medium for controlling resource access

Country Status (1)

Country Link
CN (1) CN111258751A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113988582A (en) * 2021-10-25 2022-01-28 必要鸿源(北京)科技有限公司 Ordering resource allocation method and device, storage medium and electronic equipment

Citations (5)

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

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080103861A1 (en) * 2006-04-27 2008-05-01 International Business Machines Corporation Fair share scheduling for mixed clusters with multiple resources
CN103369041A (en) * 2013-07-09 2013-10-23 北京奇虎科技有限公司 Cloud-computing-based resource allocation method and device
WO2018192412A1 (en) * 2017-04-18 2018-10-25 腾讯科技(深圳)有限公司 Method and device for processing resource request
CN110532087A (en) * 2018-05-24 2019-12-03 阿里巴巴集团控股有限公司 A kind of resource allocation methods, resource manager
CN110362409A (en) * 2019-07-19 2019-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 number Priority date Publication date Assignee Title
CN113988582A (en) * 2021-10-25 2022-01-28 必要鸿源(北京)科技有限公司 Ordering resource allocation method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US7117499B2 (en) Virtual computer systems and computer virtualization programs
USRE44686E1 (en) Dynamically modifying the resources of a virtual server
US8572621B2 (en) Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria
Mekala et al. A DRL-based service offloading approach using DAG for edge computational orchestration
CN110308980A (en) Batch processing method, device, equipment and the storage medium of data
US8813087B2 (en) Managing a workload in a cluster of computing systems with multi-type operational resources
US11949737B1 (en) Allocation of server resources in remote-access computing environments
CN111611050A (en) Information processing method, device, equipment and storage medium
US11438271B2 (en) Method, electronic device and computer program product of load balancing
CN112181613A (en) Heterogeneous resource distributed computing platform batch task scheduling method and storage medium
CN111782383A (en) Task allocation method, server, electronic terminal and computer readable storage medium
CN112711479A (en) Load balancing system, method and device of server cluster and storage medium
CN109117280A (en) The method that is communicated between electronic device and its limiting process, storage medium
CN111796933A (en) Resource scheduling method, device, storage medium and electronic equipment
CN109189581B (en) Job scheduling method and device
US11303546B2 (en) Service system and control method of the same
CN111258751A (en) Method, device and medium for controlling resource access
CN117971491A (en) In-process resource control method, device, equipment and storage medium
US9152549B1 (en) Dynamically allocating memory for processes
WO2019034091A1 (en) Distribution method for distributed data computing, device, server and storage medium
CN112463361A (en) Method and equipment for distributing elastic resources of distributed computation
CN113672382B (en) Service resource allocation method and device, electronic equipment and storage medium
CN111045819A (en) Resource request method, device, equipment and storage medium of distributed system
US20140047454A1 (en) Load balancing in an sap system
CN115842828A (en) Gateway load balancing control method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
CB02 Change of applicant information
CB02 Change 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.

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200609