Method, device, electronic device and storage medium for computing resource allocation
By setting all application instances in the cloud server to running in the background, the problem of uneven distribution of computing resources in cloud games is solved, achieving even resource distribution for each application instance and avoiding screen freezes.
Patent Information
- Application Number
- CN202111439688.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In cloud games, when multiple application instances are running on the server, due to uneven distribution of computing resources, some instances run smoothly, while some instances cause screen freezes due to insufficient resources.
By determining the started application instances in the cloud server and setting them to background running status, computing resources can be evenly distributed.
By placing all application instances in the background running state, the problem of uneven distribution of computing resources is avoided, ensuring that each application instance obtains computing resources evenly, and solving the problem of screen lag.
Smart Images

Figure CN114146406B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, device, electronic device and storage medium for allocating computing resources. Background Art
[0002] In the process of cloud gaming, players send game operation instructions to the server running the game; the server responds to the player's operation instructions, causing the game it is running to generate a screen corresponding to the operation instructions, and then transmits the generated game screen to the terminal held by the player. A server can usually run multiple application instances, each corresponding to one player.
[0003] However, in the prior art, when multiple application instances are running on a server, the computing resources allocated to them are often uneven, resulting in a small number of application instances running smoothly due to more computing resources being allocated to them, while a large number of application instances experiencing screen freezes due to fewer computing resources being allocated to them. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for allocating computing resources, which can improve the problem of uneven computing resources allocated to multiple application instances running on a server in the prior art.
[0005] An embodiment of the present application provides a method for allocating computing resources, which is applied to a cloud server. The method includes: determining an application instance that is currently started in the cloud server; setting all of the started application instances to a background running state, so that the cloud server evenly allocates computing resources to each of the application instances that are in the background running state.
[0006] The embodiment of the present application further provides a device for allocating computing resources, which is used to allocate computing resources to multiple game clients for implementing cloud games. The device includes:
[0007] An instance determination unit, configured to determine an application instance currently started in the cloud server;
[0008] The running state adjustment unit is used to set all the started application instances to the background running state, so that the cloud server can evenly distribute the computing resources to each of the application instances in the background running state.
[0009] In some embodiments, the apparatus further comprises:
[0010] An instance quantity determination unit, used to determine the number of application instances currently started in the cloud server;
[0011] a maximum frame rate determining unit, configured to determine a maximum frame rate of an application instance started in the cloud server according to the number of the application instances started;
[0012] A computing resource adjustment unit is used to adjust the computing resources corresponding to the started application instance according to the maximum frame rate.
[0013] In some embodiments, the maximum frame rate determining unit includes:
[0014] A frame rate range determination subunit, used to determine a frame rate range of a preset maximum frame rate;
[0015] The application instance frame rate subunit is used to determine the maximum frame rate of the application instances started in the cloud server according to the number of the started application instances and the frame rate range.
[0016] In some embodiments, the apparatus further comprises:
[0017] A current frame rate acquisition unit, configured to acquire a current frame rate of each of the application instances after the cloud server evenly distributes computing resources to each of the application instances in a background running state;
[0018] The computing resource adjustment unit comprises:
[0019] A frame rate comparison subunit, used to compare the current frame rate of each of the application instances with the maximum frame rate;
[0020] The computing resource reducing subunit is used to reduce the computing resources of the target application instance in the application instances when the current frame rate of the target application instance in the application instances is greater than the maximum frame rate.
[0021] In some embodiments, the operation status adjustment unit includes:
[0022] A window handle subunit, used to obtain the window handle of each of the started application instances;
[0023] The state modification subunit is used to modify the running state of the corresponding application instance to a background running state through the window handle.
[0024] In some embodiments, the apparatus further comprises:
[0025] a target instance determining unit, configured to determine a target application instance corresponding to the application data acquisition instruction in response to the application data acquisition instruction sent by the target terminal;
[0026] The application data sending unit is used to send the application data corresponding to the target application instance to the target terminal according to the application data acquisition instruction, so that the target terminal displays the graphical user interface corresponding to the application data.
[0027] In some embodiments, the operation status adjustment unit includes:
[0028] A window status acquisition subunit, used to acquire the current window status of the started application instance;
[0029] The state changing subunit is used to change the window state of the target application instance from the top running state to the background running state when the window state of the target application instance in the started application instance is the top running state.
[0030] In the method for allocating computing resources provided in the embodiment of the present application, all application instances running on the server can be obtained, and then all application instances running on the server are set to a background running state. Since the application programs in the background running state will evenly share the computing resources, all application instances set to the background running state can evenly share the computing resources of the server.
[0031] In the present application, by setting all application instances running on the server to background running state, the server evenly distributes computing resources to each application instance among all application instances, thereby avoiding the problem of uneven allocation of computing resources to multiple application instances running in the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0033] Figure 1a It is a scenario diagram of the method for allocating computing resources provided in an embodiment of the present application;
[0034] Figure 1b is a flowchart of a method for allocating computing resources provided in one embodiment of the present application;
[0035] Figure 2 is a flowchart of a method for allocating computing resources provided by another embodiment of the present application;
[0036] Figure 3 It is a structural schematic diagram of a device for computing resource allocation provided in one embodiment of the present application;
[0037] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The Metaverse refers to the fact that all people in the real world have a corresponding online avatar. The concept of Metaverse is becoming more and more popular. As more users participate in Metaverse, Metaverse servers are also facing more and more computing power requirements, so it is becoming more and more important to improve server resource utilization.
[0039] Cloud gaming is an important form of the metaverse. It is a common method for users to log in to the virtual world through cloud gaming. Users do not need to install additional software and can log in through a browser, which is more convenient for users and can reduce the cost of playing games.
[0040] For service providers that provide cloud games, in order to save costs, they usually need to run multiple application instances on one server. However, for each client among the multiple application instances, the application instance placed in the foreground can be allocated GPU resources first, while other application instances that are not in the foreground are allocated fewer GPU resources. As a result, a small number of application instances can run smoothly because they are allocated more computing resources, while a large number of application instances will experience screen freezes because they are allocated fewer computing resources.
[0041] The above problems were discovered by the inventors after creative work.
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0043] Embodiments of the present application provide a method, device, electronic device, and storage medium for allocating computing resources.
[0044] The computing resource allocation device may be integrated in an electronic device, which may be a terminal, a server, or other device. The terminal may be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, or a personal computer (PC); the server may be a single server or a server cluster consisting of multiple servers.
[0045] In some embodiments, the computing resource allocation device may also be integrated into multiple electronic devices. For example, the computing resource allocation device may be integrated into multiple servers, and the computing resource allocation method of the present application may be implemented by multiple servers.
[0046] In some embodiments, the server may also be implemented in the form of a terminal.
[0047] For example, refer to Figure 1a The electronic device can execute the following method: obtain all application instances running on the server; set all the application instances to background running state, so that the server can evenly distribute computing resources to each application instance in the background running state.
[0048] In one embodiment of the present application, a method for allocating computing resources may be run in a server, and the server cooperates with a terminal device. The terminal device may be a local terminal device. When the method for allocating computing resources is run in a server, the method may be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0049] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the running body of the game program and the game screen presentation body are separated, the storage and operation of the character control method are completed on the cloud game server, and the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a terminal, a TV, a computer, a handheld computer, etc.; but the terminal device for character control is a cloud game server in the cloud. When playing the game, the user operates the client device to send an operation instruction to the cloud game server, such as a touch operation instruction. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0050] In an optional implementation, multiple clients can be opened simultaneously on the server based on Unity's Unity Render Streaming technology to implement peer-to-peer streaming between application instances running on the server and user terminals, thereby completing audio and video streaming and remote control.
[0051] It should be noted that the serial numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0052] In this embodiment, a method for allocating computing resources is provided, such as Figure 1b As shown, the method for allocating computing resources is applied in a terminal, and the specific process of the method may be as follows: Steps 110 to 120:
[0053] 110. Determine the application instance currently started in the cloud server.
[0054] The application instance is an instance client corresponding to the game running in the cloud server. Optionally, when all application instances are running on the cloud server, they can all be run in the cache of the cloud server without distinction, or they can be run separately in containers separated by the cloud server. Container is a lightweight virtualization technology. The so-called lightweight virtualization refers to an operating system layer virtualization technology. This technology allows the storage space for users on an operating system to be divided into multiple independent units to run in the kernel, and these independent units do not interfere with each other. Each independent unit can be called a container.
[0055] The cloud server can only run application instances under the premise of running processes that maintain the normal operation of the cloud server; it can also run both application instances and other applications under the above premise. The operation of applications in the cloud server should not be understood as a limitation on this application.
[0056] Optionally, in a specific implementation, step 110 may include: obtaining windows of all application instances presented on a display interface; wherein the display interface is a display interface corresponding to the server.
[0057] In the above implementation, all application instances running on the server can be obtained by obtaining the window of the application instance presented on the display interface, or by obtaining the process running in the task manager corresponding to the server. The specific method of obtaining all application instances running on the server should not be understood as a limitation of the present application.
[0058] Optionally, in a specific implementation, the step of: "obtaining windows of all application instances presented on the display interface" includes: enumerating top-level windows on the display interface using the EnumWindows function.
[0059] The EnumWindows function can enumerate all top-level windows on the display interface and pass the window handles to the callback function defined by the application. If the callback function returns FALSE, the enumeration will stop, otherwise the EnumWindows function will continue to enumerate until all top-level windows are enumerated.
[0060] A top-level window refers to a window that can exist independently; the opposite of a top-level window is a non-top-level window, which cannot exist independently and needs to be attached to a top-level window.
[0061] 120. Set all the started application instances to a background running state, so that the cloud server evenly distributes computing resources to each of the application instances in the background running state.
[0062] The background running state refers to a state in which the application is not displayed on the display interface corresponding to the cloud server but is still running. For example, the minimized state or hidden state of the application instance belongs to the background running state.
[0063] The computing resource may be a graphics processing unit (GPU) computing resource, which is mainly used for performing image and graphics related computing tasks. It is understood that the computing resource may also be other computing resources, such as a central processing unit (CPU) computing resource, and the specific type of computing resource should not be understood as a limitation on the present application.
[0064] Application instances in the background running state will have their computing resources evenly allocated by the cloud server. Therefore, by setting all application instances running on the cloud server to the background running state, the cloud server can evenly distribute computing resources among all application instances.
[0065] It can be understood that the above-mentioned application instances can be application instances running the same game or application instances running different games; whether the games corresponding to the application instances are the same game should not be understood as a limitation on the present application.
[0066] Optionally, in a specific implementation, step 120 may specifically include the following steps A1 to A2:
[0067] A1. Obtain the window handle of each started application instance.
[0068] A window handle refers to an identifier that uniquely corresponds to the window of each application instance and represents its own identity.
[0069] Optionally, the window handle of each started application instance can be found through the GetWindowThreadProcessId function.
[0070] A2. Modify the running state of the corresponding application instance to a background running state through the window handle.
[0071] In the above implementation, the corresponding application instance can be set to the background running state according to the window handle. Since each application instance corresponds to a unique window handle, setting the application instance to the background running state by using the window handle can avoid duplication and omission, and accurately and efficiently adjust the running state of all application instances.
[0072] Optionally, the running state of the application instance can be adjusted by using the ShowWindow function. The function of the ShowWindow function is to set the display state of a specified window. Therefore, the ShowWindow function can be used to send a state adjustment instruction indicating that the running state is adjusted to the background running state to the window of the application instance corresponding to each window handle.
[0073] Optionally, in another specific implementation, step 120 may specifically include the following steps B1 to B2:
[0074] B1. Obtain the current window status of the started application instance.
[0075] B2. If the window state of the target application instance in the started application instances is in the top running state, change the window state of the target application instance from the top running state to the background running state.
[0076] The top running state refers to the foreground running state, that is, if the cloud server has a corresponding display screen, the target application instance in the top running state can be observed in the desktop taskbar of the display screen.
[0077] In the above implementation, the window status of each application instance can be judged first. If a window is originally in the background running state, the running state of the window can be maintained unchanged without additional processing operations; if a window is not originally in the background running state, for example, it is in the foreground running state, the window can be adjusted to the background running state. In the above manner, the window status of each application instance is first determined, and then the window that is not in the background running state is placed in the background running state. The above implementation is more targeted in adjusting the running state of the application instance, saving computing resources related to adjusting the running state.
[0078] Optionally, placing a window that is not in the background running state in the background running state may also be performed through a ShowWindow function, and the specific manner of adjusting the running state should not be understood as a limitation to the present application.
[0079] Optionally, the embodiment of the present application may also adjust the window state of an application instance in the following manner: regardless of the original running state of the application instance, the same state adjustment instruction is uniformly transmitted to all application instances, thereby achieving rapid adjustment of the running state of each application instance.
[0080] Optionally, in a specific implementation manner, the method provided in the embodiment of the present application may further include the following steps 130 to 150:
[0081] 130. Determine the number of application instances currently started in the cloud server.
[0082] 140. Determine a maximum frame rate of the application instances started in the cloud server according to the number of the application instances started.
[0083] There is a mapping relationship between the number of application instances and the maximum frame rate of the application instances. The number of application instances running in the cloud server can be obtained, and the maximum frame rate of each application instance currently running in the cloud server can be determined based on the mapping relationship between the number of running application instances and the maximum frame rate of the application instances. Determining the corresponding maximum frame rate based on the actual number of application instances running on the server is conducive to maintaining stable and smooth operation when the number of application instances running is different.
[0084] Optionally, in a specific implementation, step 140 may specifically include the following steps 141 to 142:
[0085] 141. Determine a frame rate range of a preset maximum frame rate.
[0086] 142. Determine a maximum frame rate of the application instances started in the cloud server according to the number of the application instances started and the frame rate range.
[0087] In step 142 , the maximum frame rate may be determined specifically according to a mapping relationship between the number of application instances and the maximum frame rate of the application instances.
[0088] The mapping relationship between the number of application instances and the maximum frame rate of the application instances can be pre-set. The above mapping relationship can be a mapping relationship between the number interval of the running number of application instances and the frame rate value. For example, the number interval of the running number of application instances may include: [a1, a2), [a2, a3), [a3, a4), ... [ai, ai+1) a total of i number intervals, the frame rate value includes b1, b2, b3, ... bi a total of i frame rate values, the mapping relationship between the running number of application instances and the frame rate running upper limit value can be: [a1, a2) is mapped with b1, [a2, a3) is mapped with b2, [a3, a4) is mapped with b3, ... [ai, ai+1) is mapped with bi.
[0089] The above-mentioned mapping relationship can also be a mapping relationship between the number of running application instances and the frame rate value. For example, the running number of application instances may include: c1, c2, c3...ci, a total of i numbers, and the frame rate value includes b1, b2, b3,...bi, a total of i frame rate values. The mapping relationship between the running number of application instances and the upper limit of the frame rate operation can be: c1 and b1 mapping, c2 and b2 mapping, c3 and b3 mapping,...ci and bi mapping. Among them, the value range of the maximum frame rate can be specifically 30 frames to 60 frames. For example, it is assumed that when there are no more than three application instances, each corresponds to 60 frames; when there are more than three application instances, the maximum frame rate is reduced by 5 frames for each application instance exceeded. It should be understood that the specific relationship type of the mapping relationship should not be understood as a limitation on the present application.
[0090] 150. Adjust computing resources corresponding to the started application instance according to the maximum frame rate.
[0091] Optionally, in a specific implementation, before step 150, the embodiment of the present application may further include the following steps: after the cloud server evenly distributes computing resources to each of the application instances in the background running state, obtaining the current frame rate of each of the application instances.
[0092] Accordingly, step 150 may specifically include the following steps 151 to 152:
[0093] 151. Compare the current frame rate of each of the application instances with the maximum frame rate.
[0094] 152. If a current frame rate of a target application instance in the application instances is greater than the maximum frame rate, reducing computing resources of the target application instance.
[0095] In the above implementation, the actual running frame rate (i.e., the current frame rate) of each application instance and the maximum frame rate that each application instance should run can be obtained respectively, and then the two are compared. If the actual running frame rate is greater than the maximum frame rate of the application running, the computing resources of the application instance can be reduced, so as to ensure the smooth operation of all application instances as much as possible.
[0096] Optionally, in a specific implementation, after step 120, the embodiment of the present application may further include the following steps S1 to S2:
[0097] S1. In response to an application data acquisition instruction sent by a target terminal, determine a target application instance corresponding to the application data acquisition instruction.
[0098] The target terminal is a terminal held by a game player. The game player can generate an application data acquisition instruction on the target terminal by performing game operations. The application data acquisition instruction can be sent by the target terminal to the cloud server so that the cloud server can find the corresponding target application instance based on the identity identifier in the application data acquisition instruction, and then send the application data acquisition instruction to the target application instance.
[0099] S2. According to the application data acquisition instruction, the application data corresponding to the target application instance is sent to the target terminal, so that the target terminal displays a graphical user interface corresponding to the application data.
[0100] The target application instance can generate corresponding application data according to the application data acquisition instruction, and the application data can be returned to the target terminal via the cloud server, so that the game player holding the target terminal can view the graphic user interface corresponding to the application data.
[0101] In the above implementation, game players can still play games with high performance requirements even if the performance of their terminal devices is not powerful enough, thereby enriching the entertainment life of game players.
[0102] In the method for allocating computing resources provided in the embodiment of the present application, all application instances running on the server can be obtained, and then all application instances running on the server are set to a background running state. Since the application programs in the background running state will evenly share the computing resources, all application instances set to the background running state can evenly share the computing resources of the server.
[0103] In the present application, by setting all application instances running on the server to background running state, the server evenly distributes computing resources to each application instance among all application instances, thereby avoiding the problem of uneven allocation of computing resources to multiple application instances running in the server.
[0104] The method described in the above embodiment will be further described in detail below.
[0105] In this embodiment, obtaining application instances by enumerating windows is taken as an example to describe the method of the embodiment of the present application in detail.
[0106] like Figure 2 As shown, a method for allocating computing resources has the following specific process:
[0107] 201. Enumerate the top-level windows on the display interface using the EnumWindows function, where the display interface is the display interface corresponding to the server.
[0108] 202. Use the GetWindowThreadProcessId function to find the creation process corresponding to the window of each application instance.
[0109] 203. Obtain an identifier of each creation process; wherein the identifier is an identity corresponding to the window of the corresponding application instance.
[0110] 204. Using the ShowWindow function, send a state adjustment instruction to the window of the application instance corresponding to each identity identifier; wherein the state adjustment instruction is used to adjust the running state of the window receiving the state adjustment instruction to a background running state.
[0111] 205. Obtain the number of all application instances running on the server, wherein the number is the number of client running instances.
[0112] 206. Determine the frame rate upper limit of all application instances running on the server according to the mapping relationship between the number of running clients and the frame rate upper limit, wherein the frame rate upper limit is the maximum value of the running frame rate of the game corresponding to the application instance.
[0113] Optionally, in a specific implementation manner, the above steps 201 to 206 may be implemented by the following source code:
[0114]
[0115]
[0116] As can be seen from the above, in the method for allocating computing resources provided in the embodiment of the present application, all application instances running on the server can be obtained, and then all application instances running on the server are set to the background running state. Since the application programs in the background running state will evenly share the computing resources, all application instances set to the background running state can evenly share the computing resources of the server.
[0117] In the present application, by setting all application instances running on the server to background running state, the server evenly distributes computing resources to each application instance among all application instances, thereby avoiding the problem of uneven allocation of computing resources to multiple application instances running in the server.
[0118] In order to better implement the above method, the embodiment of the present application further provides a computing resource allocation device, which can be integrated in an electronic device, and the electronic device can be a server. The server can be a single server or a server cluster composed of multiple servers.
[0119] For example, in this embodiment, the method of the embodiment of the present application is described in detail by taking the device for computing resource allocation specifically integrated in a server as an example.
[0120] For example, Figure 3 As shown, the computing resource allocation device may include:
[0121] The embodiment of the present application further provides a device for allocating computing resources, which is used to allocate computing resources to multiple game clients for implementing cloud games. The device includes:
[0122] An instance determination unit 301 is used to determine an application instance currently started in the cloud server;
[0123] The running state adjusting unit 302 is used to set all the started application instances to the background running state, so that the cloud server can evenly distribute the computing resources to each of the application instances in the background running state.
[0124] In some embodiments, the apparatus further comprises:
[0125] An instance quantity determination unit, used to determine the number of application instances currently started in the cloud server;
[0126] a maximum frame rate determining unit, configured to determine a maximum frame rate of an application instance started in the cloud server according to the number of the application instances started;
[0127] A computing resource adjustment unit is used to adjust the computing resources corresponding to the started application instance according to the maximum frame rate.
[0128] In some embodiments, the maximum frame rate determining unit includes:
[0129] A frame rate range determination subunit, used to determine a frame rate range of a preset maximum frame rate;
[0130] The application instance frame rate subunit is used to determine the maximum frame rate of the application instances started in the cloud server according to the number of the started application instances and the frame rate range.
[0131] In some embodiments, the apparatus further comprises:
[0132] A current frame rate acquisition unit, configured to acquire a current frame rate of each of the application instances after the cloud server evenly distributes computing resources to each of the application instances in a background running state;
[0133] The computing resource adjustment unit comprises:
[0134] A frame rate comparison subunit, used to compare the current frame rate of each of the application instances with the maximum frame rate;
[0135] The computing resource reducing subunit is used to reduce the computing resources of the target application instance in the application instances when the current frame rate of the target application instance in the application instances is greater than the maximum frame rate.
[0136] In some embodiments, the operation state adjustment unit 302 includes:
[0137] A window handle subunit, used to obtain the window handle of each of the started application instances;
[0138] The state modification subunit is used to modify the running state of the corresponding application instance to a background running state through the window handle.
[0139] In some embodiments, the apparatus further comprises:
[0140] a target instance determining unit, configured to determine a target application instance corresponding to the application data acquisition instruction in response to the application data acquisition instruction sent by the target terminal;
[0141] The application data sending unit is used to send the application data corresponding to the target application instance to the target terminal according to the application data acquisition instruction, so that the target terminal displays the graphical user interface corresponding to the application data.
[0142] In some embodiments, the operation state adjustment unit 302 includes:
[0143] A window status acquisition subunit, used to acquire the current window status of the started application instance;
[0144] The state changing subunit is used to change the window state of the target application instance from the top running state to the background running state when the window state of the target application instance in the started application instance is the top running state.
[0145] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.
[0146] As can be seen from the above, in this application, all application instances running on the server can be obtained, and then all application instances running on the server can be set to the background running state. Since the application programs in the background running state will evenly share the computing resources, all application instances set to the background running state can evenly share the computing resources of the server. By setting all application instances running on the server to the background running state, the server evenly distributes the computing resources to each application instance among all application instances, thereby avoiding the problem of uneven computing resources being allocated to multiple application instances running in the server.
[0147] In the present application, the problem of uneven allocation of computing resources among multiple game clients in the prior art can be improved.
[0148] The embodiment of the present application also provides an electronic device, which can be a terminal, a server, etc. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc. The server can be a single server or a server cluster composed of multiple servers, etc.
[0149] In some embodiments, the computing resource allocation device may also be integrated into multiple electronic devices. For example, the computing resource allocation device may be integrated into multiple servers, and the computing resource allocation method of the present application may be implemented by multiple servers.
[0150] In this embodiment, the electronic device of this embodiment is an electronic device as an example for detailed description, for example, Figure 4 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:
[0151] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input module 404, and a communication module 405. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0152] The processor 401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. In some embodiments, the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0153] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 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. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0154] The electronic device also includes a power supply 403 for supplying power to various components. In some embodiments, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0155] The electronic device may further include an input module 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0156] The electronic device may further include a communication module 405. In some embodiments, the communication module 405 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 405, thereby providing the user with wireless broadband Internet access. For example, the communication module 405 may be used to help the user send and receive emails, browse web pages, and access streaming media.
[0157] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:
[0158] Determine the currently started application instances in the cloud server; set the started application instances to the background running state, so that the cloud server evenly distributes computing resources to each of the application instances in the background running state.
[0159] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0160] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0161] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the computing resource allocation methods provided in the embodiments of the present application. For example, the instructions can execute the following steps:
[0162] Determine the currently started application instances in the cloud server; set the started application instances to the background running state, so that the cloud server evenly distributes computing resources to each of the application instances in the background running state.
[0163] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0164] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations provided in the above embodiments.
[0165] Since the instructions stored in the storage medium can execute the steps in any one of the computing resource allocation methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the computing resource allocation methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0166] The above is a detailed introduction to a computing resource allocation method, device, electronic device and computer-readable storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for allocating computing resources, characterized in that: Applied to a cloud server, the method comprises: Determine the application instance currently started in the cloud server; Setting all the started application instances to a background running state, so that the cloud server evenly distributes computing resources to each of the application instances in the background running state; Determine the number of currently started application instances in the cloud server; Determine the maximum frame rate of the application instances started in the cloud server according to the number of the application instances started; The computing resources corresponding to the started application instance are adjusted according to the maximum frame rate.
2. The method according to claim 1, characterized in that The determining the maximum frame rate of the application instances started in the cloud server according to the number of the application instances started includes: Determine a frame rate range of a preset maximum frame rate; The maximum frame rate of the application instances started in the cloud server is determined according to the number of the started application instances and the frame rate range.
3. The method according to claim 1, characterized in that: The method further comprises: After the cloud server evenly distributes the computing resources to each of the application instances in the background running state, the current frame rate of each of the application instances is obtained; The adjusting the computing resources corresponding to the started application instance according to the maximum frame rate includes: Compare the current frame rate of each of the application instances with the maximum frame rate respectively; If the current frame rate of the target application instance in the application instances is greater than the maximum frame rate, the computing resources of the target application instance are reduced.
4. The method according to claim 1, characterized in that: The step of setting all the started application instances to a background running state includes: Obtaining the window handle of each of the started application instances; The running state of the corresponding application instance is modified to a background running state through the window handle.
5. The method according to claim 1, characterized in that After setting all the started application instances to background running status, the method further includes: In response to an application data acquisition instruction sent by a target terminal, determining a target application instance corresponding to the application data acquisition instruction; According to the application data acquisition instruction, the application data corresponding to the target application instance is sent to the target terminal, so that the target terminal displays a graphical user interface corresponding to the application data.
6. The method according to claim 1, characterized in that The step of setting all the started application instances to a background running state includes: Obtain the current window state of the started application instance; If the window state of the target application instance in the started application instances is in the top running state, the window state of the target application instance is changed from the top running state to the background running state.
7. A device for allocating computing resources, characterized in that: Applied to a cloud server, the device comprises: An instance determination unit, configured to determine an application instance currently started in the cloud server; A running state adjustment unit, used to set all the started application instances to a background running state, so that the cloud server evenly distributes computing resources to each of the application instances in the background running state; An instance quantity determination unit, used to determine the number of application instances currently started in the cloud server; a maximum frame rate determining unit, configured to determine a maximum frame rate of an application instance started in the cloud server according to the number of the application instances started; A computing resource adjustment unit is used to adjust the computing resources corresponding to the started application instance according to the maximum frame rate.
8. An electronic device, characterized in that: The system comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the method for allocating computing resources as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the method for allocating computing resources according to any one of claims 1 to 6.
