WO2018107945A1 - 一种实现硬件资源分配的方法、装置及存储介质 - Google Patents

一种实现硬件资源分配的方法、装置及存储介质 Download PDF

Info

Publication number
WO2018107945A1
WO2018107945A1 PCT/CN2017/112254 CN2017112254W WO2018107945A1 WO 2018107945 A1 WO2018107945 A1 WO 2018107945A1 CN 2017112254 W CN2017112254 W CN 2017112254W WO 2018107945 A1 WO2018107945 A1 WO 2018107945A1
Authority
WO
WIPO (PCT)
Prior art keywords
amount
allocateable
resource
maximum
resource amount
Prior art date
Application number
PCT/CN2017/112254
Other languages
English (en)
French (fr)
Inventor
易固武
胥彪
杨繁
王珏
杨睿
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018107945A1 publication Critical patent/WO2018107945A1/zh
Priority to US16/284,455 priority Critical patent/US11132229B2/en
Priority to US17/396,584 priority patent/US11768706B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/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/5044Allocation 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 hardware capabilities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5013Request control

Definitions

  • the present invention relates to the field of the Internet, and in particular, to a method, an apparatus, and a storage medium for implementing hardware resource allocation.
  • the resources of a computer device can be divided into computing resources and storage resources, wherein the computing resources are mainly used for calculation, such as a CPU (Central Processing Unit), a memory, etc., and the storage resources are mainly used for reading and writing data, and can be used by a disk. bear.
  • the computing resources and storage resources of a single device become larger and larger, and the unit cost is also getting cheaper.
  • multiple applications can be deployed in the device, such as deploying multiple database applications to one device to reduce the cost of using a single database application.
  • the hardware resources in the device are usually leased to different users according to the application.
  • the users of these sub-tenancy applications can be called tenants.
  • Multiple applications are deployed on one device, so that the hardware resources of one device are leased by multiple tenants.
  • the usage of hardware resources on multiple devices by multiple tenants is based on operating system allocation and scheduling.
  • Preemptive hardware resource allocation and usage policy that is, a busy application can preempt the hardware resources of the device for its own calculation and storage, and an idle application cannot be used for calculation and storage in this scenario.
  • the processing power of hardware resources is greatly reduced.
  • the way in which hardware resources are allocated in the prior art is unfair to tenants of idle applications.
  • embodiments of the present invention provide a method, device, and storage for implementing hardware resource allocation.
  • the medium solves the technical problem that the hardware resource allocation in the preemptive manner in the prior art reduces the idle application processing capability.
  • a first aspect of the embodiments of the present invention provides a method for implementing hardware resource allocation, where the method is applied to a server, and obtains a maximum allocateable resource amount of the first device, where the first device does not perform hardware resource allocation.
  • the maximum amount of allocatable resources is determined as the amount of allocateable resources of the first device; the method includes:
  • the result of subtracting the amount of the allocated resources of the selected device from the amount of the requested resource is determined as the amount of allocatable resources of the selected device.
  • the method further includes:
  • the method further includes:
  • the amount of the requested resource is greater than the amount of the allocateable resource of the selected device, determining whether all devices in the first device and the second device are selected;
  • the method further includes:
  • the requested resource amount is not greater than the maximum allocateable resource amount of the first device and the second device, performing one of the first device and the second device as the selected device is performed.
  • the selected device is specifically configured to allocate the hardware resource of the requested resource amount to the user to establish a database application.
  • the maximum allocatable resource amount includes a maximum allotable disk space equal to a maximum disk space minus an operating system occupied disk space, and a maximum allocatable memory space. Equal to the maximum memory space minus the operating system occupied memory space; the allocateable resource amount includes an allotable disk space and an allocatable memory space; the requested resource amount includes a request disk space and a request memory space.
  • a second aspect of the embodiments of the present invention provides an apparatus for implementing hardware resource allocation, where the apparatus includes:
  • a first acquiring unit configured to acquire a maximum allocateable resource amount of the first device, where the maximum allocateable resource amount is determined as an allocatable resource amount of the first device when the first device does not perform hardware resource allocation ;
  • a receiving unit configured to receive a requested resource amount input by the user
  • a first determining unit configured to determine whether the requested resource quantity is greater than an allocatable resource quantity of the selected device, where the selected device is the first device;
  • a sending unit configured to: if the judgment result of the first determining unit is that the requested resource amount is not large Sending, by the selected device, a resource allocation request including the requested resource amount to the selected device, so that the selected device allocates the hardware resource of the requested resource amount to the The user establishes an application instance, where the maximum available resource of the application instance is not greater than the requested resource amount;
  • a determining unit configured to determine, as a result of the amount of the allocateable resources of the selected device, the amount of the requested resource, as an allocatable resource amount of the selected device.
  • the device further includes:
  • a second acquiring unit configured to acquire a maximum allocateable resource amount of the second device, where the maximum allocateable resource amount is determined as the allocateable resource amount of the second device when the second device does not perform hardware resource allocation ;
  • a selecting unit configured to: after the receiving unit receives the requested resource amount input by the user, the first determining unit determines whether the requested resource amount is greater than an allocateable resource amount of the selected device, before the first One of the device and the second device is selected as the selected device.
  • the device further includes:
  • a second determining unit configured to determine, if the determination result of the first determining unit is that the requested resource amount is greater than an allocatable resource amount of the selected device, determine all of the first device and the second device Whether the equipment is selected;
  • the selecting unit is further configured to: if the determination result of the second determining unit is that all the devices in the first device and the second device are not selected, re-executing in the first device and the One device is selected as the selected device in the second device.
  • the device further includes:
  • a third determining unit configured to determine whether the requested resource quantity is greater than a maximum allocateable resource quantity of the first device and the second device;
  • the selecting unit is further configured to: if the judgment result of the third determining unit is that the requested resource amount is not greater than a maximum allocateable resource amount of the first device and the second device, perform the A device and a second device are selected as the selected device.
  • the selected device is specifically configured to allocate the hardware resource of the requested resource amount to the user to establish a database application.
  • the maximum allocatable resource amount includes a maximum allotable disk space equal to a maximum disk space minus an operating system occupied disk space, and a maximum allocatable memory space. Equal to the maximum memory space minus the operating system occupied memory space; the allocateable resource amount includes an allotable disk space and an allocatable memory space; the requested resource amount includes a request disk space and a request memory space.
  • a third aspect of the embodiments of the present invention provides a server, including: a processor and a memory, where the program stores program instructions;
  • the method of any one of the optional implementations of the first aspect or the first aspect is performed when the processor executes the program instructions stored in the memory.
  • a still further aspect of the embodiments of the present invention provides a computer readable storage medium storing program instructions, when the program instructions are run on a server, causing the server to perform the following steps:
  • the result of subtracting the amount of the allocated resources of the selected device from the amount of the requested resource is determined as the amount of allocatable resources of the selected device.
  • program instructions further cause the server to perform the following steps:
  • program instructions further cause the server to perform the following steps:
  • the amount of the requested resource is greater than the amount of the allocateable resource of the selected device, determining whether all devices in the first device and the second device are selected;
  • program instructions further cause the server to perform the following steps:
  • the requested resource amount is not greater than the maximum allocateable resource amount of the first device and the second device, performing one of the first device and the second device as the selected device is performed.
  • the selected device is specifically configured to allocate the hardware resource of the requested resource amount to the user to establish a database application.
  • the maximum allocatable resource amount includes a maximum allotable disk space equal to a maximum disk space minus an operating system occupied disk space, and a maximum allocatable memory space. Equal to the maximum memory space minus the operating system occupied memory space; the allocateable resource amount includes an allotable disk space and an allocatable memory space; the requested resource amount includes a request disk space and a request memory space.
  • the embodiment of the present invention determines the amount of the resource that can be allocated by a certain device, and receives the amount of the requested resource input by the user.
  • the amount of the requested resource is not greater than the amount of the allocateable resource of the device, the hardware resource of the requested resource is allocated to the user.
  • the application while reducing the amount of available resources of the device minus the amount of requested resources as the updated amount of allocable resources, thereby controlling and limiting the use and preemption of the device hardware resources by a single application, thereby avoiding busy application preemption idle. The scene of the application.
  • FIG. 1 is a schematic diagram of an application scenario according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of an embodiment of a method for implementing hardware resource allocation according to an embodiment of the present invention
  • FIG. 3 is another flowchart of an embodiment of a method for implementing hardware resource allocation according to an embodiment of the present disclosure
  • FIG. 4 is another flowchart of an embodiment of a method for implementing hardware resource allocation according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of an apparatus for implementing hardware resource allocation according to an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of a server according to an embodiment of the present invention.
  • the application's use of computer hardware resources is based on operating system allocation and scheduling.
  • a busy database application can preempt device hardware resources for its own calculations and Storage, while an idle database application can not get computing and storage resources in this scenario, its processing capacity is greatly reduced, wherein the database application can include a database and a database instance, the database instance can be understood as a handler for operating the database .
  • the current equipment usually allows multiple tenants to use at the same time.
  • the tenant is the user who uses the computer hardware resources.
  • the way of allocating hardware resources in the prior art should be idle. It is unfair to use tenants of the program.
  • an embodiment of the present invention provides a method and apparatus for implementing hardware resource allocation, which is used to solve the adverse impact of resource preemption on idle tenants, allocate and control hardware resources used by each tenant, and ensure a busy application. Use hardware resources without reducing the resource usage of idle applications.
  • FIG. 1 a schematic diagram of an application scenario of an embodiment of the present invention is shown.
  • the method for implementing hardware resource allocation provided in the embodiment of the present invention will be described from the perspective of a device for realizing hardware resource allocation, and the device for realizing hardware resource allocation is described.
  • it can be loaded on a device or server.
  • the device for allocating hardware resources provided in the embodiment of the present invention may be directly loaded in the device or loaded in the server to implement allocation of hardware resources of the device; in other cases
  • the device for allocating hardware resources provided in the embodiment of the present invention may be loaded in a device or loaded in a server to implement allocation of hardware resources of the device.
  • a method for realizing hardware resource allocation in different situations will be described.
  • an embodiment of a method for implementing hardware resource allocation is provided in the embodiment of the present invention.
  • the method for implementing hardware resource allocation may be applied to a server, and the method for implementing hardware resource allocation may include the following steps:
  • Step 201 Acquire a maximum allocateable resource quantity of the first device, and determine, as the first device, the maximum allocateable resource quantity, the maximum allocateable resource quantity of the first device.
  • the hardware resources of the first device need to be allocated.
  • the maximum allocateable resource amount of the first device is obtained.
  • the maximum allocatable resource amount may include a maximum allotable disk space and a maximum allocateable memory space.
  • the maximum allocateable disk space is equal to the maximum disk space minus the operating system consuming disk space
  • the maximum allocateable memory space is equal to the maximum memory space minus the operating system occupied memory space.
  • the maximum allocateable disk space of the first device is equal to the maximum disk space of the first device minus the disk space occupied by the operating system in the first device
  • the maximum allocateable memory space of the first device is equal to the maximum memory space of the first device minus The memory space occupied by the operating system in the first device.
  • the maximum allocateable resource amount of the first device may be determined as the allocateable resource amount of the first device.
  • the allocateable resource amount may include Allocating disk space and allocating memory space, that is, when the first device does not perform hardware resource allocation, determining the maximum allocable disk space of the first device as the allotable disk space of the first device, and maximizing the first device.
  • the memory space is determined as the allocatable memory space of the first device.
  • the maximum disk space can be represented by SMAX.
  • the maximum memory space can be represented by MMAX.
  • the operating system occupies disk space and can be represented by OSS.
  • the operating system occupies memory space and can be represented by OSM.
  • the maximum allocateable disk Space can be represented by DSMAX, and the maximum allocatable memory space can be represented by DMMAX.
  • the above relationship can be expressed as:
  • Step 202 Receive the requested resource amount input by the user.
  • the amount of the requested resource may be input in the user's client.
  • the requested resource amount may include requesting disk space and requesting memory space. For example, the user enters 100G of requested disk space, 10G of requested memory space to build a database application.
  • the amount of request resources for disk space can be represented by SDER, and the amount of requested resources of the memory space can be represented by MDER.
  • Step 203 Determine whether the requested resource quantity is greater than the allocateable resource quantity of the selected device, and the selected device is the first device.
  • determining whether the requested resource amount is greater than the allocateable resource amount of the selected device may be determining whether the requested disk space is greater than the allotable disk space and whether the requested memory space is greater than the allocatable memory space.
  • the hardware resource allocation cannot be completed, and the prompt information may be sent to the user; if the resource is requested If the amount of the allocated resources is not greater than the amount of the allocated resources of the selected device, that is, the requested disk space is not greater than the allocateable disk space and the requested memory space is not greater than the allocateable memory space, the hardware resource allocation of the first device may be performed to perform the subsequent steps.
  • Step 204 If the requested resource amount is not greater than the allocateable resource amount of the selected device, send a resource allocation request including the requested resource amount to the selected device, so that the selected device allocates the hardware resource requesting the resource amount to the user.
  • the selected device may allocate a hardware resource requesting a resource amount to the user to establish an application instance, and the application instance may use a maximum amount of resources not greater than the requested resource amount.
  • the maximum usable memory of the application instance is MDER
  • the disk capacity is SDER.
  • the resource allocation request including the requested resource amount is sent to the first device, if the device for implementing hardware resource allocation provided in the embodiment of the present invention is directly loaded in the first In a device, the resource allocation request may be sent in the first device. If the device for implementing hardware resource allocation provided in the embodiment of the present invention is directly loaded in the server, the resource allocation request may be sent from the server to the first device. In this embodiment, the first device receives the resource allocation request, and may allocate the hardware resource that requests the resource amount to the user. Specifically, the hardware resource that requests the disk space size and the requested memory space size may be allocated to send the requested resource amount. User. In some possible implementations of the present invention, the selected device may be specifically configured to allocate a hardware resource that requests the amount of resources to the user to establish a database application. In this embodiment, the selected device may be the first device.
  • Step 205 Determine the result of subtracting the amount of the requestable resource from the amount of the allocated resource of the selected device as being Select the amount of resources that can be allocated for the device.
  • the selected device After the selected device performs hardware resource allocation, it is necessary to update the allocateable resource amount of the selected device, and the result of subtracting the requested resource amount from the original allocateable resource amount is the updated allocateable resource amount.
  • the result of the allocated disk space of the selected device minus the requested disk space may be determined as the allotable disk space of the selected device, and the allocateable memory space of the selected device is subtracted from the request.
  • the result of the memory space is determined as the allocatable memory space of the selected device.
  • the selected device may be the first device.
  • the embodiment of the present invention receives the amount of the requestable resource input by the user by determining the amount of the allocateable resource of the device, and allocates the hardware resource of the requested resource amount when the requested resource amount is not greater than the allocateable resource amount of the device.
  • the user establishes an application and simultaneously reduces the amount of the allocated resources of the device by the amount of the requested resource as the updated amount of the allocated resources, thereby controlling and limiting the use and preemption of the device hardware resources by a single application, thereby avoiding busy applications. Preempt the scene of an idle application.
  • one or more second devices may exist in addition to the first device, and when the user needs to request to use resources in the device, the first device and the second device may be used.
  • the maximum allocateable resource amount of the second device may also be acquired, and the maximum allocateable resource amount is determined as the allocateable resource amount of the second device when the second device does not perform hardware resource allocation. After receiving the requested resource amount input by the user, determining whether the requested resource amount is greater than the allocateable resource amount of the selected device, selecting one device among the first device and the second device as the selected device.
  • an embodiment of a method for implementing hardware resource allocation provided in an embodiment of the present invention is applicable to a server.
  • the embodiment may include the following steps:
  • Step 301 Obtain a maximum allocateable resource quantity of the first device, where no hardware resources are performed on the first device.
  • the maximum allocatable resource amount is determined as the amount of allocable resources of the first device when the source is allocated.
  • Step 302 Obtain a maximum allocateable resource amount of the second device, and determine a maximum allocateable resource amount as an allocatable resource amount of the second device when the second device does not perform hardware resource allocation.
  • the maximum allocatable resource amount may include a maximum allotable disk space and a maximum allocateable memory space.
  • the maximum allocateable disk space is equal to the maximum disk space minus the operating system consuming disk space
  • the maximum allocateable memory space is equal to the maximum memory space minus the operating system occupied memory space. That is, the maximum allocateable disk space of the second device is equal to the maximum disk space of the second device minus the disk space occupied by the operating system of the second device
  • the maximum allocateable memory space of the second device is equal to the maximum memory space of the second device minus The memory space occupied by the operating system in the second device.
  • the maximum allocateable resource amount of the second device may be determined as the allocateable resource amount of the second device.
  • the device may be allocated.
  • the amount of resources may include allocateable disk space and allocateable memory space, that is, when the second device does not perform hardware resource allocation, the maximum allocable disk space of the second device is determined as the allotable disk space of the second device, and the second The maximum allocatable memory space of the device is determined as the allocatable memory space of the second device.
  • steps 301 and 302 can be understood as the preliminary steps before the method for implementing hardware resource allocation provided by the embodiment of the present invention.
  • Step 303 Receive the requested resource amount input by the user.
  • the amount of request resources may include requesting disk space and requesting memory space.
  • Step 304 Select one device among the first device and the second device as the selected device.
  • one device may be randomly selected as the selected device in the first device and the second device, and one device may be selected as the selected device in the first device and the second device in a certain order, for example, an identification sequence.
  • Step 305 Determine whether the requested resource quantity is greater than the allocateable resource quantity of the selected device, and if yes, Go to step 306, if no, go to step 307.
  • Step 306 Determine whether all devices in the first device and the second device are selected, if yes, end, if no, return to step 304.
  • the selected device cannot complete the hardware resource. Assigning, the selected device needs to be re-selected, and it is determined whether all devices in the first device and the second device are selected before reselecting, and if not, returning to select one device in the first device and the second device as The selected device, if all the devices in the first device and the second device are selected, there is currently no device that can satisfy the requested resource amount and end the process of hardware resource allocation.
  • Step 307 Send a resource allocation request including the requested resource amount to the selected device, so that the selected device allocates the hardware resource requesting the resource amount to the user.
  • the The resource allocation request requesting the resource quantity is sent to the selected device, and the selected device receives the resource allocation request, and the hardware resource requesting the resource quantity may be allocated to the user.
  • the hardware requesting the size of the disk space and the size of the requested memory space may be requested.
  • the resource is allocated to the user who sent the requested resource.
  • the selected device may be specifically configured to allocate a hardware resource requesting a resource amount to a user to establish a database application.
  • Step 308 Determine the result of subtracting the amount of the requested resource from the amount of the allocateable resource of the selected device as the allocatable resource amount of the selected device.
  • the result of subtracting the requested disk space of the selected device from the allocateable disk space may be determined as the allotable disk space of the selected device, which will be selected by the device.
  • the result of the allocateable memory space minus the requested memory space is determined as the allocatable memory space of the selected device.
  • the embodiment of the present invention determines the amount of the resource that can be allocated by the multiple devices, and receives the requested resource amount input by the user, and selects one device among the multiple devices.
  • the requested resource amount is not greater than the allocateable resource amount of the device, Allocating hardware resources of the requested resource amount to the user to establish an application, and subtracting the amount of the requestable resource from the amount of the requested resource as the updated allocateable resource, thereby realizing allocation of hardware resources in multiple devices It also controls and limits the use and preemption of device hardware resources by a single application, avoiding the scene where busy applications preempt idle applications.
  • the method before selecting one device as the selected device in the first device and the second device, the method may further include: determining whether the requested resource amount is greater than The maximum allocateable resource amount of the first device and the second device; if the requested resource amount is not greater than the maximum allocateable resource amount of the first device and the second device, performing selecting one device among the first device and the second device as being Select a device.
  • FIG. 4 an embodiment of a method for implementing hardware resource allocation is provided in the embodiment of the present invention, which may be applied to a server. The embodiment may include the following steps:
  • Step 401 Obtain a maximum allocateable resource amount of the first device, and determine, as the first device, the maximum allocateable resource amount, the amount of the maximum allocateable resource of the first device.
  • Step 402 Acquire a maximum allocateable resource amount of the second device, and determine a maximum allocatable resource amount as an allocatable resource amount of the second device when the second device does not perform hardware resource allocation.
  • Step 403 Receive the requested resource amount input by the user.
  • Step 404 Determine whether the requested resource amount is greater than the maximum allocateable resource amount of the first device and the second device, and if yes, end, if no, proceed to step 405.
  • the amount of the requested resource received by the user is first determined whether the requested resource amount is greater than the maximum allocateable resource amount of the first device and the second device, and if the requested resource amount is greater than the maximum allocateable resource amount of each device, Perform hardware resource allocation, no need to select equipment, direct knot
  • the process of hardware resource allocation is saved to save resources and time-consuming allocation of hardware resources.
  • the implementation of the step may be: determining whether the requested disk space is greater than the allocateable disk space of the first device and the second device, and whether the requested memory space is greater than the allocateable memory space of the first device and the second device, if the disk space is requested If the allocated memory space of the first device and the second device is larger than the allocateable memory space of the first device and the second device, the process directly ends. If the requested disk space is not greater than the first device and the second device, If the allocated disk space or the requested memory space is not greater than the allocateable memory space of the first device and the second device, then the process proceeds to step 405.
  • Step 405 Select one device among the first device and the second device as the selected device.
  • Step 406 Determine whether the requested resource amount is greater than the allocateable resource amount of the selected device. If yes, go to step 407, if no, go to step 408.
  • Step 407 Determine whether all devices in the first device and the second device are selected, if yes, end, if no, return to step 405.
  • Step 408 Send a resource allocation request including the requested resource amount to the selected device, so that the selected device allocates the hardware resource requesting the resource amount to the user.
  • Step 409 Determine the result of subtracting the requested resource amount from the allocateable resource amount of the selected device as the allocatable resource amount of the selected device.
  • the embodiment of the present invention determines the amount of the resource that can be allocated by the multiple devices, and receives the requested resource amount input by the user, and selects one device among the multiple devices.
  • the requested resource amount is not greater than the allocateable resource amount of the device, Allocating hardware resources of the requested resource amount to the user to establish an application, and subtracting the amount of the requestable resource from the amount of the requested resource as the updated allocateable resource, thereby realizing allocation of hardware resources in multiple devices It also controls and limits the use and preemption of device hardware resources by a single application, avoiding the scene where busy applications preempt idle applications.
  • FIG. 5 a device for implementing hardware resource allocation provided in an embodiment of the present invention is shown. Examples can include:
  • the first obtaining unit 501 is configured to obtain a maximum allocateable resource amount of the first device, and determine, as the first device, the maximum allocateable resource amount, when the first device does not perform hardware resource allocation.
  • the receiving unit 502 is configured to receive a requested resource amount input by the user.
  • the first determining unit 503 is configured to determine whether the requested resource quantity is greater than the allocateable resource quantity of the selected device, and the selected device is the first device.
  • the sending unit 504 is configured to: if the judgment result of the first determining unit is that the requested resource amount is not greater than the allocatable resource amount of the selected device, send a resource allocation request including the requested resource amount to the selected device, so that the selected device will A hardware resource requesting a resource amount is allocated to a user to establish an application instance, and the application instance has a maximum available resource amount that is not greater than the requested resource amount.
  • the determining unit 505 is configured to determine, as a result of the amount of the allocateable resource of the selected device, the result of the requested resource amount as the allocatable resource amount of the selected device.
  • the apparatus for implementing hardware resource allocation provided in the embodiment of the present invention may further include:
  • a second acquiring unit configured to acquire a maximum allocateable resource amount of the second device, where the maximum allocateable resource amount is determined as the allocateable resource amount of the second device when the second device does not perform hardware resource allocation;
  • a selecting unit configured to: after the receiving unit receives the requested resource amount input by the user, the first determining unit determines whether the requested resource quantity is greater than the allocateable resource quantity of the selected device, and selects one device in the first device and the second device. As the selected device.
  • the apparatus for implementing hardware resource allocation provided in the embodiment of the present invention may further include:
  • a second determining unit configured to determine whether all devices in the first device and the second device are selected if the judgment result of the first determining unit is that the requested resource amount is greater than the allocateable resource amount of the selected device
  • the selecting unit is further configured to: if the judgment result of the second judging unit is the first device and the second device All of the devices are not selected, and re-execution selects one device among the first device and the second device as the selected device.
  • the apparatus for implementing hardware resource allocation provided in the embodiment of the present invention may further include:
  • a third determining unit configured to determine whether the requested resource quantity is greater than a maximum allocateable resource quantity of the first device and the second device;
  • the selecting unit is further configured to: if the judgment result of the third determining unit is that the requested resource amount is not greater than the maximum allocateable resource amount of the first device and the second device, perform selecting one device in the first device and the second device as being Select a device.
  • the selected device is specifically configured to allocate a hardware resource requesting a resource amount to a user to establish a database application.
  • the maximum allocatable resource amount includes a maximum allocateable disk space and a maximum allocateable memory space
  • the maximum allotable disk space is equal to the maximum disk space minus the operating system occupied disk space, and the maximum allocateable memory space.
  • the embodiment of the present invention receives the amount of the requestable resource input by the user by determining the amount of the allocateable resource of the device, and allocates the hardware resource of the requested resource amount when the requested resource amount is not greater than the allocateable resource amount of the device.
  • the user establishes an application and simultaneously reduces the amount of the allocated resources of the device by the amount of the requested resource as the updated amount of the allocated resources, thereby controlling and limiting the use and preemption of the device hardware resources by a single application, thereby avoiding busy applications. Preempt the scene of an idle application.
  • the embodiment of the present invention further provides a server, as shown in FIG. 6, which may include:
  • the number of processors 601 in the server may be one or more, and one processor is taken as an example in FIG.
  • processor 601, memory 602, input device 603, and output device 604 may pass Bus or other connection, wherein the connection through the bus is taken as an example in FIG.
  • the memory 602 can be used to store software programs and modules, and the processor 601 executes various functional applications and data processing of the server by running software programs and modules stored in the memory 602.
  • the memory 602 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function, and the like.
  • memory 602 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • Input device 603 can be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the server.
  • the processor 601 loads the executable file corresponding to the process of one or more applications into the memory 602 according to the following instructions, and is executed by the processor 601 to be stored in the memory 602.
  • the application to implement various functions:
  • Obtaining a maximum allocateable resource quantity of the first device determining, when the first device does not perform hardware resource allocation, the maximum allocateable resource quantity as the allocateable resource quantity of the first device; receiving the requested resource input by the user the amount;
  • the result of subtracting the amount of the allocated resources of the selected device from the amount of the requested resource is determined as the amount of allocatable resources of the selected device.
  • it also includes:
  • it also includes:
  • the amount of the requested resource is greater than the amount of the allocateable resource of the selected device, determining whether all devices in the first device and the second device are selected;
  • the method before selecting one of the first device and the second device as the selected device, the method further includes:
  • the requested resource amount is not greater than the maximum allocateable resource amount of the first device and the second device, performing one of the first device and the second device as the selected device is performed.
  • the maximum allocatable resource amount includes a maximum allotable disk space equal to a maximum disk space minus an operating system occupied disk space, and a maximum allocatable memory space. Equal to the maximum memory space minus the operating system occupied memory space; the allocateable resource amount includes an allotable disk space and an allocatable memory space; the requested resource amount includes a request disk space and a request memory space.
  • the embodiment of the present invention receives the amount of the requestable resource input by the user by determining the amount of the allocateable resource of the device, and allocates the hardware resource of the requested resource amount when the requested resource amount is not greater than the allocateable resource amount of the device.
  • the user establishes an application and simultaneously reduces the amount of available resources of the device by the amount of requested resources as an updated amount of allocatable resources, thereby controlling and limiting a single application to the device.
  • the steps of a method or algorithm described in connection with the embodiments disclosed herein can be implemented directly in hardware, a software module executed by a processor, or a combination of both.
  • the software module can be placed in random access memory (RAM), memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or technical field. Any other form of storage medium known.
  • the computer program product includes one or more computer instructions.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or from a calculation
  • the machine readable storage medium is transferred to another computer readable storage medium, for example, the computer instructions can be wired from a website site, computer, server or data center (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) Or wireless (such as infrared, wireless, microwave, etc.) to another website site, computer, server or data center.
  • a website site computer, server or data center
  • DSL digital subscriber line
  • wireless such as infrared, wireless, microwave, etc.
  • the computer readable storage medium can be any available media that can be stored by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
  • the program may be stored in a computer readable storage medium, and the storage medium may include: ROM, RAM, disk or CD.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种实现硬件资源分配的方法及装置,用于合理分配硬件资源,该方法包括:获取第一设备的最大可分配资源量,在第一设备未进行硬件资源分配时将最大可分配资源量确定为第一设备的可分配资源量(201);接收用户输入的请求资源量(202);判断请求资源量是否大于被选择设备的可分配资源量,被选择设备为第一设备(203);如果请求资源量不大于被选择设备的可分配资源量,将包括请求资源量的资源分配请求发送给被选择设备,以使被选择设备将请求资源量的硬件资源分配给用户(204);将被选择设备的可分配资源量减去请求资源量的结果确定为被选择设备的可分配资源量(205)。

Description

一种实现硬件资源分配的方法、装置及存储介质
本申请要求于2016年12月13日提交中国专利局、申请号为2016111469233、发明名称为“一种实现硬件资源分配的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及互联网领域,具体涉及一种实现硬件资源分配的方法、装置及存储介质。
背景技术
一台计算机设备的资源可以分为计算资源和存储资源,其中计算资源主要用于计算,例如CPU(Central Processing Unit,中央处理器)、内存等,存储资源主要用于读写数据,可以由磁盘承担。随着硬件技术的进步,单一设备的计算资源和存储资源变得越来越大,同时单位成本也越来越便宜。随着单一设备的硬件性能提升,为了充分的发挥设备的硬件能力,在设备中可以部署多个应用程序,例如将多个数据库应用部署到一台设备上,以降低单个数据库应用的使用成本。
在云技术中,尤其是虚拟化环境下,设备中的硬件资源通常都是按照应用程序的方式分租给不同的用户使用,这些分租应用程序的用户可以称为租户。一台设备中会部署多个应用程序,这样,一台设备的硬件资源就会被多个租户租用,目前多个租户对设备上硬件资源的使用方式是基于操作系统分配和调度的,一般采用基于抢占的硬件资源分配和使用策略,即一个繁忙的应用程序可以抢占设备的硬件资源用于自身的计算和存储,而一个空闲的应用程序在这种场景下得不到用来计算和存储的硬件资源,其处理能力就大大降低。在一个公平的多租户环境下,现有技术中的硬件资源分配的方式对空闲应用程序的租户是不公平的。
发明内容
有鉴于此,本发明实施例提供一种实现硬件资源分配的方法、装置及存储 介质,以解决现有技术中基于抢占的方式进行硬件资源分配使空闲的应用程序处理能力降低的技术问题。
为解决上述问题,本发明提供的技术方案如下:
本发明实施例第一方面提供一种实现硬件资源分配的方法,所述方法应用于服务器,获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;所述方法包括:
接收用户输入的请求资源量;
判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
如果所述请求资源量不大于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量;
将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
可选地,所述方法还包括:
获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
在接收用户输入的请求资源量之后,判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述方法还包括:
如果所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
如果所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,在所述第一设备与所述第二设备中选择一台设备作为被选择设备之前,所述方法还包括:
判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
如果所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述被选择设备具体用于将所述请求资源量的硬件资源分配给所述用户建立数据库应用。
可选地,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
本发明实施例第二方面提供一种实现硬件资源分配的装置,所述装置包括:
第一获取单元,用于获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;
接收单元,用于接收用户输入的请求资源量;
第一判断单元,用于判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
发送单元,用于如果所述第一判断单元的判断结果为所述请求资源量不大 于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量;
确定单元,用于将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
可选地,所述装置还包括:
第二获取单元,用于获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
选择单元,用于在所述接收单元接收用户输入的请求资源量之后,所述第一判断单元判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述装置还包括:
第二判断单元,用于如果所述第一判断单元的判断结果为所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
所述选择单元,还用于如果所述第二判断单元的判断结果为所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述装置还包括:
第三判断单元,用于判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
所述选择单元,还用于如果所述第三判断单元的判断结果为所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第 一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述被选择设备具体用于将所述请求资源量的硬件资源分配给所述用户建立数据库应用。
可选地,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
本发明实施例第三方面提供一种服务器,包括:处理器和存储器,所述存储器中存储有程序指令;
所述处理器执行所述存储器中存储的程序指令时执行上述第一方面或第一方面任一可选的实现方式所述的方法。
本发明实施例又一方面提供一种计算机可读存储介质,存储有程序指令,当所述程序指令在服务器上运行时,使得所述服务器执行如下步骤:
获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;
接收用户输入的请求资源量;
判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
如果所述请求资源量不大于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量;
将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
可选地,所述程序指令还使得所述服务器执行如下步骤:
获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
在接收用户输入的请求资源量之后,判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述程序指令还使得所述服务器执行如下步骤:
如果所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
如果所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述程序指令还使得所述服务器执行如下步骤:
在所述第一设备与所述第二设备中选择一台设备作为被选择设备之前,判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
如果所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述被选择设备具体用于将所述请求资源量的硬件资源分配给所述用户建立数据库应用。
可选地,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
由此可见,本发明实施例具有如下有益效果:
本发明实施例通过确定某一设备的可分配资源量,接收用户输入的请求资源量,当请求资源量不大于该设备的可分配资源量时,将该请求资源量的硬件资源分配给用户建立应用程序,同时将该设备的可分配资源量减去请求资源量作为更新后的可分配资源量,从而控制和限制了单一应用程序对设备硬件资源的使用和抢占,避免出现繁忙应用程序抢占空闲应用程序的场景。
附图说明
图1为本发明实施例的应用场景的示意图;
图2为本发明实施例中提供的实现硬件资源分配的方法实施例的一流程图;
图3为本发明实施例中提供的实现硬件资源分配的方法实施例的另一流程图;
图4为本发明实施例中提供的实现硬件资源分配的方法实施例的另一流程图;
图5为本发明实施例中提供的实现硬件资源分配的装置实施例的示意图;
图6为本发明实施例中提供的一种服务器的结构示意图。
具体实施方式
为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明实施例作进一步详细的说明。
在现有技术中,单一设备上部署多个应用程序,应用程序对计算机硬件资源的使用是基于操作系统分配和调度的,例如,一个繁忙的数据库应用可以抢占设备硬件资源用于自身的计算和存储,而一个空闲的数据库应用在这种场景就得不到计算和存储资源,其处理能力就大大降低,其中数据库应用可以包括数据库以及数据库实例,数据库实例可以理解为用于操作数据库的处理程序。同时,目前设备通常允许多个租户同时使用,租户即使用计算机硬件资源的用户,在一个公平的多租户环境下,现有技术中的硬件资源分配的方式对空闲应 用程序的租户是不公平的。为此,本发明实施例提供了一种实现硬件资源分配的方法及装置,用于解决资源抢占对空闲租户的不利影响,为每个租户分配并控制其使用的硬件资源,保证繁忙的应用程序使用硬件资源的同时,不降低空闲应用程序的资源使用。
参见图1所示,示出了本发明实施例的应用场景示意图,本发明实施例中提供的实现硬件资源分配的方法将从实现硬件资源分配的装置角度进行描述,该实现硬件资源分配的装置具体可以装载在设备或服务器中。在一些情况下,只有一台设备时,本发明实施例中所提供的硬件资源分配的装置可以直接装载在该设备中或者装载在服务器中,实现对该设备硬件资源的分配;在另一些情况下,有多台设备时,本发明实施例中所提供的硬件资源分配的装置可以装载在某一台设备中或者装载在服务器中,实现对设备硬件资源的分配,以下将分别对这两种不同情况下的实现硬件资源分配的方法进行说明。
参见图2所示,示出了本发明实施例中提供的实现硬件资源分配的方法实施例,该实现硬件资源分配的方法可应用于服务器,实现硬件资源分配的方法可以包括以下步骤:
步骤201:获取第一设备的最大可分配资源量,在第一设备未进行硬件资源分配时将最大可分配资源量确定为第一设备的可分配资源量。
在本实施例中,在有一台设备时,即仅有第一设备时,需要对第一设备的硬件资源进行分配。首先获取第一设备的最大可分配资源量,在本发明一些可能的实现方式中,最大可分配资源量可以包括最大可分配磁盘空间以及最大可分配内存空间。其中,最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,最大可分配内存空间等于最大内存空间减去操作系统占用内存空间。即第一设备的最大可分配磁盘空间等于第一设备的最大磁盘空间减去第一设备中操作系统占用的磁盘空间,第一设备的最大可分配内存空间等于第一设备的最大内存空间减去第一设备中的操作系统占用的内存空间。在第一设备未 进行硬件资源分配时,即初始状态下,可以将第一设备的最大可分配资源量确定为第一设备的可分配资源量,在本发明一些可能的实现方式中,可分配资源量可以包括可分配磁盘空间以及可分配内存空间,即在第一设备未进行硬件资源分配时,将第一设备的最大可分配磁盘空间确定为第一设备的可分配磁盘空间,将第一设备的最大可分配内存空间确定为第一设备的可分配内存空间。需要注意的是,步骤201可以理解为执行本发明实施例所提供的实现硬件资源分配的方法之前的预备步骤。
若用参数来表示,最大磁盘空间可以用SMAX来表示,最大内存空间可以用MMAX来表示,操作系统占用磁盘空间可以用OSS来表示,操作系统占用内存空间可以用OSM来表示,最大可分配磁盘空间可以用DSMAX来表示,最大可分配内存空间可以用DMMAX来表示,则上述的关系可以表示为:
DSMAX=SMAX-OSS;DMMAX=MMAX-OSM。
可分配磁盘空间可以用DDS来表示,可分配内存空间可以用DDM来表示,则可知DDM<=DMMAX,DDS<=DSMAX。
步骤202:接收用户输入的请求资源量。
在用户需要请求使用设备中的资源时,可以在用户的客户端输入请求资源量,在本发明一些可能的实现方式中,请求资源量可以包括请求磁盘空间以及请求内存空间。例如,用户输入100G的请求磁盘空间、10G的请求内存空间以建立数据库应用。
磁盘空间的请求资源量可以用SDER来表示,内存空间的请求资源量可以用MDER来表示。
步骤203:判断请求资源量是否大于被选择设备的可分配资源量,被选择设备为第一设备。
在本实施例中只有一台第一设备,这样被选择设备即为第一设备,在接收到用户输入的请求资源量后,需要判断请求资源量是否大于被选择设备的可分 配资源量,在本发明一些可能的实现,判断请求资源量是否大于被选择设备的可分配资源量可以为判断请求磁盘空间是否大于可分配磁盘空间且请求内存空间是否大于可分配内存空间。如果请求资源量大于被选择设备的可分配资源量,即请求磁盘空间大于可分配磁盘空间或者请求内存空间大于可分配内存空间,则无法完成硬件资源分配,可以向用户发送提示信息;如果请求资源量不大于被选择设备的可分配资源量,即请求磁盘空间不大于可分配磁盘空间且请求内存空间不大于可分配内存空间,则可以进行第一设备的硬件资源分配执行后续步骤。
步骤204:如果请求资源量不大于被选择设备的可分配资源量,将包括请求资源量的资源分配请求发送给被选择设备,以使被选择设备将请求资源量的硬件资源分配给用户。
被选择设备可以将请求资源量的硬件资源分配给用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量。如该应用程序实例的最大可使用内存为MDER,磁盘容量为SDER。
在判断请求资源量不大于被选择设备的可分配资源量时,将包括请求资源量的资源分配请求发送给第一设备,如果本发明实施例中提供的实现硬件资源分配的装置直接装载在第一设备中,则资源分配请求可以在第一设备内部发送,如果本发明实施例中提供的实现硬件资源分配的装置直接装载在服务器中,则资源分配请求可以从服务器发送至第一设备。在本实施例中第一设备接收到资源分配请求,可以将请求资源量的硬件资源分配给用户,具体的,可以将请求磁盘空间大小以及请求内存空间大小的硬件资源分配给发送该请求资源量的用户。在本发明一些可能的实现方式中,被选择设备可以具体用于将请求资源量的硬件资源分配给用户建立数据库应用,在本实施例中被选择设备可以为第一设备。
步骤205:将被选择设备的可分配资源量减去请求资源量的结果确定为被 选择设备的可分配资源量。
在被选择设备进行硬件资源分配之后,需要更新被选择设备的可分配资源量,在原有的可分配资源量减去请求资源量的结果即为更新后的可分配资源量。在本发明一些可能的实现方式中,可以将被选择设备的可分配磁盘空间减去请求磁盘空间的结果确定为被选择设备的可分配磁盘空间,将被选择设备的可分配内存空间减去请求内存空间的结果确定为被选择设备的可分配内存空间,在本实施例中被选择设备可以为第一设备。
这样,本发明实施例通过确定某一设备的可分配资源量,接收用户输入的请求资源量,当请求资源量不大于该设备的可分配资源量时,将该请求资源量的硬件资源分配给用户建立应用程序,同时将该设备的可分配资源量减去请求资源量作为更新后的可分配资源量,从而控制和限制了单一应用程序对设备硬件资源的使用和抢占,避免出现繁忙应用程序抢占空闲应用程序的场景。
基于上述实施例,还存在有多台设备的情况,即除了第一设备还可以存在一台或多台第二设备,当用户需要请求使用设备中的资源时,可以在第一设备以及第二设备中选择一台设备为用户分配该台设备的硬件资源。则在本发明一些可能的实现方式中,还可以获取第二设备的最大可分配资源量,在第二设备未进行硬件资源分配时将最大可分配资源量确定为第二设备的可分配资源量;在接收用户输入的请求资源量之后,判断请求资源量是否大于被选择设备的可分配资源量之前,在第一设备与第二设备中选择一台设备作为被选择设备。如果请求资源量大于被选择设备的可分配资源量,判断第一设备与第二设备中的全部设备是否均被选择;如果第一设备与第二设备中的全部设备没有均被选择,重新执行在第一设备与第二设备中选择一台设备作为被选择设备。参见图3所示,示出了本发明实施例中提供的实现硬件资源分配的方法实施例,可应用于服务器,该实施例可以包括以下步骤:
步骤301:获取第一设备的最大可分配资源量,在第一设备未进行硬件资 源分配时将最大可分配资源量确定为第一设备的可分配资源量。
步骤302:获取第二设备的最大可分配资源量,在第二设备未进行硬件资源分配时将最大可分配资源量确定为第二设备的可分配资源量。
类似的,在本发明一些可能的实现方式中,最大可分配资源量可以包括最大可分配磁盘空间以及最大可分配内存空间。其中,最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,最大可分配内存空间等于最大内存空间减去操作系统占用内存空间。即第二设备的最大可分配磁盘空间等于第二设备的最大磁盘空间减去第二设备中操作系统占用的磁盘空间,第二设备的最大可分配内存空间等于第二设备的最大内存空间减去第二设备中的操作系统占用的内存空间。在第二设备未进行硬件资源分配时,即初始状态下,可以将第二设备的最大可分配资源量确定为第二设备的可分配资源量,在本发明一些可能的实现方式中,可分配资源量可以包括可分配磁盘空间以及可分配内存空间,即在第二设备未进行硬件资源分配时,将第二设备的最大可分配磁盘空间确定为第二设备的可分配磁盘空间,将第二设备的最大可分配内存空间确定为第二设备的可分配内存空间。
需要注意的是,步骤301、302均可以理解为执行本发明实施例所提供的实现硬件资源分配的方法之前的预备步骤。
步骤303:接收用户输入的请求资源量。
在本发明一些可能的实现方式中,请求资源量可以包括请求磁盘空间以及请求内存空间。
步骤304:在第一设备与第二设备中选择一台设备作为被选择设备。
在实际应用中可以在第一设备与第二设备中随机选择一台设备作为被选择设备,也可以按照一定顺序例如标识顺序在第一设备与第二设备中选择一台设备作为被选择设备。
步骤305:判断请求资源量是否大于被选择设备的可分配资源量,如果是, 进入步骤306,如果否,进入步骤307。
步骤306:判断第一设备与第二设备中的全部设备是否均被选择,如果是,结束,如果否,返回步骤304。
如果请求资源量大于被选择设备的可分配资源量,即请求磁盘空间大于被选择设备的可分配磁盘空间或者请求内存空间大于被选择设备的可分配内存空间,则该被选择设备无法完成硬件资源分配,需要重新选择被选择设备,在重新选择之前先判断第一设备与第二设备中的全部设备是否均被选择,如果没有则返回重新在第一设备与第二设备中选择一台设备作为被选择设备,如果第一设备与第二设备中的全部设备均被选择过,则当前没有设备可以满足该请求资源量,结束硬件资源分配的过程。
步骤307:将包括请求资源量的资源分配请求发送给被选择设备,以使被选择设备将请求资源量的硬件资源分配给用户。
在判断请求资源量不大于被选择设备的可分配资源量时,即请求磁盘空间不大于被选择设备的可分配磁盘空间且请求内存空间不大于被选择设备的可分配内存空间时,可以将包括请求资源量的资源分配请求发送给被选择设备,被选择设备接收到资源分配请求,可以将请求资源量的硬件资源分配给用户,具体的,可以将请求磁盘空间大小以及请求内存空间大小的硬件资源分配给发送该请求资源量的用户。在本发明一些可能的实现方式中,被选择设备可以具体用于将请求资源量的硬件资源分配给用户建立数据库应用。
步骤308:将被选择设备的可分配资源量减去请求资源量的结果确定为被选择设备的可分配资源量。
在被选择设备进行硬件资源分配之后,需要更新被选择设备的可分配资源量,在原有的可分配资源量减去请求资源量的结果即为更新后的可分配资源量。在本发明一些可能的实现方式中,可以将被选择设备的可分配磁盘空间减去请求磁盘空间的结果确定为被选择设备的可分配磁盘空间,将被选择设备的 可分配内存空间减去请求内存空间的结果确定为被选择设备的可分配内存空间。
这样,本发明实施例通过确定多台设备的可分配资源量,接收用户输入的请求资源量,在多台设备中选择一台设备,当请求资源量不大于该设备的可分配资源量时,将该请求资源量的硬件资源分配给用户建立应用程序,同时将该设备的可分配资源量减去请求资源量作为更新后的可分配资源量,从而实现在多台设备中对硬件资源进行分配且控制和限制了单一应用程序对设备硬件资源的使用和抢占,避免出现繁忙应用程序抢占空闲应用程序的场景。
基于上述实现硬件资源分配的方法实施例,在本发明一些可能的实现方式中,在第一设备与第二设备中选择一台设备作为被选择设备之前,还可以包括:判断请求资源量是否大于第一设备以及第二设备的最大可分配资源量;如果请求资源量不大于第一设备以及第二设备的最大可分配资源量,执行在第一设备与第二设备中选择一台设备作为被选择设备。参见图4所示,示出了本发明实施例中提供的实现硬件资源分配的方法实施例,可以应用于服务器,该实施例可以包括以下步骤:
步骤401:获取第一设备的最大可分配资源量,在第一设备未进行硬件资源分配时将最大可分配资源量确定为第一设备的可分配资源量。
步骤402:获取第二设备的最大可分配资源量,在第二设备未进行硬件资源分配时将最大可分配资源量确定为第二设备的可分配资源量。
步骤403:接收用户输入的请求资源量。
步骤404:判断请求资源量是否大于第一设备以及第二设备的最大可分配资源量,如果是,结束,如果否,进入步骤405。
在接收到用户输入的请求资源量首先判断该请求资源量是否大于了第一设备以及第二设备的最大可分配资源量,如果该请求资源量均大于各台设备的最大可分配资源量则无法进行硬件资源分配,无需再进行设备的选择,直接结 束硬件资源分配的过程,以节约进行硬件资源分配的资源与耗时。具体的,本步骤的实现可以为判断请求磁盘空间是否大于第一设备以及第二设备的可分配磁盘空间且请求内存空间是否大于第一设备以及第二设备的可分配内存空间,如果请求磁盘空间大于第一设备以及第二设备的可分配磁盘空间且请求内存空间大于第一设备以及第二设备的可分配内存空间,则直接结束,如果请求磁盘空间不大于第一设备以及第二设备的可分配磁盘空间或者请求内存空间不大于第一设备以及第二设备的可分配内存空间,则进入步骤405。
步骤405:在第一设备与第二设备中选择一台设备作为被选择设备。
步骤406:判断请求资源量是否大于被选择设备的可分配资源量,如果是,进入步骤407,如果否,进入步骤408。
步骤407:判断第一设备与第二设备中的全部设备是否均被选择,如果是,结束,如果否,返回步骤405。
步骤408:将包括请求资源量的资源分配请求发送给被选择设备,以使被选择设备将请求资源量的硬件资源分配给用户。
步骤409:将被选择设备的可分配资源量减去请求资源量的结果确定为被选择设备的可分配资源量。
在本实施例中除步骤404之外的其他步骤与上述实施例类似,相应说明可以参见上述实施例,在此不再赘述。
这样,本发明实施例通过确定多台设备的可分配资源量,接收用户输入的请求资源量,在多台设备中选择一台设备,当请求资源量不大于该设备的可分配资源量时,将该请求资源量的硬件资源分配给用户建立应用程序,同时将该设备的可分配资源量减去请求资源量作为更新后的可分配资源量,从而实现在多台设备中对硬件资源进行分配且控制和限制了单一应用程序对设备硬件资源的使用和抢占,避免出现繁忙应用程序抢占空闲应用程序的场景。
参见图5所示,示出了本发明实施例中提供的实现硬件资源分配的装置实 施例,可以包括:
第一获取单元501,用于获取第一设备的最大可分配资源量,在第一设备未进行硬件资源分配时将最大可分配资源量确定为第一设备的可分配资源量。
接收单元502,用于接收用户输入的请求资源量。
第一判断单元503,用于判断请求资源量是否大于被选择设备的可分配资源量,被选择设备为第一设备。
发送单元504,用于如果第一判断单元的判断结果为请求资源量不大于被选择设备的可分配资源量,将包括请求资源量的资源分配请求发送给被选择设备,以使被选择设备将请求资源量的硬件资源分配给用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量。
确定单元505,用于将被选择设备的可分配资源量减去请求资源量的结果确定为被选择设备的可分配资源量。
在本发明一些可能的实现方式中,本发明实施例中提供的实现硬件资源分配的装置还可以包括:
第二获取单元,用于获取第二设备的最大可分配资源量,在第二设备未进行硬件资源分配时将最大可分配资源量确定为第二设备的可分配资源量;
选择单元,用于在接收单元接收用户输入的请求资源量之后,第一判断单元判断请求资源量是否大于被选择设备的可分配资源量之前,在第一设备与第二设备中选择一台设备作为被选择设备。
在本发明一些可能的实现方式中,本发明实施例中提供的实现硬件资源分配的装置还可以包括:
第二判断单元,用于如果第一判断单元的判断结果为请求资源量大于被选择设备的可分配资源量,判断第一设备与第二设备中的全部设备是否均被选择;
选择单元,还用于如果第二判断单元的判断结果为第一设备与第二设备中 的全部设备没有均被选择,重新执行在第一设备与第二设备中选择一台设备作为被选择设备。
在本发明一些可能的实现方式中,本发明实施例中提供的实现硬件资源分配的装置还可以包括:
第三判断单元,用于判断请求资源量是否大于第一设备以及第二设备的最大可分配资源量;
选择单元,还用于如果第三判断单元的判断结果为请求资源量不大于第一设备以及第二设备的最大可分配资源量,执行在第一设备与第二设备中选择一台设备作为被选择设备。
在本发明一些可能的实现方式中,被选择设备具体用于将请求资源量的硬件资源分配给用户建立数据库应用。
在本发明一些可能的实现方式中,最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;可分配资源量包括可分配磁盘空间以及可分配内存空间;请求资源量包括请求磁盘空间以及请求内存空间。
这样,本发明实施例通过确定某一设备的可分配资源量,接收用户输入的请求资源量,当请求资源量不大于该设备的可分配资源量时,将该请求资源量的硬件资源分配给用户建立应用程序,同时将该设备的可分配资源量减去请求资源量作为更新后的可分配资源量,从而控制和限制了单一应用程序对设备硬件资源的使用和抢占,避免出现繁忙应用程序抢占空闲应用程序的场景。
可选地,本发明实施例还提供一种服务器,参见图6所示,可以包括:
处理器601、存储器602、输入装置603和输出装置604。该服务器中的处理器601的数量可以一个或多个,图6中以一个处理器为例。在本发明的一些实施例中,处理器601、存储器602、输入装置603和输出装置604可通过 总线或其它方式连接,其中,图6中以通过总线连接为例。
存储器602可用于存储软件程序以及模块,处理器601通过运行存储在存储器602的软件程序以及模块,从而执行该服务器的各种功能应用以及数据处理。存储器602可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等。此外,存储器602可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。输入装置603可用于接收输入的数字或字符信息,以及产生与该服务器的用户设置以及功能控制有关的键信号输入。
具体在本实施例中,处理器601会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器602中,并由处理器601来运行存储在存储器602中的应用程序,从而实现各种功能:
获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;接收用户输入的请求资源量;
判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
如果所述请求资源量不大于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量;
将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
可选地,还包括:
获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配 时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
在接收用户输入的请求资源量之后,判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,还包括:
如果所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
如果所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,在所述第一设备与所述第二设备中选择一台设备作为被选择设备之前,还包括:
判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
如果所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
可选地,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
这样,本发明实施例通过确定某一设备的可分配资源量,接收用户输入的请求资源量,当请求资源量不大于该设备的可分配资源量时,将该请求资源量的硬件资源分配给用户建立应用程序,同时将该设备的可分配资源量减去请求资源量作为更新后的可分配资源量,从而控制和限制了单一应用程序对设备 硬件资源的使用和抢占,避免出现繁忙应用程序抢占空闲应用程序的场景。
需要说明的是,本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的系统或装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算 机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims (19)

  1. 一种实现硬件资源分配的方法,其特征在于,所述方法应用于服务器,获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;所述方法包括:
    接收用户输入的请求资源量;
    判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
    如果所述请求资源量不大于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量;
    将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
    在接收用户输入的请求资源量之后,判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    如果所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
    如果所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  4. 根据权利要求2所述的方法,其特征在于,在所述第一设备与所述第 二设备中选择一台设备作为被选择设备之前,所述方法还包括:
    判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
    如果所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述被选择设备具体用于将所述请求资源量的硬件资源分配给所述用户建立数据库应用。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
  7. 一种实现硬件资源分配的装置,其特征在于,所述装置包括:
    第一获取单元,用于获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;
    接收单元,用于接收用户输入的请求资源量;
    第一判断单元,用于判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
    发送单元,用于如果所述第一判断单元的判断结果为所述请求资源量不大于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所 述请求资源量;
    确定单元,用于将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括:
    第二获取单元,用于获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
    选择单元,用于在所述接收单元接收用户输入的请求资源量之后,所述第一判断单元判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  9. 根据权利要求8所述的装置,其特征在于,所述装置还包括:
    第二判断单元,用于如果所述第一判断单元的判断结果为所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
    所述选择单元,还用于如果所述第二判断单元的判断结果为所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  10. 根据权利要求8所述的装置,其特征在于,所述装置还包括:
    第三判断单元,用于判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
    所述选择单元,还用于如果所述第三判断单元的判断结果为所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  11. 根据权利要求7-10任一项所述的装置,其特征在于,所述被选择设备具体用于将所述请求资源量的硬件资源分配给所述用户建立数据库应用。
  12. 根据权利要求7-11任一项所述的装置,其特征在于,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
  13. 一种计算机可读存储介质,存储有程序指令,其特征在于,当所述程序指令在服务器上运行时,使得所述服务器执行如下步骤:
    获取第一设备的最大可分配资源量,在所述第一设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第一设备的可分配资源量;
    接收用户输入的请求资源量;
    判断所述请求资源量是否大于被选择设备的可分配资源量,所述被选择设备为所述第一设备;
    如果所述请求资源量不大于所述被选择设备的可分配资源量,将包括所述请求资源量的资源分配请求发送给所述被选择设备,以使所述被选择设备将所述请求资源量的硬件资源分配给所述用户建立应用程序实例,所述应用程序实例最大可使用资源量不大于所述请求资源量;
    将所述被选择设备的可分配资源量减去所述请求资源量的结果确定为所述被选择设备的可分配资源量。
  14. 根据权利要求13所述的计算机可读存储介质,其特征在于,所述程序指令还使得所述服务器执行如下步骤:
    获取第二设备的最大可分配资源量,在所述第二设备未进行硬件资源分配时将所述最大可分配资源量确定为所述第二设备的可分配资源量;
    在接收用户输入的请求资源量之后,判断所述请求资源量是否大于所述被选择设备的可分配资源量之前,在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  15. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述程序指令还使得所述服务器执行如下步骤:
    如果所述请求资源量大于所述被选择设备的可分配资源量,判断所述第一设备与所述第二设备中的全部设备是否均被选择;
    如果所述第一设备与所述第二设备中的全部设备没有均被选择,重新执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  16. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述程序指令还使得所述服务器执行如下步骤:
    在所述第一设备与所述第二设备中选择一台设备作为被选择设备之前,判断所述请求资源量是否大于所述第一设备以及所述第二设备的最大可分配资源量;
    如果所述请求资源量不大于所述第一设备以及所述第二设备的最大可分配资源量,执行在所述第一设备与所述第二设备中选择一台设备作为被选择设备。
  17. 根据权利要求13-16任一所述的计算机可读存储介质,其特征在于,所述被选择设备具体用于将所述请求资源量的硬件资源分配给所述用户建立数据库应用。
  18. 根据权利要求13-17任一项所述的计算机可读存储介质,所述最大可分配资源量包括最大可分配磁盘空间以及最大可分配内存空间,所述最大可分配磁盘空间等于最大磁盘空间减去操作系统占用磁盘空间,所述最大可分配内存空间等于最大内存空间减去操作系统占用内存空间;所述可分配资源量包括可分配磁盘空间以及可分配内存空间;所述请求资源量包括请求磁盘空间以及请求内存空间。
  19. 一种服务器,其特征在于,包括:处理器和存储器,所述存储器中存储有程序指令;
    所述处理器执行所述存储器中存储的程序指令时执行根据权利要求1至6中任一项所述的方法。
PCT/CN2017/112254 2016-12-13 2017-11-22 一种实现硬件资源分配的方法、装置及存储介质 WO2018107945A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US16/284,455 US11132229B2 (en) 2016-12-13 2019-02-25 Method, storage medium storing instructions, and apparatus for implementing hardware resource allocation according to user-requested resource quantity
US17/396,584 US11768706B2 (en) 2016-12-13 2021-08-06 Method, storage medium storing instructions, and apparatus for implementing hardware resource allocation according to user-requested resource quantity

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611146923.3 2016-12-13
CN201611146923.3A CN106598737A (zh) 2016-12-13 2016-12-13 一种实现硬件资源分配的方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/284,455 Continuation US11132229B2 (en) 2016-12-13 2019-02-25 Method, storage medium storing instructions, and apparatus for implementing hardware resource allocation according to user-requested resource quantity

Publications (1)

Publication Number Publication Date
WO2018107945A1 true WO2018107945A1 (zh) 2018-06-21

Family

ID=58802008

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112254 WO2018107945A1 (zh) 2016-12-13 2017-11-22 一种实现硬件资源分配的方法、装置及存储介质

Country Status (3)

Country Link
US (2) US11132229B2 (zh)
CN (1) CN106598737A (zh)
WO (1) WO2018107945A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598737A (zh) * 2016-12-13 2017-04-26 腾讯科技(深圳)有限公司 一种实现硬件资源分配的方法及装置
CN109511138B (zh) * 2017-09-15 2023-04-28 上海诺基亚贝尔股份有限公司 通信网络中资源分配的方法、设备以及计算机可读介质
CN111107075A (zh) * 2019-12-13 2020-05-05 中国工商银行股份有限公司 请求响应方法、装置、电子设备和计算机可读存储介质
US11706076B2 (en) 2020-01-23 2023-07-18 Novnet Computing System Tech Co., Ltd. Computer system with computing devices, communication device, task processing device
CN110928693B (zh) * 2020-01-23 2021-01-15 飞诺门阵(北京)科技有限公司 一种计算设备及资源分配方法
JP7191906B2 (ja) * 2020-09-09 2022-12-19 株式会社日立製作所 リソース割当制御装置、計算機システム、及びリソース割当制御方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999002000A1 (en) * 1997-07-01 1999-01-14 Omnipoint Corporation Resource controllers for use in a non-unitary service system
CN103440172A (zh) * 2013-08-19 2013-12-11 深圳创维数字技术股份有限公司 一种资源管理方法及终端设备
CN105512091A (zh) * 2015-12-03 2016-04-20 青岛海信移动通信技术股份有限公司 一种内存分配方法及装置
CN105589750A (zh) * 2015-07-07 2016-05-18 杭州华三通信技术有限公司 一种cpu资源调度方法和服务器
CN106598737A (zh) * 2016-12-13 2017-04-26 腾讯科技(深圳)有限公司 一种实现硬件资源分配的方法及装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7137119B1 (en) * 2000-05-02 2006-11-14 Microsoft Corporation Resource manager architecture with resource allocation utilizing priority-based preemption
EP1744575B1 (en) * 2000-08-03 2010-03-17 Infineon Technologies AG Configurable modulator
AU2002363892A1 (en) * 2001-12-21 2003-07-09 Micronas Gmbh Method and device for managing resources in a computer system
US9043798B2 (en) * 2010-12-16 2015-05-26 International Business Machines Corporation Remediating gaps between usage allocation of hardware resource and capacity allocation of hardware resource
CN103473137B (zh) * 2013-09-16 2017-04-12 东软集团股份有限公司 避免死锁的资源分配方法及系统
US9772881B2 (en) * 2013-10-29 2017-09-26 Hua Zhong University Of Science Technology Hardware resource allocation for applications
US9542221B2 (en) * 2014-05-22 2017-01-10 Oracle International Corporation Dynamic co-scheduling of hardware contexts for parallel runtime systems on shared machines
CN105468458B (zh) * 2015-11-26 2019-04-19 北京航空航天大学 计算机集群的资源调度方法及系统
US10277911B2 (en) * 2016-01-22 2019-04-30 Wowza Media Systems, LLC Video processing workload management

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999002000A1 (en) * 1997-07-01 1999-01-14 Omnipoint Corporation Resource controllers for use in a non-unitary service system
CN103440172A (zh) * 2013-08-19 2013-12-11 深圳创维数字技术股份有限公司 一种资源管理方法及终端设备
CN105589750A (zh) * 2015-07-07 2016-05-18 杭州华三通信技术有限公司 一种cpu资源调度方法和服务器
CN105512091A (zh) * 2015-12-03 2016-04-20 青岛海信移动通信技术股份有限公司 一种内存分配方法及装置
CN106598737A (zh) * 2016-12-13 2017-04-26 腾讯科技(深圳)有限公司 一种实现硬件资源分配的方法及装置

Also Published As

Publication number Publication date
CN106598737A (zh) 2017-04-26
US20210365295A1 (en) 2021-11-25
US11132229B2 (en) 2021-09-28
US20190188041A1 (en) 2019-06-20
US11768706B2 (en) 2023-09-26

Similar Documents

Publication Publication Date Title
WO2018107945A1 (zh) 一种实现硬件资源分配的方法、装置及存储介质
US10740136B2 (en) Automatic virtual machine termination in a cloud
US9588789B2 (en) Management apparatus and workload distribution management method
US10455003B2 (en) Method, server, and system for sharing resource data
US8595722B2 (en) Preprovisioning virtual machines based on request frequency and current network configuration
WO2018036103A1 (zh) 虚拟机创建方法、系统以及主机
JP7074302B2 (ja) 仮想マシン管理方法、仮想マシン管理システム、仮想マシン管理装置、不揮発性コンピュータ可読記憶媒体およびコンピュータプログラム
EP3313023A1 (en) Life cycle management method and apparatus
EP3668009A1 (en) Life cycle management method and device for network service
CN109729106B (zh) 处理计算任务的方法、系统和计算机程序产品
JP2015144020A5 (zh)
US9875139B2 (en) Graphics processing unit controller, host system, and methods
EP3706368A1 (en) Method and device for deploying virtualized network element device
CN110166507B (zh) 多资源调度方法和装置
WO2021227999A1 (zh) 云计算服务系统和方法
US20130212340A1 (en) Partition aware quality of service feature
US10320892B2 (en) Rolling capacity upgrade control
WO2019105379A1 (zh) 资源管理的方法、装置、电子设备及存储介质
WO2016041446A1 (zh) 一种资源分配方法、装置及设备
US20140196044A1 (en) SYSTEM AND METHOD FOR INCREASING THROUGHPUT OF A PaaS SYSTEM
CN112286688A (zh) 一种内存管理和使用方法、装置、设备和介质
WO2017041650A1 (zh) 用于扩展分布式一致性服务的方法和设备
CN113419839A (zh) 多类型作业的资源调度方法、装置、电子设备及存储介质
CN112860421B (zh) 用于作业处理的方法、设备和计算机程序产品
US9088569B2 (en) Managing access to a shared resource using client access credentials

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17880744

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17880744

Country of ref document: EP

Kind code of ref document: A1