CN114629792A - Resource management method, device and system - Google Patents

Resource management method, device and system Download PDF

Info

Publication number
CN114629792A
CN114629792A CN202011354052.0A CN202011354052A CN114629792A CN 114629792 A CN114629792 A CN 114629792A CN 202011354052 A CN202011354052 A CN 202011354052A CN 114629792 A CN114629792 A CN 114629792A
Authority
CN
China
Prior art keywords
server
resource
service module
consumed
resource amount
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
CN202011354052.0A
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 Huawei Digital Technologies Co Ltd
Original Assignee
Beijing Huawei Digital Technologies 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 Huawei Digital Technologies Co Ltd filed Critical Beijing Huawei Digital Technologies Co Ltd
Priority to CN202011354052.0A priority Critical patent/CN114629792A/en
Publication of CN114629792A publication Critical patent/CN114629792A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • 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
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a resource management method, device and system, and belongs to the technical field of computers. The method is applied to a resource manager and comprises the following steps: after determining that a first service module in a first server needs to be newly added with a task, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server, and determining whether to allow the first service module to be newly added with the task according to a detection result, wherein the first server comprises at least one service module, the first service module is one of the at least one service module, and the resource manager is at least used for managing the at least one service module. The technical scheme provided by the application is favorable for improving the resource utilization rate of the server, and the crash of the server can be avoided.

Description

Resource management method, device and system
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a system for resource management.
Background
A communication network typically includes a plurality of Network Elements (NEs) and a network management device for managing the communication network. For example, the network management device monitors whether the network element is healthy (e.g., the temperature of a Central Processing Unit (CPU), the usage of a memory, the usage of a hard disk, etc.) and whether the communication network needs to be expanded (e.g., whether a network element needs to be newly added in the communication network), etc. The network management equipment comprises a plurality of service modules, and each service module manages at least one network element by running a task.
Each service module in the network management equipment needs to consume the resources of the network management equipment in the process of running the tasks, and the resource amount consumed by the service module is increased along with the increase of the number of the running tasks of the service module. In order to ensure the resource utilization rate of the network management equipment, the network management equipment needs to be subjected to resource management. Currently, each service module in the network management device corresponds to a resource quota (quota), the resource quota corresponds to a fixed amount of resources in the network management device, and each service module can only use the resources corresponding to the resource quota when running a task. However, this easily results in low resource utilization of the network management device. For example, the amount of resources that the service module a in the network management device needs to use is greater than the resource quota thereof, while the resources of the service module B in the network management device (that is, the resources corresponding to the resource quota of the service module B) are in an idle state, but the service module a cannot use the resources of the service module B, so that the resources of the network management device cannot be fully utilized.
Disclosure of Invention
The application provides a resource management method, device and system, which are beneficial to improving the resource utilization rate of a server (such as network management equipment). The technical scheme of the application is as follows:
in a first aspect, a resource management method is provided, which is applied to a resource manager, and includes: after determining that a first service module in a first server needs to be newly added with a task, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server, and determining whether to allow the first service module to be newly added with the task according to a detection result; the first server includes at least one service module, the first service module is any one of the at least one service module, and the resource manager is at least configured to manage the at least one service module.
The resources of the server may include at least one of a computing resource, a storage resource, and an interface resource, where the computing resource may be, for example, a CPU resource, the storage resource may include, for example, a memory resource, a hard disk resource, and the like, and the interface resource may be, for example, an input/output (I/O) interface resource. The consumed resource amount of the first server may include at least one of a consumed amount of computing resources, a consumed amount of storage resources, and a consumed amount of interface resources. The threshold amount of resources of the first server is typically less than the total amount of resources of the first server to ensure that the first server is not fully loaded.
In the technical scheme provided by the application, the resource manager can detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server, determining whether to allow the service module in the first server to newly add a task according to the detection result, that is, the resource manager may determine whether to allow the service module in the first server to add a new task based on the resource usage of the first server, therefore, the situation that the resource of the first server is occupied by a certain service module in the first server under the condition that the resource is not used so that other service modules in the first server can not use the resource of the first server can be avoided, the technical scheme can flexibly control the service module newly added task in the first server according to the resource use condition of the first server, and is beneficial to improving the resource utilization rate of the first server.
Optionally, determining whether to allow the first service module to add a new task according to the detection result includes: if the consumed resource amount of the first server reaches the resource amount threshold of the first server, forbidding the first service module to newly add a task; and if the consumed resource amount of the first server does not reach the resource amount threshold value of the first server, allowing the first service module to newly add a task.
According to the technical scheme provided by the application, the resource manager prohibits the service module in the first server from adding a new task when the consumed resource amount of the first server reaches the resource amount threshold of the first server, so that the condition that the first server is overloaded (namely the consumed resource of the first server exceeds the resource which can be consumed) can be avoided; the resource manager allows the service module in the first server to newly add a task under the condition that the consumed resource amount of the first server does not reach the resource amount threshold value of the first server, so that the resource of the first server can be fully utilized.
Optionally, the detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server includes: detecting whether the number of the equivalent tasks already run on the first server reaches an equivalent task number threshold of the first server, wherein the equivalent task number already run on the first server is determined according to the consumed resource amount of the first server, and the equivalent task number threshold of the first server is determined according to the resource amount threshold of the first server.
Each equivalent task may correspond to a quota of resources, and the amount of resources corresponding to each equivalent task may be equal to or substantially equal to the amount of resources consumed by the first server to actually run one task (for example, a difference between the amount of resources corresponding to each equivalent task and the amount of resources consumed by the first server to actually run one task is smaller than a preset threshold). Optionally, each equivalent task corresponds to a quota of computing resources, a quota of storage resources, and a quota of interface resources, a resource amount of the computing resources corresponding to each equivalent task may be equal to or approximately equal to a resource amount of computing resources consumed by the first server to actually run one task, a resource amount of the storage resources corresponding to each equivalent task may be equal to or approximately equal to a resource amount of storage resources consumed by the first server to actually run one task, and a resource amount of the interface resources corresponding to each equivalent task may be equal to or approximately equal to a resource amount of interface resources consumed by the first server to actually run one task. The equivalent tasks and the resource amount may be converted to each other, the equivalent task amount that has been run on the first server may be converted according to the consumed resource amount of the first server and the corresponding relationship between the equivalent tasks and the resource amount, and the equivalent task amount threshold of the first server may be converted according to the resource amount threshold of the first server and the relationship between the equivalent tasks and the resource amount.
According to the technical scheme, the resource manager can detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server by detecting whether the equivalent task amount operated on the first server reaches the equivalent task amount threshold of the first server, and compared with the data amount of the resource amount, the data amount of the equivalent task amount is simple, so that the process of detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server by the resource manager can be simplified. And the resource amount corresponding to the equivalent task may be equal to or approximately equal to the resource amount consumed by the first server to actually run a task, and the resource manager may accurately detect whether the service module in the first server can add a new task according to the number of the equivalent tasks already running on the first server.
Optionally, before detecting whether the number of equivalent tasks already running on the first server reaches the threshold number of equivalent tasks of the first server, the method further includes: receiving the equivalent task quantity sent by each service module in the first server, determining the equivalent task quantity already running on the first server according to the equivalent task quantity sent by all the service modules in the first server, and determining the equivalent task quantity threshold of the first server according to the resource quantity threshold of the first server, wherein the equivalent task quantity sent by each service module is determined according to the resource quantity consumed by the current running task of the service module.
According to the technical scheme, the resource manager can determine the number of the equivalent tasks which are operated on the first server conveniently by receiving the number of the equivalent tasks which are sent by each service module in the first server, so that whether the service module in the first server can be added with the new tasks or not is detected according to the number of the equivalent tasks which are operated on the first server and the threshold value of the number of the equivalent tasks of the first server.
Optionally, the resource manager is integrated in the first server, and detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server comprises: when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; or, when receiving the query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server. The first service module may periodically send a detection request or an inquiry request to the resource manager, or the first service module may send a detection request or an inquiry request to the resource manager when a new task is required.
According to the technical scheme provided by the application, the resource manager can detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the detection request sent by the service module in the first server, or the service module in the first server detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the consumed resource amount of the first server fed back by the resource manager, so that a means for detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server is enriched.
Optionally, the resource manager is located outside the first server, and detecting whether the consumed resource amount of the first server exceeds the resource amount threshold of the first server includes: when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; or when receiving the query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server; or when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module triggers a resource management module in the first server to detect whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; or, when receiving a query request sent by the resource management module in the first server, sending the consumed resource amount of the first server to the resource management module, so that the resource management module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server. The first service module or the resource management module may periodically send a detection request or a query request to the resource manager, or the first service module or the resource management module may send a detection request or a query request to the resource manager when the first service module needs to add a new task.
According to the technical scheme provided by the application, the resource manager can detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to a detection request sent by the service module in the first server, or the service module in the first server detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the consumed resource amount of the first server fed back by the resource manager, or the resource management module in the first server detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the consumed resource amount of the first server fed back by the resource manager, so that a means for detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server is enriched.
In a second aspect, a resource manager is provided, which includes various units for executing the resource management method as provided in the first aspect or any optional manner of the first aspect, where the units may be implemented based on software, hardware or a combination of software and hardware, and the units may be combined or divided arbitrarily based on specific implementations.
In a third aspect, a resource management system is provided, including: at least one server and a resource manager as provided in the second aspect.
In a fourth aspect, there is provided a computer readable storage medium having stored therein a computer program which, when run on a computer, causes the computer to perform the method of resource management as provided in the first aspect or any alternative form of the first aspect.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of resource management as provided in the first aspect or any alternative form of the first aspect.
A sixth aspect provides a chip comprising programmable logic and/or program instructions which, when run, is operable to perform a resource management method as provided in the first aspect or any alternative form of the first aspect.
The beneficial effect that technical scheme that this application provided brought is:
in the resource management method, device and system provided by the application, since the resource manager can detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server, and determines whether to allow the service module in the first server to newly add a task according to the detection result, that is, the resource manager may determine whether to allow the service module in the first server to add a new task based on the resource usage of the first server, therefore, the situation that the resource of the first server is occupied by a certain service module in the first server under the condition that the resource is not used so that other service modules in the first server can not use the resource of the first server can be avoided, the technical scheme can flexibly control the service module newly added task in the first server according to the resource use condition of the first server, and is beneficial to improving the resource utilization rate of the first server.
Drawings
Fig. 1 is a schematic diagram of a communication network provided in an embodiment of the present application;
FIG. 2 is a schematic illustration of an implementation environment provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of another implementation environment provided by embodiments of the present application;
FIG. 4 is a flowchart of a resource management method according to an embodiment of the present application;
FIG. 5 is a flow chart of another resource management method provided by the embodiment of the application;
fig. 6 is a schematic diagram of a resource management method according to an embodiment of the present application;
FIG. 7 is a diagram illustrating another resource management method according to an embodiment of the present application;
FIG. 8 is a diagram illustrating a further method for resource management according to an embodiment of the present application;
FIG. 9 is a diagram illustrating another resource management method according to an embodiment of the present application;
FIG. 10 is a diagram illustrating another resource management method according to an embodiment of the present application;
FIG. 11 is a schematic diagram of a logical structure of a resource manager according to an embodiment of the present application;
fig. 12 is a schematic hardware structure diagram of a resource manager according to an embodiment of the present application.
Detailed Description
To make the principles, technical solutions and advantages of the present application clearer, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The technical scheme provided by the embodiment of the application relates to a communication network, which comprises a plurality of network elements and at least one network management device, wherein each network element is connected with at least one network management device, and each network management device is used for managing at least one network element connected with the network management device. The embodiment of the present application takes the case that the communication network includes a network management device as an example.
For example, please refer to fig. 1, which shows a schematic diagram of a communication network 00 according to an embodiment of the present application, where the communication network 00 includes: the network management device comprises a network management device 01 and a plurality of network elements 02-07, wherein the network elements 02-07 are all in communication connection with the network management device 01, and the network elements 02-07 can also be connected with each other (not shown in fig. 1). The network management device 01 is configured to manage at least one of the network elements 02 to 07, for example, the network management device 01 manages all of the network elements 02 to 07, and the network management device 01 monitors whether the network elements 02 to 07 are healthy and whether the communication network 00 needs capacity expansion. For example, the network management device 01 monitors the temperature of the CPUs of the network elements 02 to 07, the use condition of the memory, the use condition of the hard disk, and whether a new network element needs to be added in the communication network 00. The network management device may periodically or continuously obtain performance indexes of the network element, such as a CPU utilization rate, a port rate, and the like of the network element, in a process of managing the network element.
The network management device 01 may be a server (server), a controller, a desktop computer, or the like. The network element is a minimum unit that can be monitored and managed in the communication network, and each of the plurality of network elements 02 to 07 may be a switch, a router, a server, a computing device, or the like, which is not limited in this embodiment of the present application.
The network management equipment 01 can communicate with a plurality of network elements 02-07 connected with the network management equipment based on a network management protocol so as to manage the network elements 02-07. The network management protocol may include, but is not limited to: a Simple Network Management Protocol (SNMP), a Common Management Information Protocol (CMIP), or a telemetry (telemanagement) protocol, which is not limited in this embodiment of the present application.
In this embodiment, the network management device may include at least one service (service) module, where each service module is configured to manage at least one network element connected to the network management device by running a task (task), and each service module may communicate with the network management device based on at least one network management protocol. As shown in fig. 1, the embodiment of the present application is illustrated in the case that the network management device 01 includes three service modules, namely, service modules 011 to 013, where the service module 011 can manage the network elements 02 and 03 by operating tasks, the service module 011 can communicate with the network elements 02 and 03 based on SNMP, the service module 012 can manage the network elements 04 and 05 based on operating tasks, the service module 012 can communicate with the network elements 04 and 05 based on CMIP, the service module 013 can manage the network elements 06 and 07 based on operating tasks, and the service module 013 can communicate with the network elements 06 and 07 based on telemetry protocol.
It should be noted that the communication network shown in fig. 1 is only used for example, and is not used to limit the communication network, in an actual implementation process, the communication network may further include other devices, and the number of the network management devices, the number of the network elements, and the number of the service modules in the network management devices may be configured according to needs, which is not limited in this embodiment of the present application.
The service module in the network management device needs to consume the resources of the network management device in the process of running the tasks, and the resource amount consumed by the service module is increased along with the increase of the number of the running tasks of the service module. In order to ensure the resource utilization rate of the network management equipment, the network management equipment needs to be subjected to resource management. At present, there are two schemes for managing resources of network management equipment.
The first scheme is as follows: each service module in the network management device corresponds to a resource quota, the resource quota corresponds to a fixed amount of resources in the network management device (that is, a fixed amount of resources are allocated to each service module in the network management device in the resources of the network management device), the sum of the resource amounts corresponding to the resource quotas of all the service modules in the network management device is less than the total resource amount of the network management device, each service module can only use the resources corresponding to the resource quotas when running a task, and if the resource amount consumed by the running task of the service module is greater than the resource quota of the service module, the service module is prohibited from running. However, in this scheme, the resource utilization rate of the network management device is low. Taking the network management device 01 shown in fig. 1 as an example, assuming that the amount of resources that the service module 011 needs to use is greater than the resource quota thereof, and the resources corresponding to the resource quota of the service module 012 are in an idle state, but the service module 011 cannot use the resources of the service module 012, so that the resources of the network management device 01 cannot be fully utilized.
The second scheme is as follows: each service module in the network management equipment can preempt all resources of the network management equipment, and each service module can use all the resources preempted by the service module. However, in this scheme, each service module in the network management device tries to use all resources of the network management device, the network management device is often in a full-load state (that is, the resources of the network management device are often all in an occupied state), and the operating pressure of the network management device is relatively high, which may easily cause the network management device to crash. Taking the network management device 01 shown in fig. 1 as an example, the service modules 011 to 013 attempt to use all resources of the network management device 01, so that the network management device 01 is often in a fully loaded state, and the operation pressure thereof is high, which easily causes the network management device 01 to crash.
In view of the above, the present application provides a resource management method, which may be executed by a resource manager, where the resource manager may be integrated in a network management device or located outside the network management device. The resource manager detects whether the consumed resource amount of the network management equipment reaches the resource amount threshold of the network management equipment after determining that a service module in the network management equipment needs a new task, and determines whether the service module in the network management equipment is allowed to have the new task according to the detection result, so that the resource manager can flexibly control the service module new task in the network management equipment according to the resource use condition of the network management equipment, the resource utilization rate of the network management equipment is improved, the network management equipment can be prevented from being in a full load state, the operating pressure of the network management equipment is reduced, and the network management equipment is prevented from being halted. The technical solution of the present application is described below by taking a network management device as a server as an example.
Before describing the detailed aspects of the present application, the present application will be described in an implementation environment.
In the embodiment of the present application, the resource manager may be integrated in a server (that is, a network management device), or may be located outside the server (that is, the network management device), and the embodiment of the present application may include two implementation environments according to whether the resource manager is integrated in the server (that is, the network management device).
The first implementation environment: please refer to fig. 2, which illustrates a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment provides a server 11, which server 11 may be a network management device in a communication network. The server 11 includes a resource manager 111 and a plurality of service modules 112 to 114, wherein the resource manager 111 is configured to manage the plurality of service modules 112 to 114 to perform resource management on the server 11. The resource manager 111 communicates with the service modules 112 to 114 respectively based on internal communication interfaces (i.e. interfaces for implementing different structural communications inside the server 11) of the server 11, so as to manage the service modules 112 to 114. For example, the internal communication interface may be a Remote Procedure Call (RPC) interface based on a transmission control protocol/internet protocol (TCP/IP), a shared memory (shared memory), an inter-process communication (IPC) interface of a pipe, or a declaration/discovery interface of a temporary file. Those skilled in the art will readily appreciate that in the implementation environment shown in fig. 2, the resource manager 111 is integrated in the server 11, and the resource manager 111 may be a functional module in the server 11.
Second implementation environment: please refer to fig. 3, which illustrates a schematic diagram of another implementation environment provided by the embodiment of the present application. The implementation environment provides a resource management system 20, where the resource management system 20 includes a resource manager 21 and at least one server, each of the at least one server may be a network management device in a communication network, the at least one server is respectively connected to the resource manager 21 in a communication manner, each of the at least one server includes at least one service module, and the resource manager 21 is configured to manage the service module in the at least one server to perform resource management on the at least one server. Fig. 3 illustrates that the resource management system 20 includes two servers 22-23, the server 22 includes a plurality of service modules 221-223, the server 23 includes a plurality of service modules 231-233, and the resource manager 21 is configured to manage the plurality of service modules 221-223 and the plurality of service modules 231-233 respectively, so as to manage resources of the server 22 and the server 23 respectively. The resource manager 21 can communicate with the service modules 221-223 based on the communication interface between the resource manager 21 and the server 22, and communicate with the service modules 231-233 based on the communication interface between the resource manager 21 and the server 23. Those skilled in the art will readily appreciate that in this implementation environment illustrated in FIG. 3, the resource manager 21 is located outside the server.
Optionally, when the resource manager is located outside the server, the server may further include a resource management module, and the resource management module may assist the resource manager in managing the service module in the server. For example, as shown in fig. 3, the server 22 further includes a resource management module 224, the server 23 further includes a resource management module 234, the resource management module 224 can assist the resource manager 21 in managing the service modules in the server 22, and the resource management module 234 can assist the resource manager 21 in managing the service modules in the server 23.
It should be noted that the servers 22 to 23 shown in fig. 3 may be two network management devices in the same communication network, or may also be network management devices in different communication networks, which is not limited in this embodiment of the present application. It should be understood by those skilled in the art that the implementation environments shown in fig. 2 and fig. 3 are only for example and are not used to limit the technical solution of the present application, and in practical applications, the implementation environment may further include other modules or devices, and the number of service modules in a server and the number of servers managed by the resource manager 21 may be configured according to needs, and details of the embodiment of the present application are not described herein again.
The above is an introduction of the implementation environment of the present application, and the resource management method of the present application is described below with reference to the implementation environment.
For example, please refer to fig. 4, which shows a flowchart of a resource management method provided in an embodiment of the present application. The resource management method may be performed by a resource manager, which may be the resource manager 111 in the implementation environment shown in fig. 2 or the resource manager 21 in the implementation environment shown in fig. 3. Referring to fig. 4, the method may include the following steps:
step 401, after determining that a first service module in a first server needs a new task, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server. If the consumed resource amount of the first server reaches the resource amount threshold of the first server, executing step 402; if the consumed resource amount of the first server does not reach the resource amount threshold of the first server, step 403 is executed.
The first server comprises at least one service module, and the resource manager can manage the at least one service module so as to manage resources of the first server. The first service module may be any one of the at least one service module, and the first service module may trigger the resource manager to perform step 401 when a new task is required.
Optionally, the resource usage of the first server may be updated to the resource manager in real time or periodically, so that the resource manager may determine the consumed resource amount of the first server in real time or periodically, and record the consumed resource amount of the first server. For example, the service modules in the first server need to consume the resources of the first server during the process of running the task, each service module may send the amount of the consumed resources to the resource manager in real time or periodically, and the resource manager determines the consumed resource amount of the first server by aggregating the resource amounts consumed by the service modules in the first server. The threshold of the amount of resources of the first server is usually smaller than the total amount of resources of the first server, for example, the threshold of the amount of resources may be 80% (eighty percent), 85%, or 90% of the total amount of resources of the first server, which is not limited in this embodiment of the present invention. In this embodiment, the resources may include at least one of a computing resource, a storage resource, and an interface resource, where the computing resource may be, for example, a CPU resource, the storage resource may include, for example, a memory resource, a hard disk resource, and the like, and the interface resource may be, for example, an I/O interface resource.
In the embodiment of the present application, the resource manager may be integrated in the first server, or may be located outside the first server. If the resource manager is integrated in the first server, the resource manager may manage the service module in the first server. If the resource manager is located outside the first server, the resource manager may manage the service module in the first server, and may also manage the service module in a server other than the first server. The implementation of step 401 is described below in two cases, depending on whether the resource manager is integrated in the first server.
In the first case: the resource manager is integrated in the first server (corresponding to the implementation environment shown in fig. 2).
Alternatively, if the resource manager is integrated in the first server, the resource manager may detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the detection request sent by the first service module (i.e. the resource manager performs the actual detection step); alternatively, the resource manager may send the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server (that is, the first service module performs the actual detection step). In view of this, the first case may include the following two possible implementations.
The first implementation mode comprises the following steps: the resource manager detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the detection request sent by the first service module.
Optionally, a resource amount threshold of the first server is recorded in the resource manager, and when a new task needs to be added to the first service module, a detection request may be sent to the resource manager; after receiving the detection request, the resource manager detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server. The resource manager, after detecting, may feed back a detection result to the first service module. Optionally, the detection request may carry indication information of the first service module, for example, an identifier of the first service module, so that the resource manager may feed back a detection result to the first service module according to the indication information of the first service module after the detection.
Exemplarily, taking the first service module as the service module 112 in the server 11 shown in fig. 2 as an example, the resource manager 111 records a resource amount threshold of the server 11, and when the service module 112 needs to add a new task, the service module 112 sends a detection request to the resource manager 111, where the detection request carries an identifier "112" of the service module 112; after receiving the detection request, the resource manager 111 detects whether the consumed resource amount of the server 11 reaches the resource amount threshold of the server 11; after the detection, the resource manager 111 feeds back the detection result to the service module 112 according to the identifier "112" of the service module 112.
The second implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server.
Optionally, a resource amount threshold of the first server is recorded in the first service module, and when a new task needs to be added to the first service module, the first service module may send a query request to the resource manager, where the query request may carry indication information of the first service module, for example, an identifier of the first service module; after receiving the query request, the resource manager queries the consumed resource amount of the first server, and sends the queried consumed resource amount of the first server to the first service module according to the indication information of the first service module; after receiving the consumed resource amount of the first server, the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
Exemplarily, taking the first service module as the service module 113 in the server 11 shown in fig. 2 as an example, the resource amount threshold of the server 11 is recorded in the service module 113, and when the service module 113 needs to add a new task, the service module 113 sends an inquiry request to the resource manager 111, where the inquiry request carries an identifier "113" of the service module 113; after receiving the query request, the resource manager 111 queries the consumed resource amount of the server 11, and sends the consumed resource amount of the server 11 to the service module 113 according to the identifier "113" of the service module 113; the service module 113 receives the consumed resource amount of the server 11, and detects whether the consumed resource amount of the server 11 reaches the resource amount threshold of the server 11.
In the second case: the resource manager is located outside the first server (corresponding to the implementation environment shown in fig. 3).
Optionally, if the resource manager is located outside the first server, the resource manager may detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the detection request sent by the first service module (that is, the resource manager performs the actual detection step); alternatively, the resource manager may send the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server (that is, the first service module performs the actual detection step); or, the resource manager may send the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module triggers the resource management module in the first server to detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server (that is, the resource management module performs an actual detection step); alternatively, the resource manager may send the consumed resource amount of the first server to the resource management module according to the query request sent by the resource management module in the first server, and the resource management module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server (that is, the resource management module executes the actual detection step). In view of this, the second case may include the following four possible implementations.
The first implementation mode comprises the following steps: the resource manager detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to the detection request sent by the first service module.
Optionally, a resource amount threshold of the first server is recorded in the resource manager, and when a task needs to be newly added to the first service module, a detection request may be sent to the resource manager, where the detection request may carry indication information of the first service module (for example, an identifier of the first service module) and indication information of the first server (for example, an identifier of the first server, where the first server is also a server where the first service module is located); after receiving the detection request, the resource manager detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server. The resource manager may feed back the detection result according to the indication information of the first server and the indication information of the first service module and the first service module after the detection.
Exemplarily, taking the first server as the server 22 shown in fig. 3, the first service module being the service module 221 in the server 22 as an example, the resource manager 21 records a resource amount threshold of the server 22, and when the service module 221 needs to add a new task, the service module 221 sends a detection request to the resource manager 21, where the detection request carries an identifier "221" of the service module 221 and an identifier "22" of the server 22; the resource manager 21 receives the detection request, and detects whether the consumed resource amount of the server 22 reaches the resource amount threshold of the server 22. After the detection, the resource manager 21 feeds back the detection result to the service module 221 according to the identifier "22" of the server 22 and the identifier "221" of the service module 221.
The second implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server.
Optionally, a resource amount threshold of a first server is recorded in the first service module, and when a new task is needed to be added to the first service module, the first service module may send an inquiry request to the resource manager, where the inquiry request may carry indication information of the first service module (for example, an identifier of the first service module) and indication information of the first server (for example, an identifier of the first server); after receiving the query request, the resource manager queries the consumed resource amount of the first server according to the indication information of the first server carried by the query request, and sends the queried consumed resource amount of the first server to the first service module according to the indication information of the first server and the indication information of the first service module; after receiving the consumed resource amount of the first server, the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
Exemplarily, taking the first server as the server 22 shown in fig. 3, the first service module being the service module 222 in the server 22 as an example, the service module 222 records a resource amount threshold of the server 22, and when the service module 222 needs to add a new task, the service module 222 sends an inquiry request to the resource manager 21, where the inquiry request carries an identifier "222" of the service module 222 and an identifier "22" of the server 22; after receiving the query request, the resource manager 21 queries the consumed resource amount of the server 22 according to the identifier "22" of the server 22 carried in the query request, and sends the queried consumed resource amount of the server 22 to the service module 222 according to the identifier "22" of the server 22 and the identifier "222" of the first service module 222; the service module 222 receives the consumed resource amount of the server 22, and detects whether the consumed resource amount of the server 22 reaches the resource amount threshold of the server 22.
The third implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module triggers the resource management module in the first server to detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server.
Optionally, a resource management module in the first server records a resource amount threshold of the first server, and when the first service module needs to add a new task, the first service module may send an inquiry request to the resource manager, where the inquiry request may carry indication information of the first service module (for example, an identifier of the first service module) and indication information of the first server (for example, an identifier of the first server); after receiving the query request, the resource manager queries the consumed resource amount of the first server according to the indication information of the first server carried by the query request, and sends the queried consumed resource amount of the first server to the first service module according to the indication information of the first server and the indication information of the first service module; after receiving the consumed resource amount of the first server, the first service module sends a detection request carrying the consumed resource amount of the first server to a resource management module in the first server, so that the resource management module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; after the resource management module detects the first service module, a detection result may be fed back to the first service module.
Exemplarily, taking the first server as the server 22 shown in fig. 3, the first service module being the service module 222 in the server 22 as an example, the resource management module 224 records a resource amount threshold of the server 22, and when the service module 222 needs to add a new task, the service module 222 sends an inquiry request to the resource manager 21, where the inquiry request carries an identifier "222" of the service module 222 and an identifier "22" of the server 22; after receiving the query request, the resource manager 21 queries the consumed resource amount of the server 22 according to the identifier "22" of the server 22 carried in the query request, and sends the queried consumed resource amount of the server 22 to the service module 222 according to the identifier "22" of the server 22 and the identifier "222" of the first service module 222; after receiving the consumed resource amount of the server 22, the service module 222 sends a detection request carrying the consumed resource amount of the server 22 to the resource management module 224, so that the resource management module 224 detects whether the consumed resource amount of the server 22 reaches the resource amount threshold of the server 22.
The fourth implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the resource management module according to the query request of the resource management module in the first server, and the resource management module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server.
Optionally, a resource management module in the first server records a resource amount threshold of the first server, and when a first service module needs to add a new task, the resource management module may be triggered to send an inquiry request to the resource manager, where the inquiry request may carry indication information of the resource management module (for example, an identifier of the resource management module) and indication information of the first server (for example, an identifier of the first server); after receiving the query request, the resource manager queries the consumed resource amount of the first server according to the indication information of the first server carried by the query request, and sends the queried consumed resource amount of the first server to the resource management module according to the indication information of the first server and the indication information of the resource management module; after receiving the consumed resource amount of the first server, the resource management module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; after the resource management module detects the first service module, a detection result may be fed back to the first service module.
Exemplarily, taking the first server as the server 22 shown in fig. 3, the first service module being the service module 222 in the server 22 as an example, the resource management module 224 records a resource amount threshold of the server 22, and when the service module 222 needs to add a new task, the resource management module 224 is triggered to send an inquiry request to the resource manager 21, where the inquiry request carries an identifier "224" of the resource management module 224 and an identifier "22" of the server 22; after receiving the query request, the resource manager 21 queries the consumed resource amount of the server 22 according to the identifier "22" of the server 22 carried in the query request, and sends the queried consumed resource amount of the server 22 to the resource management module 224 according to the identifier "22" of the server 22 and the identifier "224" of the resource management module 224; the resource management module 224 receives the consumed resource amount of the server 22, and detects whether the consumed resource amount of the server 22 reaches the resource amount threshold of the server 22.
Optionally, in any implementation manner of any one of the above cases, detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server may include: comparing the consumed resource amount of the first server with the resource amount threshold of the first server, if the consumed resource amount of the first server is equal to the resource amount threshold of the first server, determining that the consumed resource amount of the first server reaches the resource amount threshold of the first server, and if the consumed resource amount of the first server is less than the resource amount threshold of the first server, determining that the consumed resource amount of the first server does not reach the resource amount threshold of the first server. In this embodiment of the present application, the resource of the first server may include at least one of a computing resource, a storage resource and an interface resource, where the computing resource may be, for example, a CPU resource, and the storage resource may include, for example, a memory resource, a hard disk resource, and the like, and then the consumed resource amount of the first server may include at least one of a consumed amount of the computing resource, a consumed amount of the storage resource, and a consumed amount of the interface resource, and therefore, detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server may include the following two possible implementation manners:
the first implementation mode comprises the following steps: the resource amount threshold of the first server includes a resource amount threshold corresponding to each type of resource, and it may be detected whether the consumed resource amount of the first server reaches the resource amount threshold of the first server according to an consumed amount of a type of resource currently (for example, at a time when the detection step needs to be performed) consumed by the first server with a highest proportion and the resource amount threshold corresponding to the type of resource. The consumed proportion of each type of resource in the first server is equal to a ratio of the consumed amount of the type of resource to the total amount of the type of resource, for example, the consumed proportion of the computing resource in the first server is equal to a ratio of the consumed amount of the computing resource to the total amount of the computing resource of the first server.
For example, if the type of resource currently consumed by the first server is a computing resource, the resource manager detects whether the consumed amount of the computing resource in the first server reaches a resource amount threshold corresponding to the computing resource of the first server. For another example, if the type of resource currently consumed by the first server is a storage resource, the resource manager detects whether an amount of consumed storage resources in the first server reaches a resource amount threshold corresponding to the storage resource of the first server. For another example, if the type of resource currently consumed by the first server is an interface resource, the resource manager detects whether the consumed amount of the interface resource in the first server reaches a resource amount threshold corresponding to the interface resource of the first server.
The second implementation mode comprises the following steps: the resource amount threshold of the first server is an integrated threshold of each type of resource, the resource amount threshold (i.e., the integrated threshold) of the first server may be obtained by weighted calculation according to resource amount thresholds corresponding to each type of resource of the first server, an equivalent consumption amount may be determined according to consumed amounts of each type of resource in the first server, and whether consumed resource amount of the first server reaches the resource amount threshold of the first server is detected according to the equivalent consumption amount.
Illustratively, the resource manager performs weighted calculation on the consumed amount of the computing resource, the consumed amount of the storage resource and the consumed amount of the interface resource in the first server to determine an equivalent consumption amount, and detects whether the equivalent consumption amount reaches a resource amount threshold of the first server. For example, the resource manager may determine the equivalent consumption amount according to a formula S of a1 × S1+ a2 × S2+ a3 × S3, where S1, S2, and S3 sequentially represent the consumed amount of the computing resources, the consumed amount of the storage resources, and the consumed amount of the interface resources in the first server, a1, a2, and a3 sequentially represent the weighting coefficients of the computing resources, the storage resources, and the interface resources, a1, a2, and a3 are constants, and specific values of a1, a2, and a3 may be determined according to a ratio of each type of resources of the first server.
It should be noted that, in this embodiment, it is exemplified that the resource server detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server after determining that the service module in the first server needs to add a new task, in practical applications, the service module in the first server may periodically trigger the resource manager to detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server, for example, the service module in the first server periodically sends a detection request or a query request to the resource server to trigger the resource manager to detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server, which is not limited in this embodiment of the present application.
Step 402, forbidding the first service module to newly add a task.
If it is determined in step 401 that the consumed resource amount of the first server reaches the resource amount threshold of the first server, the first service module is prohibited from adding new tasks. For example, the resource manager sends the indication information to the first service module to indicate that the first service module is prohibited from adding the new task.
And step 403, allowing the first service module to newly add a task.
If it is determined in step 401 that the consumed resource amount of the first server does not reach the resource amount threshold of the first server, the first service module is allowed to add a new task. For example, the resource manager sends indication information to the first service module indicating that the first service module is allowed to add new tasks. Optionally, the resource manager may further indicate, to the first service module, the number of tasks that the first service module is allowed to add, which is not limited in this embodiment of the application.
To sum up, in the resource management method provided by the present application, the resource manager may detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server, and determine whether to allow the service module in the first server to newly add a task according to the detection result, that is, the resource manager may determine whether to allow the service module in the first server to newly add a task according to the resource usage of the first server, so as to avoid a situation that another service module in the first server cannot use the resource of the first server due to the fact that a certain service module in the first server occupies the resource of the first server without using the resource, and according to the technical scheme, the resource manager may flexibly control the service module in the first server to newly add a task according to the resource usage of the first server, which is beneficial to improving the resource utilization of the first server, and the first server can be prevented from crashing. The resource management method provided by the application allows the consumed resources of the service module in the first server to continuously increase until the threshold of the resource amount of the first server is reached, and by the resource management method, different service modules in the first server can use the resources of the first server in any proportion, for example, the service module a and the service module B in the first server can use the resources of the first server in a proportion of 7: 3.
In this embodiment of the present application, detecting whether the consumed resource amount of the first server reaches the resource amount threshold of the first server may further include: detecting whether the number of the equivalent tasks already run on the first server reaches an equivalent task number threshold of the first server, wherein the equivalent task number already run on the first server is determined according to the consumed resource amount of the first server, and the equivalent task number threshold of the first server is determined according to the resource amount threshold of the first server. As an alternative implementation manner, the resource management method provided in this embodiment may be implemented by the scheme provided in fig. 5 below.
For example, please refer to fig. 5, which shows a flowchart of another resource management method provided in an embodiment of the present application. The resource management method may be performed by a resource manager, which may be the resource manager 111 in the implementation environment shown in fig. 2 or the resource manager 21 in the implementation environment shown in fig. 3. Referring to fig. 5, the method may include the following steps:
step 501, receiving the equivalent task quantity sent by each service module in the first server, wherein the equivalent task quantity sent by each service module is determined according to the resource quantity consumed by the current running task of the service module.
Each equivalent task may correspond to a quota of resources, and the amount of resources corresponding to each equivalent task may be equal to or substantially equal to the amount of resources consumed by the first server to actually run one task. Optionally, each equivalent task corresponds to a quota of computing resources, a quota of storage resources, and a quota of interface resources, a resource amount of the computing resources corresponding to each equivalent task is equal to or approximately equal to a resource amount of computing resources consumed by the first server to actually run one task, a resource amount of the storage resources corresponding to each equivalent task is equal to or approximately equal to a resource amount of storage resources consumed by the first server to actually run one task, and a resource amount of the interface computing resources corresponding to each equivalent task is equal to or approximately equal to a resource amount of interface resources consumed by the first server to actually run one task.
In the embodiment of the application, the equivalent tasks and the resource amount can be converted with each other, and the service module in the first server can determine the equivalent task amount of the service module according to the resource amount consumed by the current running task of the service module and the corresponding relationship between the equivalent tasks and the resource amount in the process of running the tasks, and send the equivalent task amount to the resource manager. Accordingly, the resource manager may receive the equivalent number of tasks sent by each service module in the first server. Optionally, each service module in the first server may determine, in real time or periodically, the equivalent task number of the service module according to the resource amount consumed by the current running task of the service module, and send the equivalent task number of the service module to the resource manager, which is not limited in this embodiment of the present application.
Optionally, in a possible implementation manner, each service module in the first server determines an equivalent task number according to the consumed amount of each type of resource consumed by the service module and the resource amount of the type of resource corresponding to the equivalent task, obtains the equivalent task number corresponding to the type of resource consumed by the service module, thereby obtaining at least one equivalent task number corresponding to at least one type of resource consumed by the service module, then the service module upwards integers a maximum value of the at least one equivalent task number, and determines a value obtained by upwards integer the maximum value as the equivalent task number of the service module. For example, taking the resources of the first server as computing resources, storage resources, and interface resources as an example, assuming that the resource amount of the computing resources corresponding to the equivalent task is W1, the resource amount of the storage resources is W2, and the resource amount of the interface resources is W3, a conversion process between the resource amount consumed by the first service module to currently run the task and the equivalent task amount is described by taking the first service module as an example: assuming that the consumption amount of the computing resource of the first service module is S1, the consumption amount of the storage resource is S2, and the consumed amount of the interface resource is S3, the first service module determines that the equivalent task number corresponding to the computing resource consumed by the first service module is S1/W1 according to the consumption amount of the computing resource S1 and the resource amount of the computing resource W1 corresponding to the equivalent task, determines that the equivalent task number corresponding to the storage resource consumed by the first service module is S2/W2 according to the consumption amount of the storage resource S2 and the resource amount of the storage resource W2 corresponding to the equivalent task, determines that the equivalent task number corresponding to the interface resource consumed by the first service module is S3/W3 according to the consumption amount of the interface resource S3 and the resource amount of the interface resource W3 corresponding to the equivalent task (the symbol in S1/W1, S2/W2, and S3/W3 represents a division sign), the first service module integers the maximum value of the S1/W1, S2/W2 and S3/W3 upwards, and the value obtained by the integer-up of the maximum value is determined as the equivalent task number of the first service module.
Optionally, in another possible implementation manner, the service module in the first server determines the equivalent task number of the service module according to the consumed amount of the type of resource that is currently consumed by the service module most and the resource amount of the type of resource corresponding to the equivalent task. For example, if the first service module currently consumes the most computing resources, determining the equivalent task number of the service module according to the consumption of the computing resources of the first service module and the resource amount of the computing resources corresponding to the equivalent task; if the storage resources consumed by the first service module at present are the most, determining the equivalent task quantity of the service module according to the consumption of the storage resources of the first service module and the resource quantity of the storage resources corresponding to the equivalent task; and if the interface calculation resources consumed by the first service module at present are the most, determining the equivalent task quantity of the service module according to the consumption of the interface resources of the first service module and the resource quantity of the interface resources corresponding to the equivalent task. For example, assuming that the resource amount of the computing resource corresponding to the equivalent task is W1, the resource amount of the storage resource is W2, and the resource amount of the interface resource is W3, a conversion process between the resource amount consumed by the first service module to currently run the task and the equivalent task amount is described by taking the first service module as an example: assuming that the current consumption of the computing resources of the first service module is the most, and the consumption of the computing resources of the first service module is S1, the first service module determines that the equivalent task number is S1/W1 according to the consumption of the computing resources S1 and the resource amount W1 of the computing resources corresponding to the equivalent task, and determines a value obtained by taking an integer upward from S1/W1 as the equivalent task number of the first service module. Assuming that the storage resources currently consumed by the first service module are the most, and the consumption amount of the storage resources of the first service module is S2, the first service module determines that the equivalent task number is S2/W2 according to the consumption amount of the storage resources S2 and the resource amount W2 of the storage resources corresponding to the equivalent task, and determines a value obtained by taking an integer upward from S2/W2 as the equivalent task number of the first service module. Assuming that the interface resources currently consumed by the first service module are the most, and the consumption amount of the interface resources of the first service module is S3, the first service module determines that the equivalent task number is S3/W3 according to the consumption amount S3 of the interface resources and the resource amount W3 of the interface resources corresponding to the equivalent task, and determines a value obtained by taking an integer upward from S3/W3 as the equivalent task number of the first service module.
Step 502, determining the number of equivalent tasks that have been run on the first server according to the number of equivalent tasks sent by all the service modules in the first server.
Optionally, the resource manager determines the sum of the equivalent task numbers sent by all the service modules in the first server as the equivalent task number already running on the first server.
Step 503, determining an equivalent task quantity threshold of the first server according to the resource quantity threshold of the first server.
Optionally, the resource manager determines the equivalent task quantity threshold of the first server according to the resource quantity threshold of the first server and the corresponding relationship between the equivalent task and the resource quantity. That is, the resource manager converts the resource amount threshold of the first server into the equivalent task amount threshold according to the corresponding relationship between the equivalent task and the resource amount.
For example, assuming that the resource amount of the computing resource corresponding to each equivalent task is W1, the resource amount of the storage resource is W2, and the resource amount of the interface resource is W3, the process of the resource manager determining the equivalent task amount threshold of the first server according to the resource amount threshold of the first server and the corresponding relationship between the equivalent task and the resource amount may include two implementation manners:
the first implementation mode comprises the following steps: the resource amount threshold of the first server comprises a resource amount threshold corresponding to each type of resource, the resource manager determines a quantity threshold according to the resource amount threshold corresponding to each type of resource and the resource amount of the type of resource corresponding to the equivalent task to obtain at least one quantity threshold, the minimum value of the at least one quantity threshold is rounded downwards, and the numerical value obtained by rounding the minimum value downwards is determined as the equivalent task quantity threshold of the first server.
For example, assuming that the threshold of the amount of resources corresponding to the computing resources of the first server is T1, the threshold of the amount of resources corresponding to the storage resources is T2, the threshold of the amount of resources corresponding to the interface resources is T3, the amount of resources corresponding to the equivalent task is W1, the amount of resources of the storage resources is W2, and the amount of resources of the interface resources is W3, the resource manager determines that the threshold of the amount of resources is T1/W1 according to the threshold of the amount of resources corresponding to the computing resources of the first server T1 and the amount of resources of the computing resources corresponding to the equivalent task W1, determines that the threshold of the amount of resources is T2/W2 according to the threshold of the amount of resources corresponding to the storage resources of the first server T2 and the amount of resources W2 corresponding to the equivalent task, and determines that the threshold of the amount of resources corresponding to the interface resources of the first server T3 and the amount of resources of the interface resources of the equivalent task W3 is T3/W3 (at T1/W1), The symbol "/" in T2/W2 and T3/W3 indicates a division number), the resource manager downward integers the minimum value of the T1/W1, T2/W2 and T3/W3, and determines the value obtained by downward integer of the minimum value as the equivalent task number threshold of the first server.
The second implementation mode comprises the following steps: the resource amount threshold of the first server is a comprehensive threshold of various types of resources of the first server, the resource amount threshold (i.e., a comprehensive threshold) of the first server may be obtained by weighted calculation according to resource amount thresholds corresponding to various types of resources of the first server, the equivalent task may correspond to a comprehensive resource value, the comprehensive resource value corresponding to the equivalent task is a comprehensive value of the resource amount of various types of resources corresponding to the equivalent task, and the resource manager determines the equivalent task amount threshold of the first server according to the resource amount threshold (i.e., a comprehensive threshold) of the first server and the comprehensive resource value corresponding to the equivalent task.
Exemplarily, the resource amount threshold of the first server is T (that is, the comprehensive threshold is T), and the comprehensive resource value corresponding to the equivalent task is V, the resource manager rounds down the T/V (where the symbol "/" represents a division number), and determines a value obtained by rounding down the T/V as the equivalent task amount threshold of the first server.
Step 504, after determining that the first service module in the first server needs to add a new task, detecting whether the number of the equivalent tasks already running on the first server reaches the threshold value of the number of the equivalent tasks of the first server. If the number of equivalent tasks already running on the first server reaches the threshold number of equivalent tasks of the first server, go to step 505; if the number of equivalent tasks already running on the first server does not reach the threshold number of equivalent tasks for the first server, go to step 506.
The first service module in the first server may trigger the resource manager to perform this step 504 when a new task is needed. Similar to step 401, the resource manager may be integrated in the first server or may be located outside the first server. Depending on whether the resource manager is integrated on the first server, this step 504 may include two cases.
In the first case: the resource manager is integrated in the first server (corresponding to the implementation environment shown in fig. 2).
Wherein, the first case may include the following two possible implementations.
The first implementation mode comprises the following steps: the resource manager detects whether the number of the equivalent tasks which have been run on the first server reaches the threshold value of the number of the equivalent tasks of the first server according to the detection request sent by the first service module.
The second implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module detects whether the number of the equivalent tasks which have already run on the first server reaches the threshold value of the number of the equivalent tasks of the first server.
In the second case: the resource manager is located outside the first server (corresponding to the implementation environment shown in fig. 3).
The second case may include the following four possible implementations.
The first implementation mode comprises the following steps: the resource manager detects whether the number of the equivalent tasks which have been run on the first server reaches the threshold value of the number of the equivalent tasks of the first server according to the detection request sent by the first service module.
The second implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module detects whether the number of the equivalent tasks which have already run on the first server reaches the threshold value of the number of the equivalent tasks of the first server.
The third implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the first service module according to the query request sent by the first service module, and the first service module triggers the resource management module in the first server to detect whether the equivalent task amount running on the first server reaches the equivalent task amount threshold of the first server.
The fourth implementation mode comprises the following steps: the resource manager sends the consumed resource amount of the first server to the resource management module according to the query request of the resource management module in the first server, and the resource management module detects whether the number of the equivalent tasks which have run on the first server reaches the threshold value of the number of the equivalent tasks of the first server.
It should be noted that only possible situations of the step 504 are briefly described here, and the implementation process of the step 504 may refer to the step 401 in the embodiment shown in fig. 4, and the embodiment of the present application is not described herein again.
And 505, forbidding the first service module to newly add the task.
Step 506, allowing the first service module to newly add a task.
The implementation process of step 505 to step 506 may refer to step 505 and step 506 in the embodiment shown in fig. 4, and the embodiment of the present application is not described herein again.
To sum up, in the resource management method provided by the present application, the resource manager may detect whether the number of equivalent tasks that have been executed on the first server reaches the threshold value of the number of equivalent tasks of the first server, and determine whether to allow the service module in the first server to newly add a task according to the detection result, that is, the resource manager may determine whether to allow the service module in the first server to newly add a task according to the resource usage of the first server, so as to avoid a situation that another service module in the first server cannot use the resource of the first server due to the fact that a certain service module in the first server occupies the resource of the first server without using the resource, and the technical solution may flexibly control the service module in the first server to newly add a task according to the resource usage of the first server, the resource utilization rate of the first server is improved.
The embodiment shown in fig. 5 will be described with reference to specific examples.
For example, please refer to fig. 6, which is a schematic diagram illustrating a resource management method according to an embodiment of the present application, and fig. 6 introduces a first implementation manner of the first case of the embodiment shown in fig. 5 by taking the application of the resource management method to the implementation environment shown in fig. 2 as an example. As shown in FIG. 6, the server 11 comprises service modules 112-114, a resource manager 111 is integrated in the server 11, and an equivalent task quantity threshold value R11 of the server 11 is recorded in the resource manager 111. The service module 112 runs a tasks, the service module 112 converts the amount of resources consumed by running the a tasks into a1 equivalent tasks (that is, the service module 112 determines the equivalent task number of the service module 112 to be a1 according to the amount of resources consumed by running the a tasks), and sends the equivalent task number a1 of the service module 112 to the resource manager 111. Similarly, the service module 113 sends the equivalent task number B1 of the service module 113 to the resource manager 111, and the service module 114 sends the equivalent task number C1 of the service module 114 to the resource manager 111. The resource manager 111 determines the number of the equivalent tasks already running on the server 11 as X (X ═ a1+ B1+ C1) according to the number of the equivalent tasks sent by the service modules 112 to 114, and records the number of the equivalent tasks as X. Taking the first service module as the service module 112 as an example, when the service module 112 needs to add a new task, it sends a detection request to the resource manager 111; after receiving the detection request, the resource manager 111 detects whether the number of equivalent tasks that have been executed on the server 11 is X, and whether the number of equivalent tasks reaches the threshold R11 of the number of equivalent tasks of the server 11; if the number of the equivalent tasks already running on the server 11 is X, which reaches the threshold value R11 of the number of the equivalent tasks of the server 11, the resource manager 111 prohibits the service module 112 from adding new tasks; if the number of equivalent tasks already running on the server 11 is X, but the threshold number of equivalent tasks R11 for the server 11 is not reached, the resource manager 111 allows the service module 112 to add new tasks.
For example, please refer to fig. 7, which is a schematic diagram illustrating another resource management method provided in an embodiment of the present application, and fig. 7 introduces a second implementation manner of the first case of the embodiment shown in fig. 5 by taking application of the resource management method to the implementation environment shown in fig. 2 as an example. Different from fig. 6, in fig. 7, the threshold value R11 of the number of equivalent tasks of the server 11 is recorded in the service modules 112 to 114 of the server 11, but not in the resource manager 111 (the resource manager 111 may record the threshold value of the number of equivalent tasks of the server 11, or may not record the threshold value of the number of equivalent tasks of the server 11, which is not limited in the present application). Taking the first service module as the service module 113 as an example, when the service module 113 needs to add a new task, the service module 113 sends a query request to the resource manager 111; after receiving the query request, the resource manager 111 queries the number of the equivalent tasks that have been run on the server 11 as X, and sends the number of the equivalent tasks that have been run on the server 11 to the service module 113, and after receiving the number of the equivalent tasks that have been run on the server 11, the service module 113 detects whether the number of the equivalent tasks that have been run on the server 11 is X, and whether the number of the equivalent tasks that have been run on the server 11 reaches the threshold value R11 of the number of the equivalent tasks of the server 11; if the number of the equivalent tasks already running on the server 11 is X, which reaches the threshold value R11 of the number of the equivalent tasks of the server 11, the service module 113 cannot add new tasks; if the number of the equivalent tasks already running on the server 11 is X, but the threshold value R11 of the number of the equivalent tasks of the server 11 is not reached, the service module 113 can add a new task.
For example, please refer to fig. 8, which is a schematic diagram illustrating another resource management method provided in an embodiment of the present application, and fig. 8 introduces the first implementation manner of the second case of the embodiment shown in fig. 5 by taking the application of the resource management method to the implementation environment shown in fig. 3 as an example. As shown in FIG. 8, the server 22 includes service modules 221-223, the server 23 includes service modules 231-233, the resource manager 21 is located outside the server 22 and the server 23, and the resource manager 21 records an equivalent task number threshold R22 of the server 22 and an equivalent task number threshold R23 of the server 23. The service module 221 runs D tasks, and the service module 221 determines the equivalent task number D1 of the service module 221 according to the resource amount consumed by running the D tasks, and sends the equivalent task number D1 to the resource manager 111. Similarly, the service module 222 sends the equivalent task number E1 of the service module 222 to the resource manager 111, and the service module 223 sends the equivalent task number F1 of the service module 223 to the resource manager 111. The resource manager 21 determines the number of the equivalent tasks that have been run on the server 22 to be Y (Y is D1+ E1+ F1) according to the number of the equivalent tasks sent by the service modules 221 to 223 of the server 22, and records the number Y of the equivalent tasks that have been run on the server 22. Similarly, the resource manager 21 determines the number of the equivalent tasks that have been run on the server 23 to be Z (Z is G1+ H1+ M1) according to the number of the equivalent tasks sent by the service modules 231 to 233 of the server 23, and records the number Z of the equivalent tasks that have been run on the server 23. Taking the first server as the server 22 and the first service module as the service module 221 in the server 22 as an example, when the service module 221 needs to add a new task, it sends a detection request to the resource manager 21; after receiving the detection request, the resource manager 21 detects whether the number of equivalent tasks that have been executed on the server 22 is Y, and whether the number of equivalent tasks reaches the threshold R22 of the number of equivalent tasks of the server 22; if the number of equivalent tasks already running on the server 22 is Y, which reaches the threshold value R22 of the number of equivalent tasks of the server 22, the resource manager 21 prohibits the service module 221 from adding new tasks; if the number of equivalent tasks already running on the server 22 is Y, which does not reach the threshold number of equivalent tasks R22 for the server 22, the resource manager 21 allows the service module 221 to add new tasks.
For example, please refer to fig. 9, which is a schematic diagram illustrating another resource management method provided in an embodiment of the present application, and fig. 9 introduces a second implementation manner of the second case of the embodiment shown in fig. 5 by taking the application of the resource management method to the implementation environment shown in fig. 3 as an example. Unlike fig. 8, in fig. 9, the equivalent task number threshold of each server is recorded in the service module of the server, instead of being recorded in the resource manager 21 (the resource manager 21 may record the equivalent task number threshold of the server, or may not record the equivalent task number threshold of the server, which is not limited in this application). Taking the first server as the server 22 and the first service module as the service module 222 in the server 22 as an example, when the service module 222 needs to add a new task, it sends a query request to the resource manager 21; after receiving the query request, the resource manager 21 queries the number of the equivalent tasks that have been run on the server 22 to be Y, and sends the number of the equivalent tasks that have been run on the server 22 to the service module 222, and after receiving the number of the equivalent tasks that have been run on the server 22, the service module 222 detects whether the number of the equivalent tasks that have been run on the server 22 reaches the threshold value R22 of the number of the equivalent tasks of the server 22; if the number Y of equivalent tasks already running on the server 22 reaches the threshold number R22 of equivalent tasks of the server 22, the service module 222 cannot add new tasks; if the number of equivalent tasks Y already running on the server 22 does not reach the threshold number of equivalent tasks R22 for the server 22, the service module 222 can add a new task.
For example, please refer to fig. 10, which is a schematic diagram illustrating another resource management method provided in an embodiment of the present application, and fig. 9 introduces a third implementation manner and a fourth implementation manner of the second case of the embodiment shown in fig. 5 by taking the application of the resource management method to the implementation environment shown in fig. 3 as an example. Different from fig. 8, in fig. 10, the threshold of the number of equivalent tasks of each server is recorded in the resource management module of the server, instead of being recorded in the resource manager 21 (the resource manager 21 may record the threshold of the number of equivalent tasks of the server, or may not record the threshold of the number of equivalent tasks of the server, which is not limited in this application). Take the example where the first server is the server 22 and the first service module is the service module 222 in the server 22. A third implementation for the second case of the embodiment shown in fig. 5: when the service module 222 needs to add a new task, it sends a query request to the resource manager 21; after receiving the query request, the resource manager 21 queries the number of the equivalent tasks that have been run on the server 22 to be Y, and sends the number of the equivalent tasks that have been run on the server 22 to the service module 222, after receiving the number of the equivalent tasks that have been run on the server 22, the service module 222 sends a detection request carrying the number of the equivalent tasks that have been run on the server 22 to the resource management module 224, and after receiving the detection request, the resource management module 224 detects whether the number of the equivalent tasks that have been run on the server 22 reaches the threshold value R22 of the number of the equivalent tasks of the server 22; if the number Y of equivalent tasks already running on the server 22 reaches the threshold number R22 of equivalent tasks for the server 22, the resource management module 224 prohibits the service module 222 from adding new tasks; if the number of equivalent tasks Y already running on the server 22 does not reach the threshold number of equivalent tasks R22 for the server 22, the resource management module 224 allows the service module 222 to add new tasks. A fourth implementation for the second case of the embodiment shown in fig. 5: when the service module 222 needs to add a new task, trigger the resource management module 224 to send a query request to the resource manager 21 (for example, the service module 222 sends a detection request to the resource management module 224 to trigger the resource management module 224 to send a query request to the resource manager 21); after receiving the query request, the resource manager 21 queries the number of the equivalent tasks that have been run on the server 22 to be Y, and sends the number of the equivalent tasks that have been run on the server 22 to the resource management module 224, and after receiving the number of the equivalent tasks that have been run on the server 22, the resource management module 224 detects whether the number of the equivalent tasks that have been run on the server 22 reaches the threshold value R22 of the number of the equivalent tasks of the server 22; if the number Y of equivalent tasks already running on the server 22 reaches the threshold number R22 of equivalent tasks for the server 22, the resource management module 224 prohibits the service module 222 from adding new tasks; if the number of equivalent tasks Y already running on the server 22 does not reach the threshold number of equivalent tasks R22 for the server 22, the resource management module 224 allows the service module 222 to add new tasks.
The foregoing is an introduction to the resource management method of the present application, and the following is an introduction to an apparatus embodiment of the present application, which may be used to execute the method embodiment of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 11, a schematic diagram of a logical structure of a resource manager 1100 provided in an embodiment of the present application is shown, where the resource manager 1100 may be a server or a functional module in the server. The resource manager 1100 includes:
a detecting unit 1110, configured to detect whether an amount of consumed resources of a first server reaches a threshold of an amount of resources of the first server after determining that the first service module in the first server needs to be newly added with a task, where the first server includes at least one service module, the first service module is any one of the at least one service module, and the resource manager is at least configured to manage the at least one service module;
the first determining unit 1120 is configured to determine whether to allow the first service module to add a new task according to the detection result.
Optionally, the first determining unit 1120 is configured to: if the consumed resource amount of the first server reaches the resource amount threshold of the first server, forbidding the first service module to newly add a task; and if the consumed resource amount of the first server does not reach the resource amount threshold value of the first server, allowing the first service module to newly add a task.
Optionally, the detecting unit 1110 is configured to:
detecting whether the number of the equivalent tasks already run on the first server reaches an equivalent task number threshold of the first server, wherein the equivalent task number already run on the first server is determined according to the consumed resource amount of the first server, and the equivalent task number threshold of the first server is determined according to the resource amount threshold of the first server.
Optionally, with continued reference to fig. 11, the resource manager 1100 further includes:
a receiving unit 1130, configured to receive the equivalent task number sent by each service module in the first server before the detecting unit 1110 detects whether the equivalent task number that has been run on the first server reaches the equivalent task number threshold of the first server, where the equivalent task number sent by each service module is determined according to the resource amount consumed by the current running task of the service module; a second determining unit 1140, configured to determine the number of equivalent tasks that have been run on the first server according to the number of equivalent tasks sent by all service modules in the first server; and the number of the first and second groups,
the third determining unit 1150 is further configured to determine the equivalent task number threshold of the first server according to the resource amount threshold of the first server before the detecting unit 1110 detects whether the number of equivalent tasks already running on the first server reaches the equivalent task number threshold of the first server.
Optionally, the resource manager 1100 is integrated in the first server, and the detecting unit 1110 is configured to:
when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving the query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches the resource amount threshold of the first server.
Optionally, the resource manager is located outside the first server, and the detecting unit 1110 is configured to:
when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module triggers a resource management module in the first server to detect whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by a resource management module in the first server, sending the consumed resource amount of the first server to the resource management module, so that the resource management module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
In summary, the resource manager provided in the present application can detect whether the consumed resource amount of the first server reaches the resource amount threshold of the first server, and determining whether to allow the service module in the first server to newly add a task according to the detection result, that is, the resource manager may determine whether to allow the service module in the first server to add a new task based on the resource usage of the first server, therefore, the situation that the resource of the first server is occupied by a certain service module in the first server under the condition that the resource is not used so that other service modules in the first server can not use the resource of the first server can be avoided, the technical scheme can flexibly control the service module newly added task in the first server according to the resource use condition of the first server, and is beneficial to improving the resource utilization rate of the first server.
Referring to fig. 12, a schematic diagram of a hardware structure of a resource manager 1200 according to an embodiment of the present application is shown, where the resource manager 1200 may be a server. Referring to fig. 12, the resource manager 1200 may include: a processor 1202, a memory 1204, a communication interface 1206, and a bus 1208. The processor 1202, the memory 1204, and the communication interface 1206 are communicatively coupled to each other by a bus 1208. Those skilled in the art will appreciate that the connections between the processor 1202, the memory 1204, and the communication interface 1206 shown in fig. 12 are exemplary only, and that the processor 1202, the memory 1204, and the communication interface 1206 may be communicatively coupled to each other using connections other than the bus 1208 in implementations.
Where the processor 1202 may be a general-purpose processor, the general-purpose processor may be a processor that performs certain steps and/or operations by reading and executing a computer program (e.g., computer program 12042) stored in a memory (e.g., memory 1204), which may use data stored in the memory (e.g., memory 1204) in performing the above steps and/or operations. The stored computer programs may be executed, for example, to implement the related functions of the aforementioned detection unit 1110, first determination unit 1120, second determination unit 1140, and third determination unit 1150. A general purpose processor may be, for example but not limited to, a CPU. Further, the processor 1202 may also be a special purpose processor, which may be a specially designed processor for performing certain steps and/or operations, such as, but not limited to, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a Graphics Processor (GPU), or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, etc. Further, processor 1202 may also be a combination of multiple processors, such as a multi-core processor. The processor 1202 may include at least one circuit to perform all or part of the steps of the resource management methods provided by the above-described embodiments.
The communication interface 1206 may include, among other things, an I/O interface, a physical interface, a logical interface, and the like for implementing interconnection of devices inside the resource manager 1200, and an interface for implementing interconnection of the resource manager 1200 with other devices (e.g., servers). The physical interface may be a Gigabit Ethernet (GE), which may be used to implement the interconnection of the resource manager 1200 with other devices (e.g., servers), and the logical interface may be an interface within the resource manager 1200, which may be used to implement the interconnection of devices within the resource manager 1200. It is easy to understand that the communication interface 1206 can be used for the resource manager 1200 to communicate with other devices, for example, the communication interface 1206 is used for the transmission and reception of information between the resource manager 1200 and other network devices, and the communication interface 1206 can implement the related functions of the receiving unit 1130.
The bus 1208 may be any type of communication bus, such as a system bus, that interconnects the processor 1202, the memory 1204, and the communication interface 1206.
The above devices may be respectively disposed on separate chips, or at least a part or all of the devices may be disposed on the same chip. Whether each device is separately disposed on a different chip or integrated on one or more chips will often depend on the needs of the product design. The embodiment of the present application does not limit the specific implementation form of the above device.
The resource manager 1200 shown in FIG. 12 is merely exemplary, and in implementation, the resource manager 1200 may also include other components, which are not listed here. The resource manager 1200 shown in fig. 12 may perform resource management on the server by performing all or part of the steps of the resource management method provided by the above-described embodiments.
The embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, all or part of the steps of the resource management method provided by the above method embodiment are implemented.
Embodiments of the present application provide a computer program product comprising instructions, which when run on a computer, cause the computer to perform all or part of the steps of the resource management method as provided in the above method embodiments.
Embodiments of the present application provide a chip, which includes a programmable logic circuit and/or program instructions, and when the chip is operated, the chip is configured to implement all or part of the steps of the resource management method provided by the above method embodiments.
An embodiment of the present application provides a resource management system, including: the resource manager is used for managing resources of the at least one server. The resource management system may illustratively be the resource management system 20 shown in FIG. 3.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product comprising one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or can comprise one or more data storage devices, such as a server, a data center, etc., integrated with the available medium. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium (e.g., solid state disk), among others.
In this application, the terms "first" and "second," etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The term "at least one" means one or more, and "a plurality" means two or more, unless expressly defined otherwise.
Different types of embodiments such as the method embodiment and the apparatus embodiment provided by the embodiment of the present application can be mutually referred to, and the embodiment of the present application does not limit this. The sequence of operations in the method embodiments provided in the present application can be appropriately adjusted, and the operations can also be increased or decreased in response to situations, and any method that can be easily conceived by those skilled in the art within the technical scope disclosed in the present application shall be covered by the protection scope of the present application, and therefore will not be described again.
In the corresponding embodiments provided in the present application, it should be understood that the disclosed apparatus and the like may be implemented by other configuration modes. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be through some interfaces, indirect coupling or communication connection between devices or units, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts described as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network devices (for example, terminal devices). Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above description is only an exemplary embodiment of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (15)

1. A resource management method is applied to a resource manager, and the method comprises the following steps:
after determining that a first service module in a first server needs a new task, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server, wherein the first server comprises at least one service module, the first service module is any one of the at least one service module, and the resource manager is at least used for managing the at least one service module;
and determining whether to allow the first service module to newly add the task according to the detection result.
2. The method of claim 1,
the determining whether to allow the first service module to newly add the task according to the detection result includes:
if the consumed resource amount of the first server reaches the resource amount threshold of the first server, forbidding the first service module to add a new task;
and if the consumed resource amount of the first server does not reach the resource amount threshold value of the first server, allowing the first service module to add a new task.
3. The method according to claim 1 or 2,
the detecting whether the amount of consumed resources of the first server reaches a threshold amount of resources of the first server comprises:
detecting whether the number of the equivalent tasks already run on the first server reaches an equivalent task number threshold of the first server, wherein the number of the equivalent tasks already run on the first server is determined according to the consumed resource amount of the first server, and the equivalent task number threshold of the first server is determined according to the resource amount threshold of the first server.
4. The method of claim 3,
before detecting whether the number of equivalent tasks already running on the first server reaches the threshold number of equivalent tasks for the first server, the method further comprises:
receiving the number of equivalent tasks sent by each service module in the first server, wherein the number of the equivalent tasks sent by each service module is determined according to the resource amount consumed by the current running task of the service module; determining the number of the equivalent tasks which have run on the first server according to the number of the equivalent tasks which are sent by all the service modules in the first server;
and the number of the first and second groups,
and determining an equivalent task quantity threshold of the first server according to the resource quantity threshold of the first server.
5. The method according to any one of claims 1 to 4,
the resource manager is integrated in the first server,
the detecting whether the amount of consumed resources of the first server reaches a threshold amount of resources of the first server comprises:
when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
6. The method according to any one of claims 1 to 4,
the resource manager is located outside the first server,
said detecting whether the amount of consumed resources of the first server exceeds the threshold amount of resources of the first server comprises:
when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module triggers a resource management module in the first server to detect whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by a resource management module in the first server, sending the consumed resource amount of the first server to the resource management module, so that the resource management module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
7. A resource manager, wherein the resource manager comprises:
the system comprises a detection unit, a resource manager and a task management unit, wherein the detection unit is used for detecting whether the consumed resource amount of a first server reaches a resource amount threshold of the first server after determining that a first service module in the first server needs a new task, the first server comprises at least one service module, the first service module is any one of the at least one service module, and the resource manager is at least used for managing the at least one service module;
and the first determining unit is used for determining whether to allow the first service module to newly add the task according to the detection result.
8. The resource manager of claim 7,
the first determination unit is configured to: if the consumed resource amount of the first server reaches the resource amount threshold of the first server, forbidding the first service module to add a new task; and if the consumed resource amount of the first server does not reach the resource amount threshold value of the first server, allowing the first service module to newly add a task.
9. The resource manager according to claim 7 or 8,
the detection unit is used for: detecting whether the number of the equivalent tasks already run on the first server reaches an equivalent task number threshold of the first server, wherein the number of the equivalent tasks already run on the first server is determined according to the consumed resource amount of the first server, and the equivalent task number threshold of the first server is determined according to the resource amount threshold of the first server.
10. The resource manager of claim 9, wherein the resource manager further comprises:
a receiving unit, configured to receive the equivalent task number sent by each service module in the first server before the detecting unit detects whether the equivalent task number that has been run on the first server reaches the equivalent task number threshold of the first server, where the equivalent task number sent by each service module is determined according to the resource amount consumed by the current running task of the service module; a second determining unit, configured to determine, according to the equivalent task numbers sent by all the service modules in the first server, the equivalent task number that has been run on the first server;
and the number of the first and second groups,
the third determining unit is further configured to determine the equivalent task quantity threshold of the first server according to the resource quantity threshold of the first server before the detecting unit detects whether the equivalent task quantity running on the first server reaches the equivalent task quantity threshold of the first server.
11. The resource manager according to any of claims 7 to 10,
the resource manager is integrated in the first server,
the detection unit is used for:
when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
12. The apparatus according to any one of claims 7 to 10,
the resource manager is located outside the first server,
the detection unit is used for:
when a detection request sent by the first service module is received, detecting whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by the first service module, sending the consumed resource amount of the first server to the first service module, so that the first service module triggers a resource management module in the first server to detect whether the consumed resource amount of the first server reaches a resource amount threshold of the first server; alternatively, the first and second electrodes may be,
when receiving a query request sent by a resource management module in the first server, sending the consumed resource amount of the first server to the resource management module, so that the resource management module detects whether the consumed resource amount of the first server reaches a resource amount threshold of the first server.
13. A resource management system, comprising: at least one server and a resource manager according to any of claims 7 to 12.
14. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, implements the resource management method according to any one of claims 1 to 6.
15. A chip comprising programmable logic circuitry and/or program instructions for performing the method of resource management of any of claims 1 to 6 when the chip is run.
CN202011354052.0A 2020-11-26 2020-11-26 Resource management method, device and system Pending CN114629792A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011354052.0A CN114629792A (en) 2020-11-26 2020-11-26 Resource management method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011354052.0A CN114629792A (en) 2020-11-26 2020-11-26 Resource management method, device and system

Publications (1)

Publication Number Publication Date
CN114629792A true CN114629792A (en) 2022-06-14

Family

ID=81895259

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011354052.0A Pending CN114629792A (en) 2020-11-26 2020-11-26 Resource management method, device and system

Country Status (1)

Country Link
CN (1) CN114629792A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024021497A1 (en) * 2022-07-29 2024-02-01 天翼云科技有限公司 Product medium downloading task scheduling method and apparatus, and electronic device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024021497A1 (en) * 2022-07-29 2024-02-01 天翼云科技有限公司 Product medium downloading task scheduling method and apparatus, and electronic device

Similar Documents

Publication Publication Date Title
US20220121384A1 (en) Hot Data Management Method, Apparatus, and System
US7623460B2 (en) Cluster system, load distribution method, optimization client program, and arbitration server program
US20200029110A1 (en) Bandwidth Control Method and Apparatus, and Device
US7930344B2 (en) Incremental run-time session balancing in a multi-node system
CN110858843B (en) Service request processing method and device and computer readable storage medium
US20040243702A1 (en) Data collection in a computer cluster
CN109960575B (en) Computing capacity sharing method, system and related equipment
CN111526031B (en) Expansion and contraction method and equipment of service Virtual Network Function (VNF)
CN111562889B (en) Data processing method, device, system and storage medium
JP2010537266A (en) Proactive power management in parallel computers
CN112685148B (en) Asynchronous communication method and device for mass terminals, computer equipment and storage medium
CN109039933B (en) Cluster network optimization method, device, equipment and medium
CN105472291A (en) Digital video recorder with multiprocessor cluster and realization method of digital video recorder
CN112416594A (en) Micro-service distribution method, electronic equipment and computer storage medium
CN114629792A (en) Resource management method, device and system
CN111418187A (en) Scalable statistics and analysis mechanism in cloud networks
CN213876703U (en) Resource pool management system
CN113766013A (en) Session creation method, device, equipment and storage medium
CN117032977A (en) Mixed part application resource allocation method and device, computer equipment and storage medium
CN111953567A (en) Method, system, equipment and medium for configuring multi-cluster management software parameters
CN111597041A (en) Calling method and device of distributed system, terminal equipment and server
Zhai et al. Towards robust multi-tenant clouds through multi-constrained VM placement
CN114567637A (en) Method and system for intelligently setting weight of load balancing back-end server
CN113783912A (en) Request distribution method, device and storage medium
CN116055565B (en) Data transmission method, system, device, electronic equipment and storage medium

Legal Events

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