Sleep mode switching method and device and storage medium

By obtaining instance information, it automatically switches the sleep mode of cloud instances, which solves the problem that users cannot flexibly switch shallow sleep and deep sleep modes, and achieves more efficient mode switching and cost control.

CN120335942APending Publication Date: 2025-07-18HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410076958.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-18
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, user operations cannot realize flexible switching between shallow sleep mode and deep sleep mode of cloud instance, resulting in inflexible switching.

Method used

By obtaining the instance information of the current scheduling time, the target cloud instance is automatically determined, and its sleep mode is switched from the first sleep mode to the second sleep mode. The sleep mode switching process of the cloud instance is optimized using historical connection data and parameters such as preset time periods and deep sleep rate thresholds.

Benefits of technology

Improves the flexibility of switching between shallow sleep mode and deep sleep mode for cloud instances, improves user experience and reduces cloud operation costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335942A_ABST
    Figure CN120335942A_ABST
Patent Text Reader

Abstract

The invention provides a sleep mode switching method and device and a storage medium. The method comprises the steps that instance information corresponding to cloud instances in a first sleep mode at the current scheduling moment is obtained; based on the instance information, determining a target cloud instance of which the sleep mode needs to be switched at the current scheduling moment from the cloud instances; and switching the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode. And when the current scheduling moment arrives, determining a target cloud instance of which the sleep mode needs to be switched at the current scheduling moment based on the instance information of each cloud instance, and switching the sleep mode of the target cloud instance from the first sleep mode to a second sleep mode. Visibly, according to the embodiment of the invention, the switching of the cloud instance between the shallow sleep mode and the deep sleep mode is automatically realized through the instance information of the cloud instance, and compared with the manual switching of the cloud instance between the shallow sleep mode and the deep sleep mode, the switching flexibility of the sleep mode of the cloud instance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer technology, and particularly relates to a method, device, and storage medium for switching between hibernation modes. Background Art

[0002] Cloud instances in the cloud support two hibernation modes: Hibernation mode and Sleeping mode. When a cloud instance is in the Hibernation mode, the computing resources of the cloud instance are released, which can save the operating costs of the cloud. When a cloud instance is in the Sleeping mode, the computing resources of the cloud instance cannot be released, and the processes corresponding to the cloud instance are suspended. The time taken for a cloud instance to switch from the Sleeping mode to the running mode is stable at the second level, so it can bring a good user experience.

[0003] Currently, based on the user's operation, a cloud instance is switched from the running mode to the Sleeping mode or the Hibernation mode, or a cloud instance is switched from the Sleeping mode or the Hibernation mode to the running mode. However, the user's operation cannot achieve a flexible switch between the Sleeping mode and the Hibernation mode of the cloud instance. Summary of the Invention

[0004] This application proposes a method, device, and storage medium for switching between hibernation modes, which can alleviate the technical problem in the related art that the user's operation cannot achieve a flexible switch between the Sleeping mode and the Hibernation mode of the cloud instance.

[0005] A first aspect embodiment of this application proposes a method for switching between hibernation modes, including:

[0006] Obtain the instance information corresponding to each cloud instance in the first hibernation mode at the current scheduling moment, where the instance information is used to indicate the working modes of each cloud instance at different moments before the current scheduling moment;

[0007] Based on the instance information, determine a target cloud instance whose hibernation mode needs to be switched at the current scheduling moment from the cloud instances;

[0008] Switch the hibernation mode of the target cloud instance from the first hibernation mode to the second hibernation mode; the first hibernation mode is one of the Hibernation mode and the Sleeping mode, and the second hibernation mode is the other one of the Hibernation mode and the Sleeping mode except the first hibernation mode.

[0009] In some embodiments, the first sleep mode is the deep sleep mode, and the second sleep mode is the light sleep mode; the instance information includes historical connection data, and the historical connection data is used to indicate the operating modes of the cloud instance corresponding to the instance information at different times before the current scheduling moment; determining a target cloud instance that needs to switch the sleep mode at the current scheduling moment from the cloud instances based on the instance information includes:

[0010] Determine a target time period based on the current scheduling moment and a preset time length interval; the moments included in the target time period are later than the current scheduling moment;

[0011] Determine a historical time period corresponding to the target time period within a preset first historical time;

[0012] Obtain target connection data in the historical time period from the historical connection data included in each instance information;

[0013] Determine the target cloud instance from the cloud instances based on the target connection data.

[0014] In some embodiments, determining the target cloud instance from the cloud instances based on the target connection data includes:

[0015] Obtain the target number of cloud instances in the running mode included in the target connection data;

[0016] When the deep sleep rate at the current scheduling moment is greater than a preset deep sleep rate threshold, update the first historical time to a second historical time based on the deep sleep rate, the deep sleep rate threshold, the total number of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment, and the target number, and return to execute the step of determining the historical time period corresponding to the target time period within the preset first historical time until the deep sleep rate is less than or equal to the deep sleep rate threshold; the second historical time is greater than the first historical time;

[0017] When the deep sleep rate at the current scheduling moment is less than or equal to the deep sleep rate threshold, obtain the target cloud instance based on statistical cloud instances, and the statistical cloud instances are cloud instances that are in the deep sleep mode at the current scheduling moment and are in the running mode in the target connection data.

[0018] In some embodiments, updating the first historical time to a second historical time based on the deep sleep rate, the deep sleep rate threshold, the total number of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment, and the target number includes:

[0019] Calculate a first difference between the deep sleep rate and the deep sleep rate threshold;

[0020] Calculate the product of the first difference and the total quantity;

[0021] Calculate a second difference between the product and the target quantity;

[0022] Update the first historical time to the second historical time based on the second difference.

[0023] In some embodiments, obtaining the target cloud instance based on the statistical cloud instances includes:

[0024] When the number of the statistical cloud instances is less than or equal to the maximum pre - wake - up number, use the statistical cloud instances as the target cloud instances; the maximum pre - wake - up number is the number of cloud instances that can be pre - woken up at most at one time;

[0025] When the number of the statistical cloud instances is greater than the maximum pre - wake - up number, select the maximum pre - wake - up number of cloud instances with the highest priority from the statistical cloud instances as the target cloud instances.

[0026] In some embodiments, it further includes:

[0027] Obtain the quantity of each cloud instance;

[0028] When the quantity of each cloud instance is greater than the quantity threshold, shorten the first scheduling period to the second scheduling period, where the first scheduling period is used to calculate the current scheduling moment based on the previous scheduling moment;

[0029] Calculate the next scheduling moment based on the current scheduling moment and the second scheduling period.

[0030] In some embodiments, the first sleep mode is the light sleep mode, and the second sleep mode is the deep sleep mode; the instance information includes the light sleep duration, which is used to represent the duration of the cloud instance in the light sleep mode; based on the instance information, determining the target cloud instance that needs to switch the sleep mode at the current scheduling moment from each cloud instance includes:

[0031] Obtain the quantity of cloud instances in the light sleep mode at the current scheduling moment;

[0032] When the quantity is less than the maximum sleep - scheduling number, determine the cloud instances with the light sleep duration greater than the preset duration threshold in the instance information as the target cloud instances;

[0033] When the quantity is greater than or equal to the maximum quantity of the sleep scheduling, select the maximum quantity of cloud instances with the highest priority from the cloud instances as the target cloud instances.

[0034] An embodiment of the second aspect of the present application provides a sleep mode switching device, including:

[0035] An acquisition module, configured to acquire instance information corresponding to each cloud instance in the first sleep mode at the current scheduling moment, where the instance information is used to indicate the working modes of the cloud instances at different moments before the current scheduling moment;

[0036] A determination module, configured to determine, based on the instance information, a target cloud instance that needs to switch the sleep mode at the current scheduling moment from the cloud instances;

[0037] A switching module, configured to switch the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode; the first sleep mode is one of a deep sleep mode and a light sleep mode, and the second sleep mode is the other one of the deep sleep mode and the light sleep mode except the first sleep mode.

[0038] An embodiment of the third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor runs the computer program to implement the method described in the first aspect above.

[0039] An embodiment of the fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect above.

[0040] The technical solution provided in the embodiments of the present application has at least the following technical effects or advantages:

[0041] In the embodiments of the present application, when the current scheduling moment arrives, based on the instance information of each cloud instance, a target cloud instance that needs to switch the sleep mode at the current scheduling moment is determined, and the sleep mode of the target cloud instance is switched from the first sleep mode to the second sleep mode. It can be seen that in this embodiment, the switching between the light sleep mode and the deep sleep mode of the cloud instance is automatically realized through the instance information of the cloud instance. Compared with the manual switching between the light sleep mode and the deep sleep mode of the cloud instance, the flexibility of the sleep mode switching of the cloud instance is improved.

[0042] The additional aspects and advantages of the present application will be partially given in the following description, partially become obvious from the following description, or be understood through the practice of the present application. Description of the Drawings

[0043] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the following detailed description of the preferred embodiments. The drawings are only for the purpose of illustrating the preferred embodiments and are not considered to be a limitation of the present application. Moreover, throughout the drawings, the same reference numerals are used to represent the same components.

[0044] In the drawings:

[0045] Figure 1 A schematic flowchart of a sleep mode switching method provided by an embodiment of the present application is shown;

[0046] Figure 2 A schematic diagram of a sleep mode switching method provided by an embodiment of the present application is shown;

[0047] Figure 3 A schematic diagram of the scheduling of a sleep and wake-up queue provided by an embodiment of the present application is shown;

[0048] Figure 4 A schematic diagram of the structure of a sleep mode switching device provided by an embodiment of the present application is shown;

[0049] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown;

[0050] Figure 6 A schematic diagram of a storage medium provided by an embodiment of the present application is shown. Detailed Embodiments

[0051] The exemplary embodiments of the present application will be described in more detail below with reference to the drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present application can be more thoroughly understood and the scope of the present application can be completely conveyed to those skilled in the art.

[0052] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in the present application should have the ordinary meaning understood by those skilled in the art to which the present application belongs.

[0053] Cloud computing is a service related to information technology, software, and the Internet. Cloud computing provides application and hardware resources in the cloud to software service providers, enterprise users, or individual users through a transmission protocol. Cloud computing can provide resources for these users in the form of a cloud desktop. By deploying the cloud desktop in the cloud, the client does not need to install applications and uses the cloud desktop through the local client, changing the traditional usage mode of "local installation and local operation" of software to a "ready-to-use" service.

[0054] The cloud instances in the cloud support two hibernation modes: the deep hibernation mode and the light hibernation mode. When a cloud instance is in the deep hibernation mode, the computing resources of the cloud instance are released, which can save the operation cost of the cloud. When a cloud instance is in the light hibernation mode, the computing resources of the cloud instance cannot be released, and the processes corresponding to the cloud instance are suspended. The time taken for a cloud instance to switch from the light hibernation mode to the running mode is stable at the second level, so it will bring a good user experience.

[0055] Currently, based on the user's operation, the cloud instance is switched from the running mode to the light hibernation mode or the deep hibernation mode, or the cloud instance is switched from the light hibernation mode or the deep hibernation mode to the running mode. However, the user's operation cannot achieve the flexible switching of the cloud instance between the light hibernation mode and the deep hibernation mode.

[0056] To alleviate the problem of poor flexibility in switching the cloud instance between the light hibernation mode and the deep hibernation mode in the related art, the embodiment of the present application proposes a hibernation mode switching method, device, and storage medium. The method includes: obtaining instance information corresponding to each cloud instance in the first hibernation mode at the current scheduling moment, where the instance information is used to indicate the working modes of each cloud instance at different moments before the current scheduling moment; determining a target cloud instance that needs to switch the hibernation mode at the current scheduling moment from each cloud instance based on the instance information; and switching the hibernation mode of the target cloud instance from the first hibernation mode to the second hibernation mode. When the current scheduling moment arrives, based on the instance information of each cloud instance, determine a target cloud instance that needs to switch the hibernation mode at the current scheduling moment, and switch the hibernation mode of the target cloud instance from the first hibernation mode to the second hibernation mode. It can be seen that this embodiment automatically realizes the switching of the cloud instance between the light hibernation mode and the deep hibernation mode through the instance information of the cloud instance, improving the flexibility of switching the hibernation mode of the cloud instance compared with manually realizing the switching of the cloud instance between the light hibernation mode and the deep hibernation mode.

[0057] The following describes a hibernation mode switching method, device, and storage medium proposed according to the embodiment of the present application with reference to the accompanying drawings.

[0058] See Figure 1 , this method can be applied to a cloud server, and the method specifically includes the following steps:

[0059] Step 101, obtain instance information corresponding to each cloud instance in the first hibernation mode at the current scheduling moment, where the instance information is used to indicate the working modes of each cloud instance at different moments before the current scheduling moment;

[0060] Step 102, determine a target cloud instance that needs to switch the hibernation mode at the current scheduling moment from each cloud instance based on the instance information;

[0061] Step 103: Switch the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode; the first sleep mode is one of the deep sleep mode and the light sleep mode, and the second sleep mode is the other one of the deep sleep mode and the light sleep mode except the first sleep mode.

[0062] In this embodiment, the working mode includes the running mode and the sleep mode. In the running mode, the processor in the cloud instance calls the resources in the memory for data processing.

[0063] In this embodiment, when the first sleep mode is the light sleep mode and the second sleep mode is the deep sleep mode, the switch of the cloud instance from the light sleep mode to the deep sleep mode is completed. When the first sleep mode is the deep sleep mode and the second sleep mode is the light sleep mode, the pre-wake-up of the cloud instance is completed. The following will elaborate on this case for these two situations respectively.

[0064] First, the sleep mode switching method in this embodiment will be introduced for the case where the first sleep mode is the deep sleep mode and the second sleep mode is the light sleep mode.

[0065] In some embodiments, the instance information includes historical connection data, and the historical connection data is used to indicate the working mode of the cloud instance corresponding to the instance information at different times before the current scheduling moment; based on the instance information, to determine the target cloud instance whose sleep mode needs to be switched at the current scheduling moment from the cloud instances, the following steps may be included:

[0066] Based on the current scheduling moment and the preset time length interval, determine the target time period; the moments included in the target time period are later than the current scheduling moment;

[0067] Determine the historical time period corresponding to the target time period within the preset first historical time;

[0068] Obtain the target connection data in the historical time period from the historical connection data;

[0069] Based on the target connection data, determine the target cloud instance from each cloud instance.

[0070] In this embodiment, the preset time length interval includes multiple time lengths, and the preset time length interval can be artificially configured in advance according to experience or actual needs. For example, the preset time length interval can be configured as (1h, 2h).

[0071] In this embodiment, the target time period can be calculated by summing the current scheduling moment and the preset time length interval. For example, assuming that the preset time length interval is configured as (1h, 2h) and the current scheduling moment is 7 am, then the calculated target time period can be from 8 am to 9 am.

[0072] In this embodiment, in order to make the target cloud instance determined based on the target connection data closer to the user's past usage habits of cloud instances, different preset time length intervals can also be configured for different scheduling times. For example, it is assumed that it is detected that the user often has cloud instance connection behavior from 8 am to 9 am. Therefore, if the scheduling time is 7 am, the preset time length interval can be configured as (1h, 2h). Another example, it is assumed that it is detected that the user often has cloud instance connection behavior from 1:30 pm to 3 pm. Therefore, if the scheduling time is 1 pm, the preset time length interval can be configured as (30min, 2h).

[0073] In this embodiment, the historical time period is the time period with the same time period as the first historical time and the target time period. For example, if the target time period is from 8 am to 9 am in the morning, then the historical time period can be from 8 am to 9 am every day in the past 5 days.

[0074] In this embodiment, in order to facilitate the user's use of cloud instances, cloud instances in the deep sleep mode are usually pre-awakened in advance, and the cloud instances are switched from the deep sleep mode to the light sleep mode. The time taken for the cloud instances to switch from the light sleep mode to the running mode is in seconds. Therefore, pre-awakening the cloud instances in advance can improve the user's experience. Further, in this embodiment, the cloud instances that need to be pre-awakened are predicted through the target connection data in the historical time period. Since the target connection data includes the cloud instances that the user often connects to, the cloud instances that need to be pre-awakened found through the target connection data conform to the user's actual usage habits and can improve the user's experience. Further, the operating cost for the cloud is directly related to the resources running in the cloud instances. Therefore, compared with pre-awakening all cloud instances in the deep sleep mode, the operating cost of the cloud can also be reduced.

[0075] In some embodiments, determining the target cloud instance from each cloud instance based on the target connection data may include the following steps:

[0076] Obtain the target number of cloud instances in the running mode included in the target connection data;

[0077] When the deep sleep rate at the current scheduling time is greater than the preset deep sleep rate threshold, based on the deep sleep rate, the deep sleep rate threshold, the total number of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling time, and the target number, update the first historical time to the second historical time, and return to execute the step of determining the historical time period corresponding to the target time period within the preset first historical time until the deep sleep rate is less than or equal to the deep sleep rate threshold; the second historical time is greater than the first historical time;

[0078] When the deep sleep rate at the current scheduling moment is less than or equal to the deep sleep rate threshold, based on the statistical cloud instances, obtain the target cloud instance, where the statistical cloud instance is a cloud instance that is in the deep sleep mode at the current scheduling moment and in the running mode in the target connection data.

[0079] In this embodiment, the preset deep sleep rate threshold can be set in advance according to actual needs or actual experience, or it can also be the average value of the historically statistically deep sleep rate. This embodiment does not make specific limitations on this. It should be understood that too many cloud instances in the light sleep mode will increase the operating cost of the cloud, while too many cloud instances in the deep sleep mode will lead to a poor user wake-up experience. Therefore, in this embodiment, by setting the deep sleep rate, it is expected that the ratio of the cloud instances in the deep sleep mode and the cloud instances in the light sleep mode in the cloud is in a set ratio.

[0080] In this embodiment, the calculation formula for the deep sleep rate at the current scheduling moment is:

[0081] Deep sleep rate = the number of cloud instances in the deep sleep mode at the current scheduling moment / the total number of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment

[0082] It should be understood that the step of returning and determining the historical time period in this embodiment is executed in a loop, which means returning to execute the step of "determining the historical time period corresponding to the target time period within the preset first historical time" to the step of "determining the target cloud instance from each cloud instance based on the target connection data" in the foregoing embodiment.

[0083] It should be understood that when the deep sleep rate at the current scheduling moment is greater than the preset deep sleep rate threshold, it indicates that there are too many cloud instances in the deep sleep mode at the current scheduling moment. Therefore, the number of pre-awakened cloud instances is increased by updating the first historical time.

[0084] In an alternative embodiment, updating the first historical time to the second historical time based on the deep sleep rate, the deep sleep rate threshold, the total number of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment, and the target number may include the following steps:

[0085] Calculate the first difference between the deep sleep rate and the deep sleep rate threshold;

[0086] Calculate the product of the first difference and the total number;

[0087] Calculate the second difference between the product and the target number;

[0088] Update the first historical time to the second historical time based on the second difference.

[0089] In one example, at the current scheduling moment, there are 80 cloud instances in the deep sleep mode and 20 cloud instances in the light sleep mode. Then, the deep sleep rate at the current scheduling moment is 80%. Assuming that the deep sleep rate threshold is 50%, it means that an additional 80% - 50% = 30% of the cloud instances need to be pre-awakened. Assuming that based on a preset time length interval, the number of cloud instances that can be pre-awakened is determined to be 20, so 30% * (80 + 20) - 20 = 10 more cloud instances should be added for pre-awakening.

[0090] In this embodiment, the second difference is used to affect the number of days included in the second historical time. The second difference is proportional to the second historical time. The larger the second difference, the more days are included in the second historical time. In applications, a mapping relationship between the second difference and the second historical time can be preset, and by querying this mapping relationship, the second historical time can be obtained.

[0091] In this embodiment, updating the first historical time to the second historical time through the second difference helps improve the accuracy of the second historical time, and thus can improve the accuracy of the determined number of cloud instances that need to be pre-awakened.

[0092] In an alternative embodiment, obtaining the target cloud instances based on the statistical cloud instances may include the following steps:

[0093] When the number of statistical cloud instances is less than or equal to the maximum pre-awakening number, the statistical cloud instances are used as the target cloud instances; the maximum pre-awakening number is the number of cloud instances that can be pre-awakened at most at one time;

[0094] When the number of statistical cloud instances is greater than the maximum pre-awakening number, the maximum pre-awakening number of cloud instances with the highest priority is selected from the statistical cloud instances as the target cloud instances.

[0095] It should be understood that the maximum pre-awakening number is used to represent the maximum load capacity of the cloud server, that is, the number of cloud instances that can be pre-awakened simultaneously at most at one time. When the number of statistical cloud instances is less than or equal to this maximum pre-awakening number, it means that the cloud server can pre-awaken the statistical cloud instances at the current scheduling moment. And when the number of statistical cloud instances is greater than this maximum pre-awakening number, it indicates that a pre-awakening storm has occurred at the current scheduling moment. In this case, the cloud server cannot awaken these statistical cloud instances simultaneously.

[0096] In this embodiment, the priority is used to characterize the switching scenario in which a cloud instance switches from the light sleep mode to the deep sleep mode. This switching scenario may include a user instruction switching scenario, an automatic switching scenario, and an operation and maintenance scenario. Among them, the user instruction switching scenario means that the cloud instance is switched from the light sleep to the deep sleep based on the user's deep sleep operation instruction. The automatic switching scenario means that after the cloud instance enters the light sleep mode for a certain period of time, it is automatically switched from the light sleep mode to the deep sleep mode. The operation and maintenance scenario means that the cloud instance in the deep sleep mode is switched to the light sleep mode based on the operation and maintenance operation on the cloud side. Among these three switching scenarios, the priority of the cloud instance related to the operation and maintenance scenario is higher than that of the cloud instance related to the user instruction switching scenario, and the priority of the cloud instance related to the user instruction switching scenario is higher than that of the cloud instance related to the automatic switching scenario.

[0097] It should be understood that the cloud instance with the largest pre-wake-up quantity and the highest priority selected from the statistical cloud instances refers to the cloud instances with the largest pre-wake-up quantity ranked in the front after sorting the cloud instances according to the priority from high to low. In an example, there are three cloud instances A, B, and C, and the priorities of these three cloud instances are A > B > C. Assuming that the largest pre-wake-up quantity is 2, then the two cloud instances with the highest priority selected are A and B.

[0098] It should be understood that when the number of statistical cloud instances is greater than the largest pre-wake-up quantity, other cloud instances except the target cloud instance in the statistical cloud instances continue to be in the deep sleep mode and participate in the sleep switching scheme at the next scheduling moment when the next scheduling moment arrives.

[0099] In this embodiment, in the case of a pre-wake-up storm, the target cloud instance to be pre-woken up is finally selected through the priority, which can greatly reduce the system load on the cloud server caused by the occurrence of the pre-wake-up storm.

[0100] In some alternative embodiments, it further includes:

[0101] Obtain the quantity of each cloud instance;

[0102] When the quantity of each cloud instance is greater than the quantity threshold, shorten the first scheduling period to the second scheduling period, where the first scheduling period is used to calculate the current scheduling moment based on the previous scheduling moment;

[0103] Calculate the next scheduling moment based on the current scheduling moment and the second scheduling period.

[0104] In this embodiment, the second scheduling period can be pre-configured by the user according to actual needs or actual situations. To improve the flexibility of selecting the second scheduling period, the mapping relationship between the quantity difference and the second scheduling period can be pre-configured, so that when it is necessary to shorten the first scheduling period to the second scheduling period, the difference between the quantity of each cloud instance and the quantity threshold is used to query this mapping relationship to obtain the corresponding second scheduling period.

[0105] In this embodiment, when the quantity of each cloud instance at the current scheduling moment is large, shortening the scheduling period can increase the angle frequency, thereby accelerating the scheduling.

[0106] Thus, the introduction of the solution for switching from the deep sleep mode to the light sleep mode is completed.

[0107] It should be understood that the pre-wake-up policy in this embodiment helps to effectively isolate errors when the cloud instances in the underlying deep sleep mode fail, thereby reducing the probability of the user encountering sleep failure.

[0108] The following introduces the sleep switching method in this embodiment for the case where the first sleep mode is the light sleep mode and the second sleep mode is the light sleep mode.

[0109] In some embodiments, the instance information includes the light sleep duration, which is used to characterize the duration of the cloud instance in the light sleep mode; based on the instance information, determining the target cloud instance whose sleep mode needs to be switched at the current scheduling moment from each cloud instance includes:

[0110] Obtaining the quantity of cloud instances in the light sleep mode at the current scheduling moment;

[0111] In the case where the quantity is less than the maximum sleep scheduling quantity, determining the cloud instances with a light sleep duration greater than the preset duration threshold in the instance information as the target cloud instances; in the case where the quantity is greater than or equal to the maximum sleep scheduling quantity, selecting the cloud instances with the highest priority among the maximum sleep scheduling quantity of cloud instances from each cloud instance as the target cloud instances.

[0112] Among them, the maximum sleep scheduling quantity is the quantity of cloud instances that can be switched to the deep sleep mode at most at one time.

[0113] In applications, the preset duration threshold can be set artificially based on experience or according to actual needs, and this embodiment does not make specific limitations on this.

[0114] In this embodiment, selecting the cloud instances with the highest priority among the maximum sleep scheduling quantity of cloud instances from each cloud instance is similar to the process of selecting the cloud instances with the highest priority among the maximum pre-wake-up quantity of cloud instances from the statistical cloud instances in the foregoing embodiment. The specific implementation process can refer to the foregoing embodiment and will not be elaborated here.

[0115] In the solution provided in this embodiment, when the current scheduling moment arrives, based on the instance information of each cloud instance, a target cloud instance that needs to switch the sleep mode at the current scheduling moment is determined, and the sleep mode of the target cloud instance is switched from the first sleep mode to the second sleep mode. It can be seen that in this embodiment, the automatic switching of the cloud instance between the light sleep mode and the deep sleep mode is realized through the instance information of the cloud instance. Compared with the manual switching of the cloud instance between the light sleep mode and the deep sleep mode, the flexibility of the sleep mode switching of the cloud instance is improved.

[0116] For easy understanding, a schematic diagram of the sleep mode switching method as shown in Figure 2 is given, Figure 2 which describes the mutual switching between the running mode (Running), the light sleep mode (Sleeping), and the deep sleep mode (Hibernation).

[0117] Figure 2 It altogether includes the switching of the following six processes:

[0118] Running→Sleeping, Sleeping→Hibernation①, Hibernation→Sleeping, Sleeping→Hibernation②, Sleeping→Running, and Hibernation→Running.

[0119] Among them:

[0120] In the process of Running→Sleeping, the light sleep operation of the user or the timing task set by the user triggers the cloud instance to switch from Running to Sleeping.

[0121] In the process of Sleeping→Hibernation①, if the deep sleep policy (Hibernation Policy) is hit, the cloud instance will be switched from the light sleep mode to the deep sleep mode.

[0122] The deep sleep policy here can be the deep sleep operation of the user or the light sleep duration of the cloud instance entering the light sleep being greater than the preset duration threshold.

[0123] In the process of Hibernation→Sleeping, if the pre-wakeup policy (Pre-wakeup Policy) is hit, the cloud instance will be switched from the deep sleep mode to the light sleep mode.

[0124] The pre-wakeup policy here can specifically be:

[0125] When the scheduling moment T arrives, eligible cloud instances within T+1 to T+2 are selected for pre-wakeup.

[0126] Among them, the pre-wake-up scheme at the current scheduling moment can be as follows:

[0127] Obtain the connection data from T + 1 to T + 2 in the previous n days, obtain the cloud instances in the working mode in the connection data, and then take the intersection of the set composed of the cloud instances in the deep sleep mode at the scheduling moment T and the set composed of the aforementioned cloud instances in the working mode. When the deep sleep rate at the current scheduling moment is less than or equal to the preset deep sleep rate threshold, obtain the number of cloud instances in the intersection. When the number of cloud instances is less than or equal to the maximum pre-wake-up number, use the cloud instances in the intersection as the cloud instances that finally need to be pre-woken up. When the number of cloud instances in the intersection is greater than the maximum pre-wake-up number, select the maximum pre-wake-up number of cloud instances with the highest priority from the intersection, and use the maximum pre-wake-up number of cloud instances with the highest priority as the cloud instances that finally need to be pre-woken up.

[0128] When the deep sleep rate at the current scheduling moment is greater than the preset deep sleep rate threshold, update n to n + c, and then return to execute the pre-wake-up scheme at the current scheduling moment.

[0129] In practical applications, in order to save costs, the execution conditions of the pre-wake-up scheme can also be set. For example, since there are fewer user records at night, it is set not to execute pre-wake-up at night to save costs.

[0130] In the process of Sleeping→Hibernation②, if the deep sleep protection policy (Hibernation Protection Policy) is hit, pre-wake-up protection will be executed, and the cloud instance will be switched from the light sleep mode to the deep sleep mode.

[0131] The deep sleep protection policy here can be understood as:

[0132] At the current scheduling moment, when a storm occurs in the cloud instances in the light sleep mode, that is, the number of cloud instances that need to be switched from the light sleep mode to the deep sleep mode is too large and exceeds the scheduling capacity of the cloud server. In this case, based on the priority of the cloud instances, select the maximum number of sleep-scheduled cloud instances with the highest priority from the cloud instances in the light sleep mode as the cloud instances that finally need to be scheduled.

[0133] Among them, the maximum number of sleep scheduling is used to represent the maximum number of cloud instances that the cloud server can schedule in a single scheduling service.

[0134] During the process of Sleeping→Running, in the case where the scheduling time has not been reached, the user's active wake-up operation triggers the cloud instance to switch from the light sleep mode to the running mode. In the case where the scheduling time has been reached, the light sleep duration of the cloud instance is obtained. Here, the light sleep duration refers to the duration that the cloud instance has maintained in the light sleep mode after switching from the deep sleep mode to the light sleep mode. When the light sleep duration reaches the preset duration threshold, the cloud instance is switched from the light sleep mode to the running mode.

[0135] During the process of Hibernation→Running, the user's active wake-up operation triggers the cloud instance to switch from the deep sleep mode to the running mode. It should be understood that in this case, waking up the cloud instance will consume a relatively long time.

[0136] In this embodiment, a scheduling system is deployed on the cloud server. The scheduling system includes a sleep scheduler, a wake-up scheduler, a timer, and a sleep and wake-up queue. Among them, the sleep scheduler processes the decision-making and control for switching from the light sleep mode to the deep sleep mode, the wake-up scheduler processes the decision-making and control for pre-waking up, the timer can be set dynamically, and the timer determines the scheduling period between two adjacent scheduling times. The sleep and wake-up queue are two priority queues with the same settings but different names. All candidate instances can be enqueued and dequeued, and the next operation is carried out according to the different priority settings of each cloud instance. At the same time, the priority setting can also help judge user operations and system scheduling operations, so as to ensure user priority.

[0137] The sleep and wake-up queues are respectively two blocking queues with limited sizes. The queues store the cloud instances that met the conditions during the previous scheduling but did not perform scheduling due to load problems. Every time a scheduling period passes, the scheduling system will pull cloud instances from the queues and detect again whether the current time meets the execution conditions. When the execution conditions are met, scheduling is initiated. The sleep and wake-up queues are set with a maximum value. If the maximum value is exceeded, they will be directly discarded. In this way, the discarded cloud instances will stay in the light sleep stage. It should be understood that the load problem here refers to the maximum number of cloud instances that the scheduling system can schedule at one time. In the scenario of switching from the deep sleep mode to the light sleep mode, the cloud instances that met the conditions during the previous scheduling but did not perform scheduling due to load problems refer to the other cloud instances that met the conditions during the previous scheduling but exceeded the maximum scheduling capacity of the scheduling system. For example, if there were 100 cloud instances that met the conditions during the previous scheduling, but the scheduling system can only schedule 80 cloud instances at a time, then the remaining 20 cloud instances are the cloud instances that met the conditions during the previous scheduling but did not perform scheduling due to load problems.

[0138] As an example, a scheduling schematic diagram of the sleep and wake-up queues as shown in Figure 3 is given. In Figure 3Among them, each cloud instance in the deep sleep queue stores in the deep sleep mode, and each cloud instance in the wake-up queue stores in the light sleep mode. The sleep scheduler can find the cloud instances that need to be switched to the deep sleep mode from the wake-up queue based on the priority, and then switch the sleep modes of these cloud instances to the deep sleep mode based on a preset decision, and store these cloud instances in the deep sleep queue. The wake-up scheduler can find the cloud instances that need to be switched to the light sleep mode from the deep sleep queue based on the priority, and then switch the sleep modes of these cloud instances to the light sleep mode based on a preset decision, and store these cloud instances in the wake-up queue.

[0139] An embodiment of the present application also provides a sleep mode switching device, which is used to execute the sleep mode switching method provided in any of the above embodiments. As Figure 4 shown, the device includes:

[0140] An obtaining module 41, configured to obtain instance information corresponding to each cloud instance in the first sleep mode at the current scheduling moment, where the instance information is used to indicate the working modes of each cloud instance at different moments before the current scheduling moment;

[0141] A determining module 42, configured to determine a target cloud instance that needs to switch the sleep mode at the current scheduling moment from the cloud instances based on the instance information;

[0142] A switching module 43, configured to switch the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode; the first sleep mode is one of the deep sleep mode and the light sleep mode, and the second sleep mode is the other one of the deep sleep mode and the light sleep mode except the first sleep mode.

[0143] In some embodiments, the first sleep mode is the deep sleep mode, and the second sleep mode is the light sleep mode; the instance information includes historical connection data, and the historical connection data is used to indicate the working modes of the cloud instance corresponding to the instance information at different moments before the current scheduling moment; the determining module 42 is configured to:

[0144] Determine a target time period based on the current scheduling moment and a preset time length interval; the target time period includes moments later than the current scheduling moment;

[0145] Determine a historical time period corresponding to the target time period within a preset first historical time;

[0146] Obtain target connection data in the historical time period from the historical connection data included in each instance information;

[0147] Determine the target cloud instance from the cloud instances based on the target connection data.

[0148] In some embodiments, the determining module 42 is configured to:

[0149] Obtain the target number of cloud instances in the running mode included in the target connection data;

[0150] When the deep sleep rate at the current scheduling moment is greater than a preset deep sleep rate threshold, update the first historical time to the second historical time based on the deep sleep rate, the deep sleep rate threshold, the total number of cloud instances in the deep sleep mode and the shallow sleep mode at the current scheduling moment, and the target number, and return to execute the step of determining the historical time period corresponding to the target time period within the preset first historical time until the deep sleep rate is less than or equal to the deep sleep rate threshold; the second historical time is greater than the first historical time;

[0151] When the deep sleep rate at the current scheduling moment is less than or equal to the deep sleep rate threshold, obtain the target cloud instances based on the statistical cloud instances, where the statistical cloud instances are cloud instances that are in the deep sleep mode at the current scheduling moment and are in the running mode in the target connection data.

[0152] In some embodiments, the determining module 42 is configured to:

[0153] Calculate a first difference between the deep sleep rate and the deep sleep rate threshold;

[0154] Calculate the product of the first difference and the total number;

[0155] Calculate a second difference between the product and the target number;

[0156] Update the first historical time to the second historical time based on the second difference.

[0157] In some embodiments, the determining module 42 is configured to:

[0158] When the number of the statistical cloud instances is less than or equal to the maximum pre-awakening number, use the statistical cloud instances as the target cloud instances; the maximum pre-awakening number is the number of cloud instances that can be pre-awakened at most at one time;

[0159] When the number of the statistical cloud instances is greater than the maximum pre-awakening number, select the maximum pre-awakening number of cloud instances with the highest priority from the statistical cloud instances as the target cloud instances.

[0160] In some embodiments, the apparatus is further configured to:

[0161] Obtain the number of each cloud instance;

[0162] When the number of each of the cloud instances is greater than a number threshold, shorten a first scheduling period to a second scheduling period, where the first scheduling period is used to calculate a current scheduling moment based on a previous scheduling moment;

[0163] Calculate a next scheduling moment based on the current scheduling moment and the second scheduling period.

[0164] In some embodiments, the first sleep mode is a light sleep mode, and the second sleep mode is a deep sleep mode; the instance information includes a light sleep duration, and the light sleep duration is used to represent the duration for which a cloud instance is in the light sleep mode; the determining module 42 is configured to:

[0165] Obtain the number of cloud instances in the light sleep mode at the current scheduling moment;

[0166] When the number is less than a maximum number for sleep scheduling, determine a cloud instance whose light sleep duration included in the instance information is greater than a preset duration threshold as the target cloud instance;

[0167] When the number is greater than or equal to the maximum number for sleep scheduling, select the maximum number of cloud instances with the highest priority from the cloud instances as the target cloud instances.

[0168] The sleep mode switching device provided by an embodiment of the present application and the sleep mode switching method provided by an embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run, or implemented by it.

[0169] The embodiments of the present application further provide an electronic device to execute the above sleep mode switching method. Please refer to Figure 5 It shows a schematic diagram of an electronic device provided by some embodiments of the present application. As Figure 5 shown, the electronic device 5 includes: a processor 500, a memory 501, a bus 502, and a communication interface 503, and the processor 500, the communication interface 503, and the memory 501 are connected through the bus 502; a computer program that can run on the processor 500 is stored in the memory 501, and when the processor 500 runs the computer program, it executes the sleep mode switching method provided by any one of the foregoing embodiments of the present application.

[0170] Among them, the memory 501 may include high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory. The communication connection between the device network element and at least one other network element is realized through at least one communication interface 503 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.

[0171] The bus 502 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. Among them, the memory 501 is used to store programs. After receiving an execution instruction, the processor 500 executes the program. The sleep mode switching method disclosed in any implementation manner of the foregoing embodiments of the present application can be applied to the processor 500 or implemented by the processor 500.

[0172] The processor 500 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 500 or by instructions in software form. The above-mentioned processor 500 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 501, and the processor 500 reads the information in the memory 501 and combines its hardware to complete the steps of the above method.

[0173] The electronic device provided by the embodiment of the present application and the sleep mode switching method provided by the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run, or implemented by it.

[0174] The embodiment of the present application also provides a computer-readable storage medium corresponding to the sleep mode switching method provided in the foregoing embodiment. Please refer toFigure 6 , which shows that the computer-readable storage medium is an optical disc 30, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it will execute the sleep mode switching method provided by any of the foregoing embodiments.

[0175] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other optical or magnetic storage media, which will not be elaborated here one by one.

[0176] The computer-readable storage medium provided by the above embodiments of the present application and the sleep mode switching method provided by the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run, or implemented by the application programs stored therein.

[0177] It should be noted that:

[0178] In the specification provided herein, a large number of specific details are described. However, it can be understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail so as not to obscure the understanding of this specification.

[0179] Similarly, it should be understood that, in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting the following schematic: that the claimed present application requires more features than those expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all the features of the single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into the detailed description, where each claim itself serves as a separate embodiment of the present application.

[0180] In addition, those skilled in the art can understand that, although some of the embodiments described herein include certain features included in other embodiments rather than other features, the combination of the features of different embodiments means that it is within the scope of the present application and forms different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.

[0181] As described above, it is only the preferred specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims described above.

Claims

1. A method for switching between sleep modes, characterized in that, Including: Obtain instance information corresponding to each cloud instance in the first sleep mode at the current scheduling moment, where the instance information is used to indicate the working modes of each cloud instance at different moments before the current scheduling moment; Based on the instance information, determine a target cloud instance whose sleep mode needs to be switched at the current scheduling moment from the cloud instances; Switch the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode; the first sleep mode is one of the deep sleep mode and the light sleep mode, and the second sleep mode is the other one of the deep sleep mode and the light sleep mode except the first sleep mode.

2. The method according to claim 1, wherein The first sleep mode is the deep sleep mode, and the second sleep mode is the light sleep mode; the instance information includes historical connection data, and the historical connection data is used to indicate the working modes of the cloud instance corresponding to the instance information at different moments before the current scheduling moment. Based on the instance information, determining a target cloud instance whose sleep mode needs to be switched at the current scheduling moment from the cloud instances includes: Based on the current scheduling moment and a preset time length interval, determine a target time period; the moments included in the target time period are later than the current scheduling moment; Determine a historical time period corresponding to the target time period within a preset first historical time; Obtain target connection data in the historical time period from the historical connection data; Based on the target connection data, determine the target cloud instance from the cloud instances.

3. The method according to claim 2, wherein Based on the target connection data, determining the target cloud instance from the cloud instances includes: Obtain the target quantity of cloud instances in the running mode included in the target connection data; When the deep sleep rate at the current scheduling moment is greater than a preset deep sleep rate threshold, based on the deep sleep rate, the deep sleep rate threshold, the total quantity of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment, and the target quantity, update the first historical time to a second historical time, and return to execute the step of determining the historical time period corresponding to the target time period within the preset first historical time until the deep sleep rate is less than or equal to the deep sleep rate threshold; the second historical time is greater than the first historical time; When the deep sleep rate at the current scheduling moment is less than or equal to the deep sleep rate threshold, obtain the target cloud instance based on statistical cloud instances, where the statistical cloud instances are cloud instances in the deep sleep mode at the current scheduling moment and in the running mode in the target connection data.

4. The method according to claim 3, wherein Based on the deep sleep rate, the deep sleep rate threshold, the total quantity of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment, and the target quantity, updating the first historical time to a second historical time includes: Calculate a first difference between the deep sleep rate and the deep sleep rate threshold; Calculate the product of the first difference and the total quantity; Calculate a second difference between the product and the target quantity; Update the first historical time to the second historical time based on the second difference.

5. The method according to claim 3, characterized in that Obtain the target cloud instance based on the statistical cloud instances, including: When the number of the statistical cloud instances is less than or equal to the maximum pre-awakening number, use the statistical cloud instances as the target cloud instances; the maximum pre-awakening number is the number of cloud instances that can be pre-awakened at most at one time; When the number of the statistical cloud instances is greater than the maximum pre-awakening number, select the maximum pre-awakening number of cloud instances with the highest priority from the statistical cloud instances as the target cloud instances.

6. The method according to any one of claims 1 to 5, characterized in that Further include: Obtain the number of each cloud instance; When the number of each cloud instance is greater than the number threshold, shorten the first scheduling period to the second scheduling period, and the first scheduling period is used to calculate the current scheduling moment based on the previous scheduling moment; Calculate the next scheduling moment based on the current scheduling moment and the second scheduling period.

7. The method according to claim 1, wherein The first sleep mode is the light sleep mode, and the second sleep mode is the deep sleep mode; the instance information includes the light sleep duration, and the light sleep duration is used to represent the duration of the cloud instance in the light sleep mode; Based on the instance information, determine the target cloud instance that needs to switch the sleep mode at the current scheduling moment from each cloud instance, including: Obtain the number of cloud instances in the light sleep mode at the current scheduling moment; When the number is less than the maximum sleep scheduling number, determine the cloud instance with the light sleep duration greater than the preset duration threshold in the instance information as the target cloud instance; When the number is greater than or equal to the maximum sleep scheduling number, select the maximum sleep scheduling number of cloud instances with the highest priority from each cloud instance as the target cloud instance.

8. A sleep mode switching device, characterized in that, Include: An acquisition module, configured to acquire the instance information corresponding to each cloud instance in the first sleep mode at the current scheduling moment, and the instance information is used to indicate the working modes of each cloud instance at different moments before the current scheduling moment; A determination module, configured to determine the target cloud instance that needs to switch the sleep mode at the current scheduling moment from each cloud instance based on the instance information; A switching module, configured to switch the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode; the first sleep mode is one of the deep sleep mode and the light sleep mode, and the second sleep mode is the other one of the deep sleep mode and the light sleep mode except the first sleep mode.

9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor runs the computer program to implement the method according to any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the method according to any one of claims 1-7.

Citation Information

Cited By

  • Electronic equipment, control method thereof and storage medium

    CN120812711A