Resource allocation method and device and storage medium
Through the dynamic resource allocation mechanism between the client and the server, based on the resource application requests that are incrementally increased by preset growth rules, the server adjusts resource allocation according to the allocable resources and resource utilization rate, solving the insufficient resource supply in the flow restriction scenario The problem has improved resource utilization and business stability.
Patent Information
- Application Number
- CN202310643759.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-01
- Publication Date
- 2024-12-03
AI Technical Summary
In the current technology, in the current limit scenario, when the client requests fluctuate, the server cannot adaptively adjust the resource supply, resulting in low resource utilization and affecting business use.
The client sends a resource application request to the server that is incrementally incremented based on the preset growth rules. The server dynamically adjusts resource allocation according to the allocable resource size and resource utilization rate to ensure smooth control of resource supply.
It improves the resource utilization rate of the client, ensures that request fluctuations in the current limit scenario will not affect business use, and achieves rapid increase in resource supply and flexible adjustments.
Smart Images

Figure CN119071253A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a resource allocation method, device and storage medium. Background Art
[0002] With the rapid development of communication technology and the Internet industry, clustered computer networks have become mature, and the shared resources in them have also increased. Distributed file systems have been widely used. In distributed file systems, data is shared, and different clients can access the data of the same volume. However, if the client accesses a certain volume too frequently, it will affect the performance of other volumes in the system. Therefore, it is necessary to set an upper limit on the maximum flow of the volume, that is, flow limiting.
[0003] However, in the current flow limiting solutions of related technologies, there is no rapid growth strategy when the client requests traffic resources from the server. Multiple interactions are required to apply for sufficient resources. In scenarios with small request granularity and large request volume, a third component such as Redis support is required. If the client obtains traffic but does not use it enough, the server cannot adaptively adjust the resource supply on the other side.
[0004] Therefore, how to effectively control and adjust the supply of client resource demand has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a resource allocation method, device and storage medium, which can smoothly control the supply of client resource demand, improve the resource utilization of the client through dynamic adjustment, and ensure that in the flow limiting scenario, when the client request fluctuates, the flow limiting will not affect the use of the business.
[0006] In a first aspect, the present application provides a resource allocation method, which is applied to a server, and the method includes: receiving at least one resource application request from at least one client, the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is incrementally increased based on a preset growth rule; determining a first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first application resource applied for by each client in the at least one client, and the resource utilization rate of each client; and sending the first allocated resource to each client.
[0007] In a second aspect, the present application provides a resource allocation method, which is applied to a client, and the method includes: sending a resource application request to a server, the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is incrementally increased based on a preset growth rule; receiving a first allocated resource sent by the server in response to the resource application request.
[0008] In a third aspect, the present application provides a resource allocation device, which is applied to a server, and the device includes: a receiving module, which is used to receive at least one resource application request from at least one client, and the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is gradually increased based on a preset growth rule; a determination module, which is used to determine the first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first application resource applied by each client in the at least one client, and the resource utilization rate of each client; a sending module, which is used to send the first allocated resource to each client.
[0009] In a fourth aspect, the present application provides a resource allocation device, which is applied to a client, and the device includes: a sending module, which is used to send a resource application request to a server, and the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is incrementally increased based on a preset growth rule; a receiving module, which is used to receive the first allocated resource sent by the server in response to the resource application request.
[0010] In a fifth aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store code instructions; the processor is used to execute the code instructions to implement the method in the first aspect or the second aspect above.
[0011] Optionally, there are one or more processors and one or more memories.
[0012] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0013] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be set on different chips respectively. The embodiments of the present application do not limit the type of memory and the setting method of the memory and the processor.
[0014] In a sixth aspect, the present application provides a computer-readable storage medium, which stores a computer program (also referred to as code, or instruction) which, when executed on a computer, enables the computer to execute the method in the first or second aspect above.
[0015] In a seventh aspect, the present application provides a computer program product, comprising: a computer program (also referred to as code, or instruction), which enables a computer to execute the method in the first aspect or the second aspect when the computer program is executed.
[0016] In the resource allocation method of the present application, the resources applied for by the client to the server are increased gradually based on preset growth rules, so that the server can smoothly control the supply of client resource demand and provide rapid increase in increments. At the same time, the server can improve the resource utilization of the client by dynamically adjusting the allocation of client resources, and ensure that in the flow limiting scenario, when the client request fluctuates, the flow limiting will not affect the use of the business. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0018] Figure 2 A schematic diagram of a system architecture of a client provided in one embodiment of the present application;
[0019] Figure 3 A schematic diagram of a system architecture provided for an embodiment of the present application;
[0020] Figure 4 A schematic diagram of adding a current limiting module to a client provided in an embodiment of the present application;
[0021] Figure 5 A flowchart of a resource allocation method provided by an embodiment of the present application;
[0022] Figure 6 A flowchart of a resource allocation method provided in another embodiment of the present application;
[0023] Figure 7 A schematic diagram of a power function corresponding to an embodiment of the present application in coordinates;
[0024] Figure 8 A schematic diagram of a curve corresponding to a flow rate formula provided in one embodiment of the present application;
[0025] Fig. 9 A structural schematic diagram of a resource allocation device provided by an embodiment of the present application;
[0026] Fig.10 A structural schematic diagram of a resource allocation device provided in another embodiment of the present application;
[0027] Fig.11 A structural schematic diagram of a resource allocation device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0028] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0029] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first instruction and the second instruction are to distinguish different user instructions, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0030] It should be noted that, in this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0031] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or multiple.
[0032] With the rapid development of communication technology and the Internet industry, clustered computer networks have become mature, and the shared resources in them have also increased day by day, and distributed file systems have been widely used. Distributed file systems (DFS) refer to physical storage resources managed by file systems that are not necessarily directly connected to local nodes, but are connected to nodes through computer networks; or a complete hierarchical file system formed by combining several different logical disk partitions or volumes. DFS provides a logical tree-like file system structure for resources distributed anywhere on the network, making it easier for users to access shared files distributed on the network.
[0033] In a distributed file system, there are many volumes, and different businesses use different volumes. All volumes are in a cluster environment. With the distributed file system as the server and different businesses as clients, multiple clients can access the server at the same time.
[0034] Please refer to Figure 1 , Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the application scenario may include a server 101 and at least one client 102, wherein the server 101 and the at least one client 102 may interact with each other, for example, at least one client 102 may apply for resources from the server 101, and the server 101 allocates resources to the at least one client 102 according to the resource request of the at least one client 102 and its own resource situation.
[0035] It should be understood that the server 101 can be any type of distributed file system, which is not limited in this application. The client 102 can be a terminal device such as a mobile phone, a computer, a tablet, etc., which is not limited in this application.
[0036] In a distributed file system, data is shared and different clients can access the data of the same volume. However, if a client accesses a certain volume too frequently, it will affect the performance of other volumes in the system. Therefore, it is necessary to set an upper limit on the maximum flow of the volume, i.e., flow limiting.
[0037] In the current related technologies, the flow limiting components include multi-point end-side, central flow limiting controller and remote dictionary server (Redis) cache component, etc. Among them, in order to control the flow consumption of the end-side, the basic algorithms on the end-side include token bucket algorithm, funnel algorithm, sliding window algorithm, which can help the end-side control the flow consumption speed; in order to control the flow consumption of the server, in the distributed scenario, the redis server is often used to support the client's flow usage collection and set the client's resource data.
[0038] For example, taking the flow limiting process in the simple storage service (S3) as an example, first, the user writes data, and then the application programming interface (API) requests the user flow limiting module, and further, the user flow limiting module obtains the user allocatable flow from Redis; or the API requests the bucket flow limiting module, and further, the bucket flow limiting module obtains the bucket allocatable flow from Redis.
[0039] However, in the current flow limiting solutions mentioned in the relevant technologies, when the client requests traffic resources from the server, there is no rapid growth strategy, and multiple interactions are required to apply for sufficient resources. In scenarios with small request granularity and large request volume, a third component such as Redis support is required. If the client obtains traffic but does not use it enough, the server cannot adaptively adjust the traffic supply on the other side.
[0040] Therefore, how to effectively control and adjust the supply of client traffic demand has become a technical problem that needs to be solved urgently.
[0041] In view of this, the embodiments of the present application provide a resource allocation method, device and storage medium. In the technical solution of the present application, at least one client sends a resource application request to the server, and the resource application request is used to indicate a request for a first application resource. The size of the first application resource is gradually increased based on a preset growth rule. Accordingly, the server receives a resource application request from at least one client; then the server determines the first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first application resource applied by each client in at least one client, and the resource utilization rate of each client; finally, the first allocated resource is sent to each client, and accordingly, the client receives the first allocated resource. In the resource allocation method of the present application, the server can smoothly control the supply of client resource demand, and can improve the resource utilization rate of the client through dynamic adjustment, so as to ensure that in the flow limiting scenario, the client request fluctuates and the flow limiting does not affect the use of the service.
[0042] It should be understood that the client involved in the embodiments of the present application may be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a smart screen, an artificial intelligence (AI) speaker, a headset, a terminal in industrial control, a terminal in self driving, a terminal in remote medical surgery, a terminal in a smart grid, a terminal in transportation safety, a terminal in a smart city, a terminal in a smart home, a personal digital assistant (PDA), etc., and the embodiments of the present application are not limited to this.
[0043] For example, Figure 2 This is a schematic diagram of the system architecture of the client provided in the embodiment of the present application. Figure 2 As shown, the client includes components such as a processor 210, a memory 220, a transceiver 230, a display unit 240, an input unit 250, a sensor 260, an audio circuit 270, and a power module 280.
[0044] The processor 210 is the control center of the client, and uses various interfaces and lines to connect various parts of the entire client. By running or executing software programs and / or modules stored in the memory 220, and calling data stored in the memory 220, the processor 210 performs various functions of the client and processes data, thereby monitoring the client as a whole. Optionally, the processor 210 may include one or more processing units; optionally, the processor 210 may integrate an application processor, which mainly processes operating devices, user interfaces, and application programs, etc. Of course, other processors may also be included, which are not listed here one by one.
[0045] The memory 220 can be used to store software programs and modules. The processor 210 executes various functional applications and data processing of the client by running the software programs and modules stored in the memory 220. The memory 220 mainly includes a program storage area and a data storage area, wherein the program storage area can store operating devices, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the client (such as audio data, a phone book, etc.), etc. In addition, the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0046] The transceiver 230 can provide wireless communication solutions applied on the client, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The transceiver 230 can be one or more devices integrating at least one communication processing module, for example, integrating the antenna and the baseband processor into the transceiver 230, or integrating the antenna and the modem processor into the transceiver 230, etc., which are not limited here.
[0047] The display unit 240 can be used to display information input by the user or information provided to the user and various menus of the client. The display unit 240 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc., which is not limited here.
[0048] The input unit 250 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the client. Specifically, the input unit 250 can collect the user's operations on or near it, and drive the corresponding connection device according to a pre-set program. In addition, the input unit 250 may include a touch panel, which can be implemented in various types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch panel, the input unit 250 can also include other input devices. Specifically, other input devices can include but are not limited to one or more of function keys (such as volume control buttons, switch buttons, etc.), trackballs, joysticks, etc.
[0049] The client may also include at least one sensor 260, such as a gyroscope sensor, a motion sensor, and other sensors. The motion sensor may include an accelerometer sensor for detecting the magnitude of acceleration in all directions, and the magnitude and direction of gravity when stationary, which may be used for applications that recognize the posture of the client, such as horizontal and vertical screen switching, related games, magnetometer posture calibration, etc. As for other sensors that may be configured in the client, such as a pressure gauge, a barometer, a hygrometer, a thermometer, an infrared sensor, a fingerprint sensor, etc., they will not be described in detail here.
[0050] The audio circuit 270 may include a speaker and a microphone, and may provide an audio interface between the user and the client. The audio circuit 270 may transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 270 and converted into audio data, and then the audio data is output to the processor 210 for processing, and then sent to another client through the video circuit, or the audio data is output to the memory 220 for further processing.
[0051] The client also includes a power module 280 for supplying power to various components. Optionally, the power module 280 can be logically connected to the processor 210 through a power management device, so that the power management device can manage charging, discharging, power consumption and other functions.
[0052] Although not shown, the client may further include a camera. Optionally, the camera may be located at the front or rear of the client, which is not limited in the present embodiment.
[0053] It is understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the client. In other embodiments of the present application, the client may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0054] It should also be understood that the server involved in the embodiments of the present application may be a CubeFS distributed file system, or may be other types of distributed file systems, and the present application does not limit this.
[0055] The following uses the CubeFS distributed file system as an example to explain in detail the system architecture provided by the present application embodiment. Figure 3 The system architecture includes a server cluster management module master 301, a client 302, a client 303, a client 304, a storage module Blobstore 305 and a flow limiting controller limter 306. The server cluster management module master 301 includes a central flow controller QoS manager 3011, the client 302 includes a flow controller sdk librarayqos manager 3021, the client 303 includes a flow controller sdk libraray qos manager 3031, and the client 304 includes a flow controller sdk libraray qos manager 3041.
[0056] Need to explain, Figure 3The system architecture shown is illustrated using only three clients, and the application does not impose any limitation on the specific number of clients.
[0057] It should be understood that CubeFS is a multi-tenant distributed file system. The large cluster multi-tenant mode can better guarantee the cluster resource utilization in actual operation, thereby reducing costs. The cluster management module master 301 manages volume traffic and customer traffic as a control center, and balances customer traffic at the same time. In addition, the total traffic read and written by the master and the number of read and write operations per second (input / output operations per second, IOPS) are each used as a resource for independent service quality (quality of service, QoS) management. The server-side center traffic controller QoS manager 3011 is responsible for the traffic control of clients of different tenant instances (volumes). The traffic controller SDK library of each client provides a common call interface for multiple clients, such as POSIX, S3 and distributed file system (hadoopdistributed file system, HDFS) interface, etc., which can integrate the traffic application and flow limiting logic on the end side. The storage submodule Blobstore 305 is a distributed system for storing binary large objects, used for storing data. The flow limiting controller limter 306 is for single-point flow limiting, which is not applicable to this application and will not be repeated here.
[0058] It should also be understood that QoS originates from network resource competition technology and is used to solve network congestion or performance bottleneck problems, and to solve the problem of client preemption of services and resources, so as to better improve service quality, configure higher network bandwidth or IOPS for high-priority services, meet the resource needs of different business personnel, optimize resource allocation plans, and prevent users from preempting resources. QoS can help administrators better allocate storage resources so that each application client can fully and smoothly use the back-end storage resources.
[0059] In other words, in this system architecture, the master is the resource manager and control center of the entire system architecture, and QoSmanager is one of its components, which is used to interact with the client's traffic controller SDK libraray qos manager. It realizes resource allocation by controlling the client's resource usage quota by the client reporting resource usage and applying for resources and the server calculating the quota to set the client's consumable resources.
[0060] As an example, the implementation method of current limiting in the client can be to add a current limiting module to the API interface that supports different protocols, that is, the flow controller mentioned above, and all read and write interfaces will pass through the current limiting module. Please refer to Figure 4 , a schematic diagram of adding a current limiting module to a client provided by an embodiment of the present application. During the reading and writing process of the portable operating system interface of UNIX (POSIX) protocol, HDFS protocol and S3 protocol, they will pass through the software development kit (SDK) library. By adding the current limiting module limit in the SDK library, the reading and writing process of the protocol can be current limited.
[0061] In order to make the purpose and technical solution of the present application clearer and more intuitive, the resource allocation method, device and storage medium provided by the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
[0062] Please refer to Figure 5 , is a flow chart of a resource allocation method provided by an embodiment of the present application. The method can be applied to the above Figure 1 The application scenarios shown in the figure can also be applied to other scenarios, which are not limited in the present application embodiment. Figure 1 Take the scenario shown in the figure as an example. Accordingly, the server in the following text is Figure 1 The server 101 shown in FIG. 101 and the client hereinafter are Figure 1 The client 102 is shown in detail below. Figure 5 The various steps in the method shown in the flowchart include:
[0063] S501, at least one client sends a resource application request to a server, where the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is increased sequentially based on a preset growth rule.
[0064] Correspondingly, the server receives at least one resource application request from at least one client.
[0065] It should be understood that at least one client applies for resources from the server according to its actual needs, wherein each client generally sends one resource application request at a time, and different clients can send resource application requests to the server at the same time or at different times. This application does not limit this.
[0066] It should also be understood that the size of resources applied for each time by the client is increased gradually based on a preset growth rule. That is, the resources applied for next time by the client are more than the resources applied for last time. The specific growth method can be a smooth increase using a power function calculation method, or it can be a gradual increase using other methods. This application does not limit this.
[0067] S502: The server determines a first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first requested resource requested by each client among at least one client, and the resource utilization rate of each client.
[0068] It should be understood that the size of the first application resource applied for by each client in at least one client may be the same or different, and this application does not limit this.
[0069] It should also be understood that the server calculates the first allocated resource that should be allocated to each client based on the sum of the sizes of the first requested resources in the resource application requests received from all clients, the size of its own allocatable resources, and the resource utilization of each client.
[0070] The resource utilization rate mainly refers to the resource consumption of the client, such as how many resources are allocated to the client and how much resources can be consumed accordingly. The first allocated resource that should be allocated to each client is calculated in combination with the resource utilization rate of each client, so that the client can make full use of the resources allocated by the server.
[0071] S503: The server sends a first allocated resource to each client.
[0072] Accordingly, each client receives the first allocated resources.
[0073] It should be understood that after the server determines the first allocated resources that should be allocated to each client, it sends the corresponding first allocated resources to each client. After each client receives the first allocated resources, it can use the resources based on a sliding window method or use other methods. This application does not limit this.
[0074] It should also be understood that the first application resource applied for by each client and the first allocated resource allocated by the server to each client can be a communication resource, a computing resource or a storage resource, etc., and this application does not limit this.
[0075] In the resource allocation method of this embodiment, the resources applied by the client to the server are increased gradually based on preset growth rules, so that the server can smoothly control the supply of client resource demands and provide rapid increase of increments. At the same time, the server can improve the resource utilization of the client by dynamically adjusting the allocation of client resources, and ensure that in the flow limiting scenario, when the client request fluctuates, the flow limiting will not affect the use of the business.
[0076] Based on the above embodiments, Figure 6 A flowchart of a resource allocation method provided in another embodiment of the present application, Figure 6 In the embodiment shown, taking how to determine the first allocated resource corresponding to each client in at least one client as an example, the following describes in detail: Figure 6 The various steps in the method shown in the flowchart include:
[0077] S601, at least one client sends a resource application request to a server, where the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is increased sequentially based on a preset growth rule.
[0078] Correspondingly, the server receives at least one resource application request from at least one client.
[0079] It should be understood that the preset growth rule is used to indicate that when the first application resource is less than the preset resource critical value, it will grow at a first growth ratio, and when the first application resource is greater than the preset resource critical value, it will grow at a second growth ratio, and the first growth ratio is greater than the second growth ratio.
[0080] That is to say, the size of resources requested by the client increases gradually, and tends to increase rapidly below a preset resource critical value, and tends to increase slowly above the preset resource critical value.
[0081] As an example, the resource size requested by the client may be requested by using a power function calculation method, for example, the power function y=x 1 / 2 , that is, the base is the independent variable, the power is the dependent variable, and the exponent is the constant. The schematic diagram of the power function in the coordinates is as follows Figure 7 shown.
[0082] It should be understood that the calculation method using the power function can smoothly and quickly increase the incremental application resources, the allocated amount becomes larger, the incremental amount decreases, and finally returns to the normal allocation method.
[0083] Accordingly, the power function y=x 1 / 2 Substituting it into the corresponding flow formula, we can get the formula:
[0084] need=uint64(300*util.MB*math.Pow(float64(used) / float64(300*util.MB),0.8))
[0085] Among them, need corresponds to y in the power function, used corresponds to x in the power function, 0.8 corresponds to 1 / 2 in the power function, util.MB is the traffic unit, and the used range is [1, 500].
[0086] The curve diagram corresponding to the flow formula is as follows Figure 8 As shown, the unit is flow unit.
[0087] S602, comparing the size of resources that can be allocated by the server with the sum of the sizes of first-requested resources requested by all clients.
[0088] It should be understood that the server calculates the sum of the first resource requests received from all clients and compares it with the size of the resources that can be allocated by itself.
[0089] S603, when the size of the resources that can be allocated by the server is smaller than the sum of the sizes of the first application resources requested by all clients, a current limiting ratio is calculated based on the size of the resources that can be allocated by the server and the sum of the sizes of the first application resources requested by all clients.
[0090] It should be understood that when the size of the resources allocatable on the server is smaller than the sum of the sizes of the first-applied resources applied for by all clients, it means that the size of the resources allocatable on the server is insufficient and current limiting allocation is required. The current limiting ratio is calculated according to the current limiting ratio calculation formula "1-(size of the resources allocatable on the server / sum of the sizes of the first-applied resources applied for by all clients)". Furthermore, the first allocated resources corresponding to each client are determined based on the size of the resources allocatable on the server, the current limiting ratio and the resource utilization rate of the client.
[0091] It should also be understood that before the server determines the first allocated resources corresponding to each client based on the size of the server's allocatable resources, the current limiting ratio and the client's resource utilization, it should first obtain the client's resource utilization. The client's resource utilization is calculated based on the client's resource usage feedback, or is a preset resource utilization obtained from the client.
[0092] It should be understood that the resource utilization rate may be preset in advance in the client, and the resource utilization rate may be calculated based on the historical resource usage of the client, or may be directly preset and can be directly obtained and used when in use.
[0093] It should also be understood that the resource utilization of the client may also change in real time and can be calculated based on the resource usage feedback of the client.
[0094] Exemplarily, the server receives first information reported by the client, the first information including a first resource consumption value; then, according to the first resource consumption value, the size of the first application resource and the current limiting ratio, the resource utilization rate of the client is calculated. For example, the server calculates the resources actually allocated by the server to the client according to the product of the size of the first application resource and 1 and the difference between the current limiting ratio, and then obtains the resource utilization rate of the client according to the ratio of the first resource consumption value to the resources actually allocated by the server to the client.
[0095] S604: The server determines a first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the current limiting ratio, and the resource utilization rate of each client.
[0096] It should be understood that when the size of the resources that can be allocated by the server is less than the sum of the sizes of the first application resources applied by all clients, it means that the size of the resources that can be allocated by the server is insufficient and current limiting allocation is required, and the current limiting ratio is calculated according to the calculation formula of the current limiting ratio. Then, it is further determined whether the client can use up the resources allocated by the server to the client based on the current limiting ratio, and then the allocated resources are dynamically adjusted.
[0097] In one possible implementation, the server determines a final amplification factor based on the resource utilization of the client, and then determines a first allocated resource corresponding to each client in at least one client based on the size of the resources that can be allocated by the server, the sum of the sizes of the first requested resources requested by all clients, and the final amplification factor.
[0098] Understandably, the server first obtains the initial amplification factor, and then based on the resource utilization of the client, when the resource consumption value of the client is less than the resources allocated to the client, increases the initial amplification factor to the final amplification factor until the resource consumption value of the client is equal to the resources allocated to the client; when the resource consumption value of the client is greater than the resources allocated to the client, reduces the initial amplification factor to the final amplification factor until the resource consumption value of the client is equal to the resources allocated to the client. Further, according to the size of the resources that can be allocated by the server, the sum of the sizes of the first application resources applied by all clients, and the final amplification factor, the first allocated resource corresponding to each client in at least one client is determined.
[0099] That is to say, the server dynamically adjusts the resource allocation of the server to the client based on the amplification factor according to the client's traffic consumption, so that the client can make full use of the resources allocated by the server and improve the resource utilization of the client.
[0100] Understandably, the client's demand is unstable and fluctuates greatly. The resources applied for at the peak may not be used up in the next cycle, which will lead to resource waste. Therefore, by adjusting the initial amplification factor and dynamically adjusting the supply of client resources, we can make up for the difference between the client's overall traffic consumption and the resources allocated to the client by the server, and supplement the client's traffic. That is, based on the client's needs, the difference is given in proportion to the client's actual traffic. However, the difference traffic is not a fixed value, and the supplemented part may not all be consumed. It is necessary to continue to make upward adjustments based on the overall supplementation results. In addition, due to the influence of network and client application conditions, the fluctuation situation will continue to change, and thus, it may also be necessary to adjust downward to meet demand.
[0101] It should also be understood that the first allocated resources include virtual resources and actual allocated resources.
[0102] In yet another possible implementation, when the size of resources that can be allocated by the server is larger than the sum of the sizes of first-requested resources requested by all clients, the server allocates as many resources as possible to the clients.
[0103] S605: The server sends a first allocated resource to each client.
[0104] Accordingly, each client receives the first allocated resources.
[0105] This step and Figure 5 Step S503 in the illustrated embodiment is similar and will not be described in detail here.
[0106] Furthermore, after receiving the first allocated resource, the client can use the first allocated resource in a sliding window or other manner. For example, the available resources can be managed by dividing 1 second of resources by 200 milliseconds. In addition, if the client runs out of resources within a certain window and meets the emergency application conditions according to the information provided by the central resource management, the emergency application resource channel is used to try to temporarily expand the resource quota.
[0107] In one possible implementation, the client may report the resource consumption and the size of the re-requested resources to the server at a preset period, and may also report the resource consumption and the size of the re-requested resources to the server in real time according to the needs of the client; accordingly, the server receives the resource consumption and the size of the re-requested resources reported by the client at a preset period, or receives the resource consumption and the size of the re-requested resources reported by the client in real time according to the needs of the client.
[0108] It should be understood that for a single client, after receiving the resource application request sent by the client, the server determines whether the resources requested in the resource application request are greater than the resources that the server can allocate to the client. If the resources requested in the resource application request are greater than the resources that the server can allocate to the client, the server determines whether there are any remaining resources. If so, the server reallocates resources to the client in accordance with the method in the above-mentioned embodiment; otherwise, the server allocates resources according to the resources that the server can allocate to the client.
[0109] In this embodiment, the resources applied for by the client to the server are increased successively based on preset growth rules, for example, they are increased based on the calculation method of a power function, so that the server can smoothly control the supply of client resource needs and provide a rapid increase in increments; the client can improve accuracy by dynamically reporting resource usage; at the same time, when the server is allocating resources to the client, if the server has insufficient resources to allocate, it will allocate them through current limiting means, and can dynamically adjust the allocated resources to adapt to the intermittent insufficient use of resources caused by abnormal allocation of the client itself, such as the central processing unit, memory, etc., or resource fluctuations caused by improvement, thereby improving the resource utilization of the client.
[0110] It should also be understood that the above embodiments may be coupled to each other, and this application does not limit this. Moreover, the order of the sequence numbers of the above processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0111] Combined with the above Figures 1 to 8 , describes in detail the resource allocation method of the embodiment of the present application, and will be combined with Figures 9 to 11 , a resource allocation device according to an embodiment of the present application is described in detail.
[0112] Fig. 9 This is a structural diagram of a resource allocation device 900 provided in one embodiment of the present application. The device 900 includes: a receiving module 901, a determining module 902 and a sending module 903.
[0113] Among them, the receiving module 901 is used to receive at least one resource application request from at least one client, and the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is gradually increased based on a preset growth rule; the determining module 902 is used to determine the first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first application resource applied for by each client in the at least one client, and the resource utilization rate of each client; the sending module 903 is used to send the first allocated resource to each client.
[0114] In some embodiments, the determination module 902 is specifically used to: compare the size of the resources allocatable on the server with the sum of the sizes of the first application resources applied for by all clients; when the size of the resources allocatable on the server is smaller than the sum of the sizes of the first application resources applied for by all clients, determine the first allocated resources corresponding to each client based on the size of the resources allocatable on the server, the size of the first application resources applied for by each client among the at least one client, and the resource utilization rate of each client.
[0115] In some embodiments, the determination module 902 is also specifically used to: calculate the current limiting ratio based on the size of the resources that can be allocated by the server and the sum of the sizes of the first requested resources applied for by all the clients; determine the first allocated resources corresponding to each client based on the size of the resources that can be allocated by the server, the current limiting ratio and the resource utilization rate of each client.
[0116] In some embodiments, the resource allocation device further comprises: an acquisition module. The acquisition module is used to acquire the resource utilization rate of the client, where the resource utilization rate of the client is calculated based on the resource usage feedback of the client, or is a preset resource utilization rate acquired from the client.
[0117] In some embodiments, the resource utilization of the client is calculated based on the resource usage feedback of the client, and the resource allocation device further includes: a calculation module. The receiving module 901 is also used to receive the first information reported by the client, the first information including the first resource consumption value; the receiving module is used to calculate the resource utilization of the client based on the first resource consumption value, the size of the first application resource and the current limiting ratio.
[0118] In some embodiments, the determination module 902 is specifically used to: determine a final amplification factor based on the resource utilization of each client; determine the first allocated resource corresponding to each client in the at least one client based on the size of the resources that can be allocated by the server, the sum of the sizes of the first requested resources requested by all the clients, and the final amplification factor.
[0119] In some embodiments, the determination module 902 is specifically used to: obtain an initial amplification factor for each client; based on the resource utilization of the client, when the resource consumption value of the client is less than the resources allocated to the client, increase the initial amplification factor to the final amplification factor until the resource consumption value of the client is equal to the resources allocated to the client; when the resource consumption value of the client is greater than the resources allocated to the client, reduce the initial amplification factor to the final amplification factor until the resource consumption value of the client is equal to the resources allocated to the client.
[0120] In some embodiments, the first allocated resources include virtual resources and actual allocated resources.
[0121] In some embodiments, the receiving module 901 is further configured to receive the first information reported by the client at a preset period, or to receive the first information reported by the client in real time according to the needs of the client.
[0122] It should be understood that the device 900 here is embodied in the form of a functional module. The term "module" here may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a proprietary processor or a group processor, etc.) and a memory for executing one or more software or firmware programs, a merged logic circuit and / or other suitable components that support the described functions. In an optional example, those skilled in the art may understand that the device 900 may be specifically the server in the above-mentioned embodiment, or the function of the server in the above-mentioned embodiment may be integrated in the device 900, and the device 900 may be used to execute the various processes and / or steps corresponding to the server in the above-mentioned method embodiment, and to avoid repetition, it will not be repeated here.
[0123] The above device 900 has the function of implementing the corresponding steps executed by the server in the above method; the above function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above function.
[0124] Fig.10 This is a structural schematic diagram of a resource allocation device 1000 provided in another embodiment of the present application. The device 1000 includes: a sending module 1001 and a receiving module 1002 .
[0125] Among them, the sending module 1001 is used to send a resource application request to the server, and the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is gradually increased based on a preset growth rule; the receiving module 1002 is used to receive the first allocated resource sent by the server in response to the resource application request.
[0126] In some embodiments, the preset growth rule is used to indicate that when the first applied resource is less than a preset resource critical value, it increases at a first growth ratio, and when the first applied resource is greater than the preset resource critical value, it increases at a second growth ratio, and the first growth ratio is greater than the second growth ratio.
[0127] In some embodiments, the resource allocation module further includes: a reporting module. The reporting module is used to report first information to the server at a preset period, wherein the first information includes a first resource consumption value, or report the first information to the server in real time according to the needs of the client.
[0128] It should be understood that the device 1000 here is embodied in the form of a functional module. The term "module" here may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a proprietary processor or a group processor, etc.) and a memory for executing one or more software or firmware programs, a merged logic circuit and / or other suitable components that support the described functions. In an optional example, those skilled in the art may understand that the device 1000 may be specifically the client in the above-mentioned embodiment, or the functions of the client in the above-mentioned embodiment may be integrated in the device 1000, and the device 1000 may be used to execute the various processes and / or steps corresponding to the client in the above-mentioned method embodiment, and to avoid repetition, it will not be repeated here.
[0129] The above-mentioned device 1000 has the function of implementing the corresponding steps executed by the client in the above-mentioned method; the above-mentioned function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned function.
[0130] Fig.11 A structural schematic diagram of a resource allocation device provided in yet another embodiment of the present application. Fig.11 The resource allocation device shown can be used to execute the method of any one of the aforementioned embodiments.
[0131] like Fig.11As shown, the device 1100 of this embodiment includes: a memory 1101, a processor 1102, a communication interface 1103 and a bus 1104. The memory 1101, the processor 1102 and the communication interface 1103 are connected to each other through the bus 1104.
[0132] The memory 1101 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 1101 may store a program. When the program stored in the memory 1101 is executed by the processor 1102, the processor 1102 is used to execute each step of the method shown in the above embodiment.
[0133] The processor 1102 can adopt a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs to implement the various methods shown in the embodiments of the present application.
[0134] The processor 1102 may also be an integrated circuit chip with signal processing capability. In the implementation process, each step of the method of the embodiment of the present application may be completed by an integrated logic circuit of hardware in the processor 1102 or by instructions in the form of software.
[0135] The processor 1102 may also be a general purpose processor, a digital signal processor (DSP), an ASIC, a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0136] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1101, and the processor 1102 reads the information in the memory 1101, and completes the functions required to be performed by the units included in the device of the present application in combination with its hardware.
[0137] The communication interface 1103 may use, but is not limited to, a transceiver or other transceiver device to implement communication between the apparatus 1100 and other devices or a communication network.
[0138] The bus 1104 may include a path for transmitting information between various components of the device 1100 (eg, the memory 1101 , the processor 1102 , and the communication interface 1103 ).
[0139] It should be understood that the device 1100 shown in the embodiment of the present application may be an electronic device, or may also be a chip configured in the electronic device.
[0140] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0141] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0142] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0143] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0144] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0145] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0146] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0147] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A resource allocation method, characterized in that: Applied to the server, the method includes: Receiving at least one resource application request from at least one client, wherein the resource application request is used to indicate a request for a first application resource, wherein the size of the first application resource is increased sequentially based on a preset growth rule; Determine the first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first requested resource requested by each client among the at least one client, and the resource utilization rate of each client; The first allocated resources are sent to each of the clients.
2. The method according to claim 1, characterized in that The determining, according to the size of the resources that can be allocated by the server, the size of the first requested resource requested by each client among the at least one client, and the resource utilization rate of each client, the first allocated resource corresponding to each client comprises: Compare the size of the resources that can be allocated by the server with the sum of the sizes of the first requested resources requested by all clients; When the size of the resources allocatable by the server is smaller than the sum of the sizes of the first requested resources requested by all the clients, the first allocated resources corresponding to each client are determined based on the size of the resources allocatable by the server, the size of the first requested resources requested by each of the at least one client, and the resource utilization rate of each client.
3. The method according to claim 2, characterized in that The method further comprises: determining the first allocated resource corresponding to each client according to the size of the resource that can be allocated by the server, the size of the first applied resource that each client among the at least one client and the resource utilization rate of each client, when the size of the resource that can be allocated by the server is less than the sum of the sizes of the first applied resources applied by all the clients, including: Calculate the current limiting ratio according to the size of the resources that can be allocated by the server and the sum of the sizes of the first application resources applied by all the clients; The first allocated resource corresponding to each client is determined according to the size of the resources that can be allocated by the server, the current limiting ratio and the resource utilization rate of each client.
4. The method according to claim 3, characterized in that Before determining the first allocated resource corresponding to each client according to the size of the allocatable resource of the server, the current limiting ratio and the resource utilization rate of each client, the method further includes: For each client, the resource utilization rate of the client is obtained. The resource utilization rate of the client is calculated based on the resource usage feedback of the client, or is a preset resource utilization rate obtained from the client.
5. The method according to claim 4, characterized in that The resource utilization rate of the client is calculated based on the resource usage feedback of the client, and the method further includes: receiving first information reported by the client, where the first information includes a first resource consumption value; The resource utilization rate of the client is calculated according to the first resource consumption value, the size of the first applied resource and the current limiting ratio.
6. The method according to claim 5, characterized in that The determining, according to the size of the resources that can be allocated by the server, the size of the first requested resource requested by each client among the at least one client, and the resource utilization rate of each client, the first allocated resource corresponding to each client comprises: Determining a final amplification factor according to the resource utilization of each client; The first allocated resource corresponding to each client in the at least one client is determined according to the size of the resources that can be allocated by the server, the sum of the sizes of the first requested resources requested by all the clients, and the final magnification factor.
7. The method according to claim 6, characterized in that The determining the final amplification factor according to the resource utilization of each client includes: For each of the clients, obtaining an initial amplification factor; Based on the resource utilization rate of the client, when the resource consumption value of the client is less than the resources allocated to the client, increase the initial amplification factor to the final amplification factor until the resource consumption value of the client is equal to the resources allocated to the client; In a case where the resource consumption value of the client is greater than the resources allocated to the client, the initial amplification factor is reduced to the final amplification factor until the resource consumption value of the client is equal to the resources allocated to the client.
8. The method according to claim 7, characterized in that The first allocated resources include virtual resources and actual allocated resources.
9. The method according to claim 8, characterized in that The method further comprises: receiving the first information reported by the client at a preset period, or Receive the first information reported by the client in real time according to the needs of the client.
10. A resource allocation method, characterized in that: Applied to a client, the method comprises: Sending a resource application request to the server, wherein the resource application request is used to indicate a request for a first application resource, and the size of the first application resource is increased sequentially based on a preset growth rule; A first allocated resource is received, which is sent by the server in response to the resource application request.
11. The method according to claim 10, characterized in that The preset growth rule is used to indicate that when the first applied resource is less than the preset resource critical value, it will grow at a first growth ratio, and when the first applied resource is greater than the preset resource critical value, it will grow at a second growth ratio, and the first growth ratio is greater than the second growth ratio.
12. The method according to claim 11, characterized in that The method further comprises: reporting first information to the server at a preset period, wherein the first information includes a first resource consumption value, or Report the first information to the server in real time according to the needs of the client.
13. A resource allocation device, characterized in that: Applied to the server, the device comprises: A receiving module, configured to receive at least one resource application request from at least one client, wherein the resource application request is used to indicate a request for a first application resource, wherein the size of the first application resource is increased sequentially based on a preset growth rule; A determination module, configured to determine a first allocated resource corresponding to each client according to the size of the resources that can be allocated by the server, the size of the first requested resource requested by each client among the at least one client, and the resource utilization rate of each client; A sending module is used to send the first allocated resources to each client.
14. A resource allocation device, characterized in that: Applied to a client, the device comprises: A sending module, used for sending a resource application request to a server, wherein the resource application request is used for indicating a request for a first application resource, and the size of the first application resource is increased successively based on a preset growth rule; The receiving module is used to receive the first allocated resource sent by the server in response to the resource application request.
15. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory is used to store code instructions; the processor is used to run the code instructions to execute the method according to any one of claims 1 to 9 or 10 to 12.
16. A computer-readable storage medium, characterized in that: Used to store a computer program, the computer program comprising instructions for implementing the method as claimed in any one of claims 1 to 9 or 10 to 12.
