A method, device, equipment and storage medium for configuring coroutine stack resources

By obtaining the historical operation and hardware performance characteristics of the application side, and dynamically configuring coroutine stack resources, the problem of excessive resource occupation or overflow errors in coroutine stack resource configuration is solved, and better operation performance is achieved.

CN114721829BActive Publication Date: 2025-08-26BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210405542.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-18
Publication Date
2025-08-26
Estimated Expiration
2042-04-18

AI Technical Summary

Technical Problem

In the prior art, the coroutine stack resource configuration method results in excessive resource occupation or overflow errors, and cannot effectively ensure operational performance.

Method used

By obtaining the historical performance characteristics information of the application side and the hardware performance characteristics information, dynamically configure coroutine stack resources, and using optimization solutions or machine learning methods to determine stack resource allocation, realizing dynamic adjustment of exclusive and shared stacks.

Benefits of technology

It effectively balances the stack resources and the overall operating performance of the system, ensuring the operating performance of the application side.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114721829B_ABST
    Figure CN114721829B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a method, apparatus, device, and storage medium for configuring coroutine stack resources. The method includes: obtaining historical operating performance characteristic information and hardware performance characteristic information corresponding to an application; allocating coroutine stack resources based on the historical operating performance characteristic information and hardware performance characteristic information, determining current coroutine stack resource allocation information corresponding to the application; and configuring resources for the application-side coroutine stack based on the current coroutine stack resource allocation information. The technical solutions of the present disclosure enable dynamic configuration of coroutine stack resources, effectively ensuring operational performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to computer technology, and in particular to a method, apparatus, device, and storage medium for configuring coroutine stack resources. Background Art

[0002] With the advancement of computer technology, coroutines are smaller scheduling units than threads, allowing multiple coroutines to run on a single system thread. Because context switching between coroutines does not require kernel state transitions, coroutines can reduce context switching overhead and improve operational efficiency. Coroutines require a coroutine stack to store context information during runtime. A coroutine stack can be either a dedicated stack (used exclusively by a coroutine) or a shared stack (shared by multiple coroutines).

[0003] Currently, coroutines are typically configured with dedicated or shared stacks with fixed resource sizes. However, this configuration often results in the coroutine stack occupying excessive resources due to over-configured stack memory, or in stack overflow errors due to under-configured stack memory, thus failing to effectively guarantee performance. Summary of the Invention

[0004] The embodiments of the present disclosure provide a method, apparatus, device, and storage medium for configuring coroutine stack resources to achieve dynamic configuration of coroutine stack resources and effectively ensure operational performance.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for configuring coroutine stack resources, including:

[0006] Obtain the historical performance characteristics information and hardware performance characteristics information corresponding to the application side;

[0007] Performing coroutine stack resource allocation based on the historical operating performance characteristic information and the hardware performance characteristic information, and determining current coroutine stack resource allocation information corresponding to the application end;

[0008] Based on the current coroutine stack resource allocation information, resources are configured for the coroutine stack of the application end.

[0009] In a second aspect, an embodiment of the present disclosure further provides a coroutine stack resource configuration device, including:

[0010] The performance characteristic information acquisition module is used to obtain the historical operation performance characteristic information and hardware performance characteristic information corresponding to the application end;

[0011] A coroutine stack resource allocation module is used to allocate coroutine stack resources based on the historical operation performance characteristic information and the hardware performance characteristic information, and determine the current coroutine stack resource allocation information corresponding to the application end;

[0012] The coroutine stack resource configuration module is used to configure resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information.

[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:

[0014] one or more processors;

[0015] a memory for storing one or more programs;

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the coroutine stack resource configuration method provided in any embodiment of the present disclosure.

[0017] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the coroutine stack resource configuration method provided in any embodiment of the present disclosure.

[0018] The embodiment of the present disclosure obtains historical operating performance characteristic information and hardware performance characteristic information corresponding to the application end, and allocates coroutine stack resources based on the historical operating performance characteristic information and the hardware performance characteristic information, determines the current coroutine stack resource allocation information corresponding to the application end, and configures resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information, thereby utilizing the historical operating performance characteristic information and the hardware performance characteristic information to achieve dynamic configuration of coroutine stack resources, better balance the stack resources and the overall operating performance of the system, and effectively guarantee the operating performance of the application end. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.

[0020] Figure 1 This is a flowchart of a method for configuring coroutine stack resources provided in the first embodiment of the present disclosure;

[0021] Figure 2 This is a flowchart of a method for configuring coroutine stack resources provided in the second embodiment of the present disclosure;

[0022] Figure 3 This is a structural diagram of a coroutine stack resource configuration device provided in the third embodiment of the present disclosure;

[0023] Figure 4 This is a structural diagram of an electronic device provided in Example 4 of the present disclosure. DETAILED DESCRIPTION

[0024] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0025] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0026] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.

[0027] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0028] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0030] Example 1

[0031] Figure 1 This is a flowchart of a method for configuring coroutine stack resources provided in the first embodiment of the present disclosure. This embodiment is applicable to the case of configuring resources for the coroutine stack required for executing the coroutine of the application. The method can be executed by a coroutine stack resource configuration device, which can be implemented by software and / or hardware and integrated into the application end, which can refer to a client (such as a smartphone, etc.) or a server with a higher degree of concurrency. Figure 1 As shown, the method specifically includes the following steps:

[0032] S110: Obtain historical operation performance characteristic information and hardware performance characteristic information corresponding to the application end.

[0033] The historical operation performance characteristic information may be performance indicator information used to characterize the operation of the application end within a historical time period. The historical operation performance characteristic information may include, but is not limited to, at least one of historical network performance characteristic information and historical application operation characteristic information. The historical network performance characteristic information may be indicator information used to characterize historical network quality. For example, the historical network performance characteristic information may include, but is not limited to, at least one of packet loss rate, uplink and downlink bandwidth information, and delay time within a preset historical time period. The historical application operation characteristic information may be used to characterize the historical operation indicator information of the application on the application end. For example, the historical application operation indicator information may include, but is not limited to, at least one of memory usage information, central processing unit (CPU) load information, the dynamic range of the number of threads during application operation, and input or output I / O load information within a preset historical time period. The preset historical time period may be a historical time period with a fixed time interval set based on the current moment. For example, the preset historical time period may be within the last 1 day.

[0034] The hardware performance characteristic information may be indicator information used to characterize the performance of the application-side hardware. For example, the hardware performance characteristic information may include, but is not limited to, at least one of the application-side memory size, the number of CPU cores, and the frequency.

[0035] It should be noted that the historical operation performance characteristic information can be different historical data generated for different application usage scenarios on the application side. When the application side is a client, there may be application usage scenarios such as playing videos, shooting videos, uploading videos, or network interactions in the client. When the application side is a server, there may be application usage scenarios such as high-concurrency network communications, high-performance computing, or high-load input or output I / O in the server. This embodiment can dynamically configure coroutine stack resources that are more suitable for the application side by obtaining different historical operation performance characteristic information generated by the application side in different application usage scenarios, thereby effectively ensuring the operation performance of the application side.

[0036] Specifically, when the coroutine stack needs to be configured, that is, when the trigger conditions for coroutine stack resource configuration are met, the corresponding historical operating performance characteristic information and hardware performance characteristic information of the application side can be obtained. It should be noted that the hardware performance characteristic information of the application side is fixed, while the historical operating performance characteristic information changes over time. Therefore, when the coroutine stack resource configuration is performed on the application side multiple times, the hardware performance characteristic information can be obtained only once, while the historical operating performance characteristic information corresponding to the application side needs to be obtained in real time each time.

[0037] Exemplarily, "obtaining historical running performance characteristic information corresponding to the application end" in S110 may include: in response to the application end startup operation triggered by the user, obtaining the historical running performance characteristic information when the application end is started; or, during the running process after the application end is started, if it is determined based on the current running performance characteristic information that the preset coroutine stack reset condition is currently met, then obtaining the historical running performance characteristic information of the application end within the current preset historical time period.

[0038] Among them, the application-side startup operation can be an operation in which the user starts the application side, for example, the user starts the application side by clicking on the application software icon. The current running performance characteristic information can refer to the current running indicator information during the startup and operation of the application side. For example, the current running performance characteristic information may include: at least one of memory occupancy information, CPU load information and I / O load information. The preset coroutine stack reset condition can be a pre-set condition that allows the coroutine stack resources to be reconfigured to further improve the running performance. For example, the preset coroutine stack reset condition can be but is not limited to: at least one of the memory occupancy rate being lower than a preset threshold, the CPU load size being lower than a preset threshold and the I / O load size being lower than a preset threshold.

[0039] Specifically, by starting the application-side operation, the configuration operation of the coroutine stack resources can be triggered when the application starts, thereby initializing the configuration of the coroutine operation. During the operation process after the application starts, the current operation performance characteristic information can be detected in real time to see whether it meets the preset coroutine stack reset conditions, that is, whether the current performance is sufficient. When the preset coroutine stack reset conditions are met, the coroutine stack resource reset operation is triggered, thereby adjusting the stack resources in real time during the application-side operation, further improving the operation performance.

[0040] S120: Perform coroutine stack resource allocation based on historical operation performance characteristic information and hardware performance characteristic information, and determine current coroutine stack resource allocation information corresponding to the application end.

[0041] Among them, the current coroutine stack resource allocation information may refer to the resource information allocated to the coroutine stack at the current moment. Different resource information may be allocated to the coroutine stack according to different historical operating performance characteristic information or different hardware performance characteristic information, so as to realize dynamic allocation of stack resources. The coroutine stack in this embodiment may include two forms: exclusive stack and shared stack. Among them, the stack space of the exclusive stack is exclusively occupied by one coroutine and cannot be used by other coroutines. The stack space of the shared stack is shared by all coroutines, that is, all coroutines can use the shared stack. The current coroutine stack resource allocation information may include: currently allocated exclusive stack resource allocation information or shared stack resource allocation information. Among them, the exclusive stack resource allocation information may include: the number of system threads, the initial memory size of the exclusive stack and the memory growth step of the exclusive stack. The shared stack resource allocation information may include: the shared stack memory size and the number of shared stacks.

[0042] Specifically, based on a preset allocation method, such as an optimization equation solving method or a machine learning method, historical operating performance characteristic information and hardware performance characteristic information can be aggregated and classified to determine whether the coroutine stack currently to be configured is an exclusive stack or a shared stack and the corresponding stack resource allocation information.

[0043] Exemplarily, the process of determining the current coroutine stack resource allocation information can be implemented in at least the following two ways:

[0044] As an implementation method, S120 may include: optimizing a preset performance function based on historical operation performance characteristic information and hardware performance characteristic information, and determining current coroutine stack resource allocation information corresponding to the application end.

[0045] Among them, based on the quality of service QoS (Quality of Service) evaluation indicators, such as the superposition of single indicators among the first frame delay, interface smoothness, audio and video freeze rate, room entry delay and audio and video bit rate when the application side plays the video, or a nonlinear combination, a QoS linear function containing various stack parameters in the coroutine stack resource, that is, a preset performance function, can be set. For example, a preset performance function corresponding to an exclusive stack including the number of system threads N, the initial memory size of the exclusive stack init_size and the exclusive stack memory growth step intval_size, and another preset performance function corresponding to a shared stack including the shared stack memory size and the number of shared stacks M can be set; or, a preset performance function including the number of system threads N, the initial memory size of the exclusive stack init_size, the exclusive stack memory growth step intval_size, whether to use a shared stack, and the shared stack memory size and the number of shared stacks M can be set, so as to improve the solution efficiency by solving only one preset performance function, thereby further improving the resource allocation efficiency.

[0046] Specifically, dynamic constraints corresponding to the preset performance function can be set based on historical operating performance characteristic information, and static constraints corresponding to the preset performance function can be set based on hardware performance characteristic information. For example, the constraint condition for the number of system threads N is the number of CPU cores, and the initial memory size init_size of the exclusive stack and the memory growth step intval_size are related to the memory size of the application side. By optimizing the preset performance function under these constraints, that is, by adjusting the size of each stack parameter in the coroutine stack resource in the preset performance function, the QoS evaluation index is optimized, and the size of each stack parameter when the preset performance function takes the maximum value is determined as the current coroutine stack resource allocation information corresponding to the application side, so that the current coroutine stack resource allocation information can be determined by optimizing the preset performance function.

[0047] As another implementation method, S120 may also include: inputting historical operating performance characteristic information and hardware performance characteristic information into a pre-trained preset resource allocation network model, and determining the current coroutine stack resource allocation information corresponding to the application end based on the output of the preset resource allocation network model.

[0048] Among them, the preset resource allocation network model can be a machine learning network model obtained by pre-training based on sample data and a preset training function. The sample data can refer to sample historical operating performance characteristic information and sample hardware performance characteristic information. The preset training function can refer to a function related to QoS, which contains various stack parameters in the coroutine stack resource, such as a training function containing the number of system threads N, the initial memory size of the exclusive stack init_size, the memory growth step of the exclusive stack intval_size, whether to use a shared stack, and the shared stack memory size and the number of shared stacks M. The training process of the preset resource allocation network model can include: inputting sample data into the preset resource allocation network model to be trained, obtaining sample coroutine stack resource allocation information based on the output of the preset resource allocation network model to be trained, and determining the current performance value based on the preset training function and the sample coroutine stack resource allocation information, and maximizing the preset training function by adjusting the network parameters in the preset resource allocation network model to be trained, and when the maximum value of the preset training function remains unchanged, the training ends and the preset resource allocation network model is obtained.

[0049] Specifically, by inputting historical operating performance characteristic information and hardware performance characteristic information into a pre-trained preset resource allocation network model, and based on the output of the preset resource allocation network model, the current coroutine stack resource allocation information can be obtained more quickly, thereby utilizing the preset resource allocation network model to further improve the allocation efficiency of the coroutine stack resources.

[0050] S130: Based on the current coroutine stack resource allocation information, configure resources for the coroutine stack on the application side.

[0051] Specifically, if the current coroutine stack resource allocation information is obtained when the application is started, the application-side coroutine stack can be initialized based on the current coroutine stack resource allocation information, so that the coroutine executes the corresponding application based on the initialized coroutine stack. If the current coroutine stack resource allocation information is obtained during the operation of the application after startup, the runtime stack resources can be adjusted based on the current coroutine stack resource allocation information, thereby better balancing the stack resources and the overall system performance.

[0052] The technical solution of the embodiment of the present disclosure obtains historical operating performance characteristic information and hardware performance characteristic information corresponding to the application end, and allocates coroutine stack resources based on the historical operating performance characteristic information and hardware performance characteristic information, determines the current coroutine stack resource allocation information corresponding to the application end, and configures resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information, thereby utilizing the historical operating performance characteristic information and hardware performance characteristic information to realize dynamic configuration of coroutine stack resources, better balance the stack resources and the overall operating performance of the system, and effectively guarantee the operating performance of the application end.

[0053] Example 2

[0054] Figure 2 This is a flowchart of a method for configuring coroutine stack resources provided in Example 2 of the present disclosure. Building on the previous example, this example describes in detail the resource allocation process for the coroutine stack when no historical performance characteristic information corresponding to the application is currently available. Explanations of terms that are identical or corresponding to those in the previous examples are omitted here.

[0055] See also Figure 2 The coroutine stack resource configuration method provided in this embodiment specifically includes the following steps:

[0056] S210: Obtain historical operation performance characteristic information and hardware performance characteristic information corresponding to the application end.

[0057] Specifically, in response to an application-side startup operation triggered by a user, historical operating performance characteristic information and hardware performance characteristic information when the application side is started can be obtained.

[0058] S220 , detecting whether there is historical operation performance characteristic information corresponding to the application end. If so, executing step S230 ; if not, executing step S240 .

[0059] Specifically, the subsequent coroutine stack resource allocation method can be determined by detecting whether the historical running performance characteristic information is successfully obtained.

[0060] S230: Perform coroutine stack resource allocation based on historical operating performance characteristic information and hardware performance characteristic information, and determine current coroutine stack resource allocation information corresponding to the application end.

[0061] Specifically, when the historical operating performance characteristic information is successfully obtained, the coroutine stack resources can be dynamically allocated based on the historical operating performance characteristic information and the hardware performance characteristic information to better balance the stack resources and the overall operating performance of the system.

[0062] S240: Allocate coroutine stack resources based on the hardware performance characteristic information, and determine current coroutine stack resource allocation information corresponding to the application end.

[0063] Specifically, when historical performance characteristic information acquisition fails, coroutine stack resource allocation can be performed based solely on hardware performance characteristic information to obtain current coroutine stack resource allocation information that matches the application's hardware performance, thereby ensuring the application's performance. This acquisition failure may occur due to: first-time startup, previous deletion of application cache data, application program updates, or insufficient historical performance characteristic information currently available.

[0064] Exemplarily, S240 may include: determining a target performance category corresponding to the application end based on the hardware performance characteristic information, and determining current coroutine stack resource allocation information corresponding to the application end based on the target performance category.

[0065] The target performance category may include: a high performance category, a medium performance category, or a low performance category.

[0066] Specifically, the target performance category corresponding to the application side can be determined based on at least one of the application side memory size, number of CPU cores, and frequency size. For example, a weighted score can be performed based on the application side memory size, number of CPU cores, and frequency size, and the target performance category corresponding to the application side can be determined based on the score range corresponding to each type and the current score obtained. The target allocation method corresponding to the target performance type can be determined based on the allocation method corresponding to each performance category, and the coroutine stack resources can be allocated according to the target allocation method to obtain the current coroutine stack resource allocation information.

[0067] Exemplarily, based on the target performance category, determining the current coroutine stack resource allocation information corresponding to the application end may include: if the target performance category is a high-performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset aggressive allocation method; if the target performance category is a medium-performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset balanced allocation method; if the target performance category is a low-performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset conservative allocation method.

[0068] The coroutine stack types corresponding to the preset aggressive allocation method and the preset balanced allocation method are both exclusive stacks; the number of system threads, the initial memory size of the exclusive stack, and the memory growth step size of the exclusive stack in the preset aggressive allocation method are all larger than the number of system threads, the initial memory size of the exclusive stack, and the memory growth step size of the exclusive stack in the preset balanced allocation method; the coroutine stack type corresponding to the preset conservative allocation method is a shared stack, and the shared stack memory size and the number of shared stacks in the preset conservative allocation method are determined based on the current remaining resource information. The current remaining resource information may include, but is not limited to, at least one of: current remaining memory information, remaining CPU information, and remaining I / O information.

[0069] Specifically, for high-performance application ends, that is, models with good performance, a preset aggressive allocation method can be used to sample exclusive stacks, and a larger number of system threads, a larger initial memory size of the exclusive stack, and a larger step size of exclusive stack memory growth can be allocated to each coroutine. For medium-performance application ends, that is, models with average performance, a preset balanced allocation method can be used to sample exclusive stacks, and a smaller number of system threads, a smaller initial memory size of the exclusive stack, and a smaller step size of exclusive stack memory growth can be allocated to each coroutine. For low-performance application ends, that is, models with weak performance, a preset conservative allocation method can be used to sample shared stacks, and a shared stack memory size and number of shared stacks that match the current remaining resource information can be allocated, thereby ensuring the operating performance of the application end.

[0070] S250: Based on the current coroutine stack resource allocation information, configure resources for the coroutine stack on the application side.

[0071] The technical solution of this embodiment determines the current coroutine stack resource allocation information corresponding to the application side by allocating coroutine stack resources based on hardware performance characteristic information when there is no historical operating performance characteristic information corresponding to the application side. In this way, when there is no historical operating performance characteristic information, the stack resources and the overall operating performance of the system can be balanced, thereby effectively ensuring the operating performance of the application side.

[0072] The following is an embodiment of a coroutine stack resource configuration device provided in an embodiment of the present disclosure. The device and the coroutine stack resource configuration method of the above embodiment belong to the same inventive concept. For details not fully described in the embodiment of the coroutine stack resource configuration device, please refer to the coroutine stack resource configuration method of the above embodiment.

[0073] Example 3

[0074] Figure 3This is a schematic diagram of the structure of a coroutine stack resource configuration device provided in the third embodiment of the present disclosure. This embodiment is applicable to the case where the coroutine stack required for executing the coroutine of the application is configured with resources. Figure 3 As shown, the device specifically includes: a performance characteristic information acquisition module 310, a coroutine stack resource allocation module 320 and a coroutine stack resource configuration module 330.

[0075] Among them, the performance characteristic information acquisition module 310 is used to obtain the historical operating performance characteristic information and hardware performance characteristic information corresponding to the application end; the coroutine stack resource allocation module 320 is used to allocate coroutine stack resources based on the historical operating performance characteristic information and hardware performance characteristic information, and determine the current coroutine stack resource allocation information corresponding to the application end; the coroutine stack resource configuration module 330 is used to configure resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information.

[0076] The technical solution of the embodiment of the present disclosure obtains historical operating performance characteristic information and hardware performance characteristic information corresponding to the application end, and allocates coroutine stack resources based on the historical operating performance characteristic information and hardware performance characteristic information, determines the current coroutine stack resource allocation information corresponding to the application end, and configures resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information, thereby utilizing the historical operating performance characteristic information and hardware performance characteristic information to realize dynamic configuration of coroutine stack resources, better balance the stack resources and the overall operating performance of the system, and effectively guarantee the operating performance of the application end.

[0077] Based on the above technical solution, the historical operation performance characteristic information includes: at least one of historical network performance characteristic information and historical application operation characteristic information; the hardware performance characteristic information includes: at least one of the application-side memory size, the number of central processing unit CPU cores and the frequency size.

[0078] Based on the above technical solutions, historical network performance characteristic information includes: packet loss rate, uplink and downlink bandwidth information and at least one of delay time within a preset historical time period; historical application operation indicator information includes: memory usage information, CPU load information, dynamic change range of the number of threads when the application is running and at least one of I / O load information within a preset historical time period.

[0079] Based on the above technical solutions, the current coroutine stack resource allocation information includes: the currently allocated exclusive stack resource allocation information or shared stack resource allocation information; among them, the exclusive stack resource allocation information includes: the number of system threads, the initial memory size of the exclusive stack and the exclusive stack memory growth step; the shared stack resource allocation information includes: the shared stack memory size and the number of shared stacks.

[0080] Based on the above technical solutions, the performance characteristic information acquisition module 310 is specifically used to:

[0081] In response to a user-triggered application-side startup operation, obtaining historical operating performance characteristic information when the application side is started; or,

[0082] During the operation of the application after startup, if it is determined based on the current operation performance characteristic information that the preset coroutine stack reset condition is currently met, the historical operation performance characteristic information of the application within the current preset historical time period is obtained.

[0083] Based on the above technical solutions, the coroutine stack resource allocation module 320 is specifically used to:

[0084] Based on historical performance characteristics and hardware performance characteristics, the preset performance function is optimized to determine the current coroutine stack resource allocation information corresponding to the application side; or

[0085] The historical operating performance characteristic information and hardware performance characteristic information are input into the pre-trained preset resource allocation network model, and the current coroutine stack resource allocation information corresponding to the application end is determined based on the output of the preset resource allocation network model.

[0086] On the basis of the above technical solutions, the device also includes:

[0087] The resource allocation module is used to allocate coroutine stack resources based on hardware performance characteristic information if there is no historical operating performance characteristic information corresponding to the application side, and determine the current coroutine stack resource allocation information corresponding to the application side.

[0088] Based on the above technical solutions, the resource allocation module is specifically used to: determine the target performance category corresponding to the application end based on the hardware performance characteristic information, and determine the current coroutine stack resource allocation information corresponding to the application end based on the target performance category.

[0089] Based on the above technical solutions, the resource allocation module is specifically used to:

[0090] If the target performance category is the high performance category, the current coroutine stack resource allocation information corresponding to the application side is determined based on the preset aggressive allocation method; if the target performance category is the medium performance category, the current coroutine stack resource allocation information corresponding to the application side is determined based on the preset balanced allocation method; if the target performance category is the low performance category, the current coroutine stack resource allocation information corresponding to the application side is determined based on the preset conservative allocation method.

[0091] Based on the above technical solutions, the coroutine stack types corresponding to the preset aggressive allocation mode and the preset balanced allocation mode are both exclusive stacks; the number of system threads, the initial memory size of the exclusive stack, and the exclusive stack memory growth step in the preset aggressive allocation mode are all larger than the number of system threads, the initial memory size of the exclusive stack, and the exclusive stack memory growth step in the preset balanced allocation mode;

[0092] The coroutine stack type corresponding to the preset conservative allocation method is a shared stack. The shared stack memory size and the number of shared stacks in the preset conservative allocation method are determined based on the current remaining resource information.

[0093] The coroutine stack resource configuration device provided in the embodiment of the present disclosure can execute the coroutine stack resource configuration method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the coroutine stack resource configuration method.

[0094] It is worth noting that in the embodiment of the above-mentioned coroutine stack resource configuration device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0095] Example 4

[0096] Reference below Figure 4 , which shows a structural diagram of an electronic device 900 suitable for implementing the embodiments of the present disclosure. Figure 4 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0097] like Figure 4 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0098] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.

[0099] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.

[0100] The electronic device provided by the embodiment of the present disclosure and the coroutine stack resource configuration method provided by the above embodiment belong to the same inventive concept. For technical details not fully described in the embodiment of the present disclosure, please refer to the above embodiment, and the embodiment of the present disclosure has the same beneficial effects as the above embodiment.

[0101] Example 5

[0102] An embodiment of the present disclosure provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the coroutine stack resource configuration method provided in the above embodiment is implemented.

[0103] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0104] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0105] The computer-readable medium may be included in the server, or may exist independently without being incorporated into the server.

[0106] The computer-readable medium carries one or more programs. When the one or more programs are executed by the server, the server: obtains historical operating performance characteristic information and hardware performance characteristic information corresponding to the application end; allocates coroutine stack resources based on the historical operating performance characteristic information and hardware performance characteristic information, and determines the current coroutine stack resource allocation information corresponding to the application end; and configures resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information.

[0107] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0108] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0109] The units involved in the embodiments described in this disclosure may be implemented by software or hardware. In some cases, the name of a unit does not constitute a limitation on the unit itself. For example, an editable content display unit may also be described as an "editing unit."

[0110] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0111] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0112] According to one or more embodiments of the present disclosure, [Example 1] provides a method for configuring coroutine stack resources, including:

[0113] Obtain the historical performance characteristics information and hardware performance characteristics information corresponding to the application side;

[0114] Performing coroutine stack resource allocation based on the historical operating performance characteristic information and the hardware performance characteristic information, and determining current coroutine stack resource allocation information corresponding to the application end;

[0115] Based on the current coroutine stack resource allocation information, resources are configured for the coroutine stack of the application end.

[0116] According to one or more embodiments of the present disclosure, [Example 2] provides a method for configuring coroutine stack resources, further comprising:

[0117] Optionally, the historical operation performance characteristic information includes: at least one of historical network performance characteristic information and historical application operation characteristic information;

[0118] The hardware performance characteristic information includes: at least one of the application end memory size, the number of central processing unit (CPU) cores and the frequency size.

[0119] According to one or more embodiments of the present disclosure, [Example 3] provides a method for configuring coroutine stack resources, further comprising:

[0120] Optionally, the historical network performance characteristic information includes: at least one of a packet loss rate, uplink and downlink bandwidth information, and a delay time within a preset historical time period;

[0121] The historical application running indicator information includes: at least one of memory usage information, CPU load information, dynamic range of thread number when the application is running, and I / O load information within a preset historical time period.

[0122] According to one or more embodiments of the present disclosure, [Example 4] provides a method for configuring coroutine stack resources, further comprising:

[0123] Optionally, the current coroutine stack resource allocation information includes: currently allocated exclusive stack resource allocation information or shared stack resource allocation information;

[0124] The exclusive stack resource allocation information includes: the number of system threads, the initial memory size of the exclusive stack, and the memory growth step of the exclusive stack; the shared stack resource allocation information includes: the shared stack memory size and the number of shared stacks.

[0125] According to one or more embodiments of the present disclosure, [Example 5] provides a method for configuring coroutine stack resources, further comprising:

[0126] Optionally, obtaining historical operating performance characteristic information corresponding to the application end includes:

[0127] In response to a user-triggered application-side startup operation, obtaining historical operating performance characteristic information when the application side is started; or,

[0128] During the operation of the application end after startup, if it is determined based on the current operation performance characteristic information that the preset coroutine stack reset condition is currently met, the historical operation performance characteristic information of the application end within the current preset historical time period is obtained.

[0129] According to one or more embodiments of the present disclosure, [Example 6] provides a method for configuring coroutine stack resources, further comprising:

[0130] Optionally, performing coroutine stack resource allocation based on the historical operating performance characteristic information and the hardware performance characteristic information to determine current coroutine stack resource allocation information corresponding to the application end includes:

[0131] Based on the historical operation performance characteristic information and the hardware performance characteristic information, a preset performance function is optimized and solved to determine the current coroutine stack resource allocation information corresponding to the application end; or

[0132] The historical operating performance characteristic information and the hardware performance characteristic information are input into a pre-trained preset resource allocation network model, and the current coroutine stack resource allocation information corresponding to the application end is determined based on the output of the preset resource allocation network model.

[0133] According to one or more embodiments of the present disclosure, [Example 7] provides a method for configuring coroutine stack resources, further comprising:

[0134] Optionally, the method further includes:

[0135] If there is currently no historical operating performance characteristic information corresponding to the application end, coroutine stack resource allocation is performed based on the hardware performance characteristic information to determine current coroutine stack resource allocation information corresponding to the application end.

[0136] According to one or more embodiments of the present disclosure, [Example 8] provides a method for configuring coroutine stack resources, further comprising:

[0137] Optionally, performing coroutine stack resource allocation based on the hardware performance characteristic information and determining current coroutine stack resource allocation information corresponding to the application end includes:

[0138] A target performance category corresponding to the application end is determined based on the hardware performance characteristic information, and current coroutine stack resource allocation information corresponding to the application end is determined based on the target performance category.

[0139] According to one or more embodiments of the present disclosure, [Example 9] provides a method for configuring coroutine stack resources, further comprising:

[0140] Optionally, determining the current coroutine stack resource allocation information corresponding to the application end based on the target performance category includes:

[0141] If the target performance category is a high performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset aggressive allocation method;

[0142] If the target performance category is a medium performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset balanced allocation method;

[0143] If the target performance category is a low performance category, the current coroutine stack resource allocation information corresponding to the application end is determined based on a preset conservative allocation method.

[0144] According to one or more embodiments of the present disclosure, [Example 10] provides a method for configuring coroutine stack resources, further comprising:

[0145] Optionally, the coroutine stack types corresponding to the preset aggressive allocation mode and the preset balanced allocation mode are both exclusive stacks; the number of system threads, the initial memory size of the exclusive stack, and the exclusive stack memory growth step in the preset aggressive allocation mode are respectively larger than the number of system threads, the initial memory size of the exclusive stack, and the exclusive stack memory growth step in the preset balanced allocation mode;

[0146] The coroutine stack type corresponding to the preset conservative allocation method is a shared stack, and the shared stack memory size and the number of shared stacks in the preset conservative allocation method are determined based on the current remaining resource information.

[0147] According to one or more embodiments of the present disclosure, [Example 11] provides a coroutine stack resource configuration device, including:

[0148] The performance characteristic information acquisition module is used to obtain the historical operation performance characteristic information and hardware performance characteristic information corresponding to the application end;

[0149] A coroutine stack resource allocation module is used to allocate coroutine stack resources based on the historical operation performance characteristic information and the hardware performance characteristic information, and determine the current coroutine stack resource allocation information corresponding to the application end;

[0150] The coroutine stack resource configuration module is used to configure resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information.

[0151] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.

[0152] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0153] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.

Claims

1. A method for configuring coroutine stack resources, characterized in that: include: Obtain the historical performance characteristics information and hardware performance characteristics information corresponding to the application side; Performing coroutine stack resource allocation based on the historical operating performance characteristic information and the hardware performance characteristic information, and determining current coroutine stack resource allocation information corresponding to the application end, wherein the current coroutine stack resource allocation information includes currently allocated exclusive stack resource allocation information or shared stack resource allocation information; Based on the current coroutine stack resource allocation information, perform resource configuration on the coroutine stack of the application end; The method further comprises: If there is currently no historical operating performance characteristic information corresponding to the application end, coroutine stack resource allocation is performed based on the hardware performance characteristic information to determine current coroutine stack resource allocation information corresponding to the application end.

2. The method according to claim 1, characterized in that The historical operation performance characteristic information includes: at least one of historical network performance characteristic information and historical application operation characteristic information; The hardware performance characteristic information includes: at least one of the application end memory size, the number of central processing unit (CPU) cores and the frequency size.

3. The method according to claim 2, characterized in that The historical network performance characteristic information includes: at least one of the packet loss rate, uplink and downlink bandwidth information and delay time within a preset historical time period; The historical application running characteristic information includes at least one of: memory usage information, CPU load information, dynamic range of the number of threads when the application is running, and I / O load information within a preset historical time period.

4. The method according to claim 1, wherein The current coroutine stack resource allocation information includes: currently allocated exclusive stack resource allocation information or shared stack resource allocation information; The exclusive stack resource allocation information includes: the number of system threads, the initial memory size of the exclusive stack, and the memory growth step of the exclusive stack; the shared stack resource allocation information includes: the shared stack memory size and the number of shared stacks.

5. The method according to claim 1, wherein The obtaining of historical operating performance characteristic information corresponding to the application end includes: In response to a user-triggered application-side startup operation, obtaining historical operating performance characteristic information when the application side is started; or, During the operation of the application end after startup, if it is determined based on the current operation performance characteristic information that the preset coroutine stack reset condition is currently met, the historical operation performance characteristic information of the application end within the current preset historical time period is obtained.

6. The method according to claim 1, characterized in that The performing coroutine stack resource allocation based on the historical operation performance characteristic information and the hardware performance characteristic information, and determining current coroutine stack resource allocation information corresponding to the application end, includes: Based on the historical operation performance characteristic information and the hardware performance characteristic information, a preset performance function is optimized and solved to determine the current coroutine stack resource allocation information corresponding to the application end; or The historical operating performance characteristic information and the hardware performance characteristic information are input into a pre-trained preset resource allocation network model, and the current coroutine stack resource allocation information corresponding to the application end is determined based on the output of the preset resource allocation network model.

7. The method according to claim 1, characterized in that The performing coroutine stack resource allocation based on the hardware performance characteristic information and determining current coroutine stack resource allocation information corresponding to the application end includes: A target performance category corresponding to the application end is determined based on the hardware performance characteristic information, and current coroutine stack resource allocation information corresponding to the application end is determined based on the target performance category.

8. The method according to claim 7, characterized in that The determining, based on the target performance category, current coroutine stack resource allocation information corresponding to the application end includes: If the target performance category is a high performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset aggressive allocation method; If the target performance category is a medium performance category, determining the current coroutine stack resource allocation information corresponding to the application end based on a preset balanced allocation method; If the target performance category is a low performance category, the current coroutine stack resource allocation information corresponding to the application end is determined based on a preset conservative allocation method.

9. The method according to claim 8, characterized in that The coroutine stack types corresponding to the preset aggressive allocation mode and the preset balanced allocation mode are both exclusive stacks; the number of system threads, the initial memory size of the exclusive stack, and the exclusive stack memory growth step in the preset aggressive allocation mode are all larger than the number of system threads, the initial memory size of the exclusive stack, and the exclusive stack memory growth step in the preset balanced allocation mode, respectively; The coroutine stack type corresponding to the preset conservative allocation method is a shared stack, and the shared stack memory size and the number of shared stacks in the preset conservative allocation method are determined based on the current remaining resource information.

10. A coroutine stack resource configuration device, characterized in that: include: The performance characteristic information acquisition module is used to obtain the historical operation performance characteristic information and hardware performance characteristic information corresponding to the application end; a coroutine stack resource allocation module, configured to allocate coroutine stack resources based on the historical operating performance characteristic information and the hardware performance characteristic information, and determine current coroutine stack resource allocation information corresponding to the application end, wherein the current coroutine stack resource allocation information includes currently allocated exclusive stack resource allocation information or shared stack resource allocation information; A coroutine stack resource configuration module, configured to configure resources for the coroutine stack of the application end based on the current coroutine stack resource allocation information; The device further comprises: The resource allocation module is used to allocate coroutine stack resources based on hardware performance characteristic information if there is no historical operating performance characteristic information corresponding to the application side, and determine the current coroutine stack resource allocation information corresponding to the application side.

11. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the coroutine stack resource configuration method as described in any one of claims 1 to 9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the coroutine stack resource configuration method as described in any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Resource allocation method and device, electronic equipment and storage medium

    CN112527509A