Hibernation mode switching method, and device and storage medium
By obtaining cloud instance information, it solves the problem that users cannot flexibly switch between shallow sleep mode and deep sleep mode of cloud instances, and realizes more flexible mode switching, optimizes cloud resource management and reduces operating costs.
Patent Information
- Application Number
- PCT/IB2025/050390
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-18
- Filing Date
- 2025-01-14
- Publication Date
- 2025-07-24
AI Technical Summary
In the prior art, users cannot flexibly switch cloud instances between shallow sleep mode and deep sleep mode, resulting in poor switching inflexibility.
By obtaining the cloud instance information in the first sleep mode at the current scheduling moment, the target cloud instance that needs to switch the sleep mode is determined, and switched from the first sleep mode to the second sleep mode, the switching between the shallow sleep mode and the deep sleep mode is automatically achieved using the instance information.
Improves the flexibility of switching between shallow sleep mode and deep sleep mode for cloud instances, optimizes cloud resource management, reduces operational costs and improves user experience.
Smart Images

Figure IB2025050390_24072025_PF_FP_ABST
Abstract
Description
[0001] Technical Field: The present disclosure belongs to the field of computer technology and specifically relates to a method, device, and storage medium for switching dormancy modes. Background: Cloud instances in the cloud support two dormancy modes: deep hibernation mode and shallow hibernation mode. When a cloud instance is in deep hibernation mode, its computing resources are released, which can save cloud operating costs. When a cloud instance is in shallow hibernation mode, its computing resources cannot be released, and the corresponding processes of the cloud instance are suspended. The time required to switch a cloud instance from shallow hibernation mode to running mode is stable at the second level, providing a good user experience. Currently, cloud instances are switched from running mode to shallow hibernation or deep hibernation mode, or from shallow hibernation or deep hibernation mode to running mode, based on user operations. However, user operations cannot flexibly switch cloud instances between shallow hibernation mode and deep hibernation mode. SUMMARY: The present disclosure provides a method, device, and storage medium for switching dormancy modes, which can alleviate the technical problem in related technologies where user operations cannot flexibly switch cloud instances between shallow hibernation mode and deep hibernation mode. An embodiment of the first aspect of the present disclosure proposes a sleep mode switching method, including: obtaining instance information corresponding to each cloud instance that is in a first sleep mode at a current scheduling moment, the instance information being used to indicate the working mode of each cloud instance at different moments before the current scheduling moment; determining, from the cloud instances, a target cloud instance to be switched to sleep mode at the current scheduling moment based on the instance information; switching the sleep mode of the target cloud instance from the first sleep mode to a second sleep mode; the first sleep mode is one of a deep sleep mode and a shallow sleep mode, and the second sleep mode is the other of the deep sleep mode and the shallow sleep mode except the first sleep mode. An embodiment of the second aspect of the present disclosure proposes a sleep mode switching device, including: an acquisition module, used to obtain instance information corresponding to each cloud instance that is in a first sleep mode at a current scheduling moment, the instance information being used to indicate the working mode of each cloud instance at different moments before the current scheduling moment; a determination module, used to determine, from the cloud instances, a target cloud instance that needs to switch to sleep mode at the current scheduling moment based on the instance information; a switching module, used to switch the sleep mode of the target cloud instance from the first sleep mode to a second sleep mode; the first sleep mode is one of a deep sleep mode and a shallow sleep mode, and the second sleep mode is the other of the deep sleep mode and the shallow sleep mode except the first sleep mode.An embodiment of the third aspect of the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect. An embodiment of the fourth aspect of the present disclosure provides a computer-readable storage medium storing a computer program, wherein the program is executed by the processor to implement the method described in the first aspect. The technical solutions provided in the embodiments of the present disclosure have at least the following technical effects or advantages: In the embodiments of the present disclosure, when a current scheduling time arrives, based on instance information of each cloud instance, a target cloud instance to be switched to sleep mode at the current scheduling time is determined, and the sleep mode of the target cloud instance is switched from a first sleep mode to a second sleep mode. Thus, this embodiment automatically switches a cloud instance between light sleep mode and deep sleep mode using the instance information of the cloud instance. Compared to manually switching a cloud instance between light sleep mode and deep sleep mode, this embodiment improves the flexibility of cloud instance sleep mode switching. Additional aspects and advantages of the present disclosure will be partially described in the following description, and partially will become apparent from the following description or be understood through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiments below. The drawings are provided for illustration purposes only and are not intended to limit the present disclosure. Like reference symbols denote like components throughout the drawings. In the drawings: FIG1 illustrates a flowchart of a sleep mode switching method according to an embodiment of the present disclosure; FIG2 illustrates a schematic diagram of the sleep mode switching method according to an embodiment of the present disclosure; FIG3 illustrates a schematic diagram of the scheduling of sleep and wake-up queues according to an embodiment of the present disclosure; FIG4 illustrates a schematic diagram of the structure of a sleep mode switching apparatus according to an embodiment of the present disclosure; FIG5 illustrates a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure; and FIG6 illustrates a schematic diagram of a storage medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to facilitate a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art. It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this disclosure should have the common meanings understood by those skilled in the art to which this disclosure belongs.Cloud computing is a service related to information technology, software, and the internet. Cloud computing uses transmission protocols to deliver cloud applications and hardware resources to software service providers, enterprises, and individual users. Cloud computing can provide these users with resources in the form of cloud desktops. By deploying cloud desktops in the cloud, clients no longer need to install applications; they can access them through local clients, transforming the traditional "local installation, local computing" model of software into a "ready-to-use" service. Cloud instances in the cloud support two hibernation modes: deep hibernation and shallow hibernation. When a cloud instance is in deep hibernation mode, its computing resources are released, saving cloud operating costs. In shallow hibernation mode, its computing resources remain in place, and the corresponding processes are suspended. The time it takes for a cloud instance to switch from shallow hibernation to running mode is consistently in seconds, providing a superior user experience. Currently, cloud instances are switched from running mode to shallow hibernation or deep hibernation, or vice versa, based on user actions. However, user operations cannot flexibly switch cloud instances between shallow sleep mode and deep sleep mode. To alleviate the problem of poor flexibility in switching cloud instances between shallow sleep mode and deep sleep mode in related technologies, embodiments of the present disclosure provide a sleep mode switching method, device, and storage medium. The method includes: obtaining instance information corresponding to each cloud instance in a first sleep mode at the current scheduling time; determining, based on the instance information, a target cloud instance to be switched to sleep mode at the current scheduling time from each cloud instance; and switching the sleep mode of the target cloud instance from the first sleep mode to the second sleep mode. When the current scheduling time arrives, the target cloud instance to be switched to sleep mode at the current scheduling time is determined based on the instance information of each cloud instance, and the sleep mode of the target cloud instance is switched from the first sleep mode to the second sleep mode. As can be seen, this embodiment automatically switches cloud instances between shallow sleep mode and deep sleep mode using the instance information of the cloud instances. Compared to manually switching cloud instances between shallow sleep mode and deep sleep mode, this embodiment improves the flexibility of cloud instance sleep mode switching. The sleep mode switching method, device, and storage medium proposed according to embodiments of the present disclosure are described below with reference to the accompanying drawings.Referring to Figure 1 , this method can be applied to a cloud server and specifically includes the following steps: Step 101: Obtain instance information corresponding to each cloud instance in a first sleep mode at the current scheduling time. The instance information indicates the operating mode of each cloud instance at different times before the current scheduling time. Step 102: Based on the instance information, determine, from each cloud instance, the target cloud instance to be switched to sleep mode at the current scheduling time. 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 a deep sleep mode and a shallow sleep mode, and the second sleep mode is the other of the deep sleep mode and the shallow sleep mode other than the first sleep mode. In this embodiment, the operating mode includes a running mode and a sleep mode. In the running mode, the processor in the cloud instance uses memory resources to process data. In this embodiment, when the first sleep mode is the shallow sleep mode and the second sleep mode is the deep sleep mode, the cloud instance is switched from the shallow sleep mode to the deep sleep mode. When the first sleep mode is the deep sleep mode and the second sleep mode is the shallow sleep mode, the cloud instance is pre-wake up. The following describes this method for these two scenarios. First, the sleep switching method of this embodiment is described, with the first sleep mode being a deep sleep mode and the second sleep mode being a shallow sleep mode. In some embodiments, instance information includes historical connection data, which indicates the operating mode of the cloud instance corresponding to the instance information at different times before the current scheduling time. Based on the instance information, determining the target cloud instance from the cloud instances to switch to sleep mode at the current scheduling time may include the following steps: determining a target time period based on the current scheduling time and a preset time interval; the target time period includes times later than the current scheduling time; determining a historical time period corresponding to the target time period within a preset first historical time period; obtaining target connection data within the historical time period from the historical connection data; and determining the target cloud instance from each cloud instance based on the target connection data. In this embodiment, the preset time interval includes multiple time lengths. The preset time interval can be pre-configured based on experience or actual needs. For example, the preset time interval can be configured as (1 hour, 2 hours). In this embodiment, the target time period can be calculated by summing the current scheduling time and the preset time interval. For example, assuming that the preset time length interval is configured as (1h, 2h), and the current scheduling time is 7:00 am, the calculated target time period can be 8:00 am to 9:00 am.In this embodiment, to ensure that the target cloud instance determined based on the target connection data more closely matches the user's past cloud instance usage habits, different preset time intervals can be pre-configured for different scheduling times. For example, if it is detected that the user frequently connects to the cloud instance between 8:00 AM and 9:00 AM, then if the scheduling time is 7:00 AM, the preset time interval can be configured as (1 hour, 2 hours). For another example, if it is detected that the user frequently connects to the cloud instance between 1:30 PM and 3:00 PM, then if the scheduling time is 1:00 PM, the preset time interval can be configured as (30 minutes, 2 hours). In this embodiment, the historical time period is the same time period as the target time period. For example, if the target time period is 8:00 AM to 9:00 AM, then the historical time period can be 8:00 AM to 9:00 AM every day for the past five days. In this embodiment, to facilitate user access to cloud instances, cloud instances in deep sleep mode are typically pre-awakened, switching them from deep sleep mode to light sleep mode. Since the transition from light sleep mode to running mode takes seconds, pre-awakening cloud instances can improve the user experience. Furthermore, this embodiment predicts cloud instances that require pre-awakening based on target connection data from a historical time period. Since this target connection data includes cloud instances that users frequently connect to, the cloud instances identified based on this data are consistent with users' actual usage habits, improving the user experience. Furthermore, the operating costs of the cloud instance are directly related to the resources running in the cloud instance. Therefore, compared to pre-awakening all cloud instances in deep sleep mode, this can also reduce cloud operating costs. In some embodiments, determining a target cloud instance from each cloud instance based on the target connection data may include the following steps: obtaining a target number of cloud instances in 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, 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 deep sleep mode and shallow sleep mode at the current scheduling moment, and the target number, and returning to execute the step of determining a 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; and when the deep sleep rate at the current scheduling moment is less than or equal to the deep sleep rate threshold, obtaining the target cloud instance based on the statistical cloud instance, where the statistical cloud instance is the cloud instance that is in deep sleep mode at the current scheduling moment and is in running mode in the target connection data.In this embodiment, the preset deep sleep rate threshold can be pre-set based on actual needs or practical experience, or can be the average of historically statistical deep sleep rates, which is not specifically limited in this embodiment. It should be understood that an excessive number of cloud instances in shallow sleep mode will increase cloud operating costs, while an excessive number of cloud instances in deep sleep mode will result in poor user wake-up performance. Therefore, this embodiment sets the deep sleep rate to achieve a predetermined ratio between cloud instances in deep sleep mode and cloud instances in shallow sleep mode. In this embodiment, the formula for calculating the deep sleep rate at the current scheduling time is: Deep sleep rate = Number of cloud instances in deep sleep mode at the current scheduling time / Total number of cloud instances in deep sleep mode and shallow sleep mode at the current scheduling time. It should be understood that the step of returning to determine the historical time period in this embodiment is a loop execution, which refers to returning to the steps of "determining a historical time period corresponding to the target time period within the preset first historical time period" to "determining a target cloud instance from each cloud instance based on the target connection data" in the aforementioned embodiment. It should be understood that a deep sleep rate at the current scheduling time exceeding a preset deep sleep rate threshold indicates that too many cloud instances are in deep sleep mode at the current scheduling time. Therefore, the number of pre-awakened cloud instances is increased by updating the first historical time. In an optional embodiment, 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 deep sleep mode and light sleep mode at the current scheduling time, and the target number may include the following steps: calculating a first difference between the deep sleep rate and the deep sleep rate threshold; calculating the product of the first difference and the total number; calculating a second difference between the product and the target number; and updating the first historical time to the second historical time based on the second difference. In an example, if there are 80 cloud instances in deep sleep mode and 20 cloud instances in light sleep mode at the current scheduling time, the deep sleep rate at the current scheduling time is 80%. Assuming the deep sleep rate threshold is 50%, this means that 80% - 50% = 30% of cloud instances are pre-awakened. Assume that the number of cloud instances that can be pre-awakened based on a preset time interval is 20. Therefore, 30% * (80 + 20) - 20 = 10 additional cloud instances should be pre-awakened. In this embodiment, the second difference affects 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 included in the second historical time. In an application, a mapping relationship between the second difference and the second historical time can be preset. By querying this mapping relationship, the second historical time can be obtained.In this embodiment, updating the first historical time with the second historical time using the second difference helps improve the accuracy of the second historical time, thereby improving the accuracy of the number of cloud instances determined to require pre-awakening. In an optional embodiment, obtaining a target cloud instance based on the statistical cloud instances may include the following steps: if the number of statistical cloud instances is less than or equal to the maximum pre-awakening number, selecting the statistical cloud instance as the target cloud instance; the maximum pre-awakening number is the maximum number of cloud instances that can be pre-awakened at one time; if the number of statistical cloud instances is greater than the maximum pre-awakening number, selecting the cloud instance with the highest priority and the maximum pre-awakening number from the statistical cloud instances as the target cloud instance. It should be understood that the maximum pre-awakening number represents the maximum load capacity of the cloud server, that is, the maximum number of cloud instances that can be pre-awakened simultaneously in one pre-awakening. If the number of statistical cloud instances is less than or equal to the maximum pre-awakening number, it indicates that the cloud server can pre-awaken the statistical cloud instances simultaneously at the current scheduling time. If the number of statistical cloud instances is less than or equal to the maximum pre-awakening number, it indicates that a pre-awakening storm has occurred at the current scheduling time, in which case the cloud server cannot simultaneously wake up the statistical cloud instances. In this embodiment, priority is used to characterize the switching scenario for a cloud instance from shallow sleep mode to deep sleep mode. These switching scenarios can include user-instructed switching scenarios, automatic switching scenarios, and operation and maintenance scenarios. The user-instructed switching scenario involves switching a cloud instance from shallow sleep to deep sleep mode based on a user's deep sleep operation instruction. The automatic switching scenario involves automatically switching a cloud instance from shallow sleep mode to deep sleep mode after entering shallow sleep mode for a certain period of time. The operation and maintenance scenario involves switching a cloud instance in deep sleep mode back to shallow sleep mode based on a cloud-based operation and maintenance operation. Among these three switching scenarios, cloud instances associated with the operation and maintenance scenario have a higher priority than cloud instances associated with the user-instructed switching scenario. Cloud instances associated with the user-instructed switching scenario have a lower priority than cloud instances associated with the automatic switching scenario. It should be understood that the cloud instance with the highest priority and the largest number of pre-wake-up times selected from the statistical cloud instances refers to the cloud instance with the highest number of pre-wake-up times selected after sorting the cloud instances from highest priority to lowest priority. In an example, there are three cloud instances A, B, and C. The priorities of these three cloud instances are A>B>C. Assuming that the maximum pre-wake-up number is 2, the two cloud instances with the highest priority are A and Bo. It should be understood that when the number of statistical cloud instances is greater than the maximum pre-wake-up number, the other cloud instances in the statistical cloud instances except the target cloud instance continue to be in deep sleep mode and participate in the sleep switching plan of the next scheduling moment when the next scheduling moment arrives.In this embodiment, in the event of a pre-wake-up storm, the target cloud instance to be pre-wake-up is ultimately selected based on priority, significantly reducing the system load on the cloud server caused by the pre-wake-up storm. In some optional embodiments, the method further includes: obtaining the number of cloud instances; if the number of cloud instances exceeds a threshold, shortening the first scheduling period to a second scheduling period, where the first scheduling period is used to calculate the current scheduling time based on the previous scheduling time; and calculating the next scheduling time based on the current scheduling time and the second scheduling period. In this embodiment, the second scheduling period can be pre-configured by the user based on actual needs or practical circumstances. To increase flexibility in selecting the second scheduling period, a mapping relationship between the number difference and the second scheduling period can be pre-configured. When shortening the first scheduling period to the second scheduling period, the difference between the number of cloud instances and the threshold is used to query the mapping relationship and obtain the corresponding second scheduling period. In this embodiment, when the number of cloud instances at the current scheduling time is large, shortening the scheduling period can increase the frequency of angle changes, thereby accelerating scheduling. This completes the introduction to the solution for switching from deep sleep mode to shallow sleep mode. It should be understood that the pre-wake-up strategy in this embodiment helps effectively isolate errors when an underlying deep sleep cloud instance fails, thereby reducing the chance of users encountering sleep failures. The sleep switching method in this embodiment is described below, assuming the first sleep mode is a shallow sleep mode and the second sleep mode is a shallow sleep mode. In some embodiments, instance information includes a shallow sleep duration, which indicates the duration of time the cloud instance is in shallow sleep mode. Based on the instance information, determining the target cloud instance to be switched to sleep mode at the current scheduling time from each cloud instance includes: obtaining the number of cloud instances in shallow sleep mode at the current scheduling time; if the number is less than the maximum sleep scheduling number, determining the cloud instance whose shallow sleep duration, as included in the instance information, exceeds a preset duration threshold as the target cloud instance; if the number is greater than or equal to the maximum sleep scheduling number, selecting the cloud instance with the highest priority and the maximum sleep scheduling number from each cloud instance as the target cloud instance. The maximum sleep scheduling number is the maximum number of cloud instances that can be switched to deep sleep mode at one time. In applications, the preset duration threshold can be manually set based on experience or actual needs, and this embodiment does not specifically limit this. In this embodiment, the cloud instance with the highest priority and the largest number of sleep scheduling is selected from each cloud instance. This is similar to the process of selecting the cloud instance with the highest priority and the largest number of pre-wake-up times from the statistical cloud instance in the aforementioned embodiment. The specific implementation process can be found in the aforementioned embodiment and will not be described in detail here.In the solution provided by this embodiment, when the current scheduling time arrives, based on the instance information of each cloud instance, the target cloud instance to be switched to sleep mode at the current scheduling time is determined, and the sleep mode of the target cloud instance is switched from the first sleep mode to the second sleep mode. As can be seen, this embodiment automatically switches cloud instances between shallow sleep mode and deep sleep mode using the instance information of the cloud instances. Compared to manually switching cloud instances between shallow sleep mode and deep sleep mode, this improves the flexibility of cloud instance sleep mode switching. For easier understanding, a schematic diagram of the sleep mode switching method is provided as shown in Figure 2. Figure 2 illustrates the switching between the running mode (Running), shallow sleep mode (Sleeping), and deep sleep mode (Hibernation). Figure 2 includes the following six switching processes:
[0002] Runnings Sleeping, Sleeping-Hibernation ①, Hibernation^- Sleeping > Sleeping f Hibernation ②, Sleeping-Running, and Hibernation-Running. In the Runnings Sleeping process, the user's shallow sleep operation or the scheduled task set by the user triggers the cloud instance to switch from Running to Sleeping. o
[0003] During the Sleeping* Hibernation ① process, if a deep hibernation policy is met, the cloud instance will be switched from light hibernation mode to deep hibernation mode. The deep hibernation policy can be a user's deep hibernation operation or the cloud instance entering light hibernation for a duration exceeding a preset threshold.
[0004] During the Hibernation-Sleeping process, if a pre-wakeup policy is met, the cloud instance will be switched from deep sleep mode to shallow sleep mode. Specifically, the pre-wakeup policy may be: when scheduling time T arrives, cloud instances that meet the conditions within T+1-T+2 are selected for pre-wakeup. The pre-wakeup solution at the current scheduling time may be: connection data from the previous n days (T+1-T+2) is obtained, cloud instances in working mode are obtained from this connection data, and then the set of cloud instances in deep sleep mode at scheduling time T is intersected with the set of cloud instances in working mode. If the deep sleep rate at the current scheduling time is less than or equal to a preset deep sleep rate threshold, the number of cloud instances in the intersection is obtained. If the number of cloud instances is less than or equal to the maximum pre-wakeup number, the cloud instances in the intersection are selected as the final cloud instances to be pre-wakeup. If the number of cloud instances in the intersection is greater than the maximum pre-wakeup number, the cloud instance with the highest priority and the maximum pre-wakeup number is selected from the intersection and selected as the final cloud instance to be pre-wakeup. If the deep sleep rate at the current scheduling time exceeds the preset deep sleep rate threshold, n is updated to n + c, and the pre-wake-up plan for the current scheduling time is executed again. In actual applications, to save costs, the execution conditions of the pre-wake-up plan can also be set. For example, since there are fewer user records at night, pre-wake-up can be set to save costs.
[0005] During the Sleeping* Hibernation ② process, if the deep hibernation protection policy is met, pre-wakeup protection will be implemented, switching the cloud instance from shallow hibernation mode to deep hibernation mode. The deep hibernation protection policy can be understood as follows: at the current scheduling moment, if a storm occurs among cloud instances in shallow hibernation mode, meaning that the number of cloud instances in shallow hibernation mode that need to be switched to deep hibernation mode exceeds the cloud server's scheduling capacity, the cloud instance with the highest priority and the maximum number of hibernation schedulings will be selected from the shallow hibernation cloud instances based on their priority as the final cloud instance to be scheduled. The maximum number of hibernation schedulings represents the maximum number of cloud instances that the cloud server can schedule in a single scheduling service.
[0006] During the Sleeping→Running process, if the scheduled time has not yet arrived, a user's active wake-up operation triggers the cloud instance to switch from light sleep mode to running mode. When the scheduled time arrives, the cloud instance's light sleep duration is obtained. This refers to the length of time the cloud instance remains in light sleep mode after switching from deep sleep mode to light sleep mode. When the light sleep duration reaches a preset threshold, the cloud instance is switched from light sleep mode to running mode.
[0007] During the Hibernation Running process, a user's active wake-up operation triggers the cloud instance to switch from deep sleep mode to running mode. It should be understood that in this case, waking up the cloud instance can take a relatively long time. 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 sleep and wake-up queues. The sleep scheduler handles the decision and control of switching from shallow sleep mode to deep sleep mode, while the wake-up scheduler handles the decision and control of pre-wake-up. The timer can be set dynamically and determines the scheduling period difference between two adjacent scheduling times. The sleep and wake-up queues are two priority queues with the same settings but different names. All candidate instances can be enqueued and dequeued, and the next operation is performed based on the different priority settings of each cloud instance. The priority settings also help distinguish user operations from system scheduling operations, thereby ensuring user priority. The sleep and wake-up queues are two blocking queues with limited size. They store cloud instances that met the conditions during the previous scheduling but were not scheduled due to load issues. During each scheduling cycle, the scheduling system pulls cloud instances from the queue and rechecks whether the execution conditions are met at the current moment. Only when the conditions are met will scheduling be initiated. The sleep and wakeup queues have maximum capacity. If the capacity exceeds the maximum, the instances are discarded, causing them to remain in the shallow sleep phase. It should be understood that the load issue here refers to the maximum number of cloud instances that the scheduling system can schedule at one time. In the scenario where deep sleep mode switches to shallow sleep mode, cloud instances that met the conditions during the previous scheduling but were not scheduled due to load issues refer to cloud instances that met the conditions during the previous scheduling but exceeded the scheduling system's maximum capacity. For example, if 100 cloud instances met the conditions during the previous scheduling, but the scheduling system can only schedule 80 cloud instances at a time, the remaining 20 cloud instances are cloud instances that met the conditions during the previous scheduling but were not scheduled due to load issues. As an example, the scheduling diagram for the sleep and wakeup queues shown in Figure 3 is provided. In Figure 3, the sleep queue stores cloud instances in deep sleep mode, and the wakeup queue stores cloud instances in light sleep mode. The sleep scheduler can identify cloud instances in the wakeup queue based on priority that need to be switched to deep sleep mode. Based on a pre-defined decision, it switches these cloud instances to deep sleep mode and stores them in the sleep queue. The wakeup scheduler can identify cloud instances in the sleep queue based on priority that need to be switched to light sleep mode. Based on a pre-defined decision, it switches these cloud instances to deep sleep mode and stores them in the wakeup queue.The presently disclosed embodiments also provide a sleep mode switching device configured to execute the sleep mode switching method provided in any of the above embodiments. As shown in FIG4 , the device includes: an acquisition module 41 configured to acquire instance information corresponding to each cloud instance in a first sleep mode at the current scheduling moment, the instance information indicating the operating mode of each cloud instance at different moments before the current scheduling moment; a determination module 42 configured to determine, from among the cloud instances, a target cloud instance to be switched to sleep mode at the current scheduling moment based on the instance information; and a switching module 43 configured to switch the sleep mode of the target cloud instance from the first sleep mode to a second sleep mode; the first sleep mode being one of a deep sleep mode and a shallow sleep mode, and the second sleep mode being the other of the deep sleep mode and the shallow sleep mode other than the first sleep mode. In some embodiments, the first sleep mode is the deep sleep mode, and the second sleep mode is the shallow sleep mode; 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; the determination module 42 is configured to: determine the target time period based on the current scheduling moment and a preset time length interval; the moment included in the target time period is later than the current scheduling moment; determine the historical time period corresponding to the target time period within the preset first historical time; obtain the target connection data in the historical time period from the historical connection data included in the each instance information; determine the target cloud instance from the each cloud instance based on the target connection data. In some embodiments, the determination module 42 is configured to: obtain the target number of cloud instances in the running mode included in the target connection data; in a case where 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 number of cloud instances in the deep sleep mode and the shallow sleep mode at the current scheduling moment, and the target number, 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; in a case where 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 the statistical cloud instance, and the statistical cloud instance is the cloud instance that is in the deep sleep mode at the current scheduling moment and is in the running mode in the target connection data.In some embodiments, the determination module 42 is configured to: 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 number; calculate a second difference between the product and the target number; and update the first historical time to the second historical time based on the second difference. In some embodiments, the determination module 42 is configured to: if the number of the statistical cloud instances is less than or equal to the maximum pre-wake-up number, use the statistical cloud instance as the target cloud instance; the maximum pre-wake-up number is the maximum number of cloud instances that can be pre-wake-up at one time; if the number of the statistical cloud instances is greater than the maximum pre-wake-up number, select the cloud instance with the highest priority and the maximum pre-wake-up number from the statistical cloud instances as the target cloud instance. In some embodiments, the device is further configured to: obtain the number of each cloud instance; if the number of each cloud instance is greater than the number threshold, shorten the first scheduling period to a second scheduling period, wherein the first scheduling period is used to calculate the current scheduling time based on the previous scheduling time; and calculate the next scheduling time based on the current scheduling time and the second scheduling period. In some embodiments, the first sleep mode is a shallow sleep mode, and the second sleep mode is a deep sleep mode; the instance information includes a shallow sleep duration, which indicates the duration of time the cloud instance is in shallow sleep mode; and the determination module 42 is configured to: obtain the number of cloud instances in shallow sleep mode at the current scheduling time; if the number is less than the maximum number of sleep scheduling instances, determine the cloud instance whose shallow sleep duration, included in the instance information, exceeds a preset duration threshold as the target cloud instance; and if the number is greater than or equal to the maximum number of sleep scheduling instances, select the cloud instance with the highest priority, specified in the maximum number of sleep scheduling instances, from among the cloud instances as the target cloud instance. The sleep mode switching apparatus provided in embodiments of the present disclosure and the sleep mode switching method provided in embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the methods employed, executed, or implemented therein. Embodiments of the present disclosure also provide an electronic device for performing the aforementioned sleep mode switching method. Please refer to FIG. 5 , which shows a schematic diagram of an electronic device provided in some embodiments of the present disclosure.As shown in FIG5 , electronic device 5 includes: a processor 500, a memory 501, a bus 502, and a communication interface 503. The processor 500, communication interface 503, and memory 501 are connected via bus 502. The memory 501 stores a computer program executable on the processor 500. When the processor 500 executes the computer program, it executes the sleep mode switching method provided in any of the aforementioned embodiments of the present disclosure. The memory 501 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between the device network element and at least one other network element is achieved via at least one communication interface 503 (which may be wired or wireless). This communication may utilize the Internet, a wide area network, a local area network, a metropolitan area network, or the like. The bus 502 may be an ISA bus, a PCI bus, or an EISA bus. Buses may be classified as address buses, data buses, control buses, and the like. The memory 501 is configured to store a program. The processor 500 executes the program after receiving an execution instruction. The sleep mode switching method disclosed in any of the aforementioned embodiments of the present disclosure can be applied to or implemented by the processor 500. The processor 500 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the aforementioned method can be completed by hardware integrated logic circuits in the processor 500 or by software instructions. The processor 500 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), 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, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present disclosure can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can be located in a storage medium well-known in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register.The storage medium is located in memory 501. Processor 500 reads information from memory 501 and, in conjunction with its hardware, completes the steps of the aforementioned method. The electronic device provided in the embodiments of the present disclosure and the sleep mode switching method provided in the embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the methods employed, executed, or implemented therein. The embodiments of the present disclosure also provide a computer-readable storage medium corresponding to the sleep mode switching method provided in the aforementioned embodiments. Referring to FIG6 , the computer-readable storage medium shown is an optical disc 30 storing a computer program (i.e., a program product). When executed by the processor, the computer program executes the sleep mode switching method provided in any of the aforementioned embodiments. 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, and are not further detailed here. The computer-readable storage medium provided in the above-described embodiments of the present disclosure and the sleep mode switching method provided in the embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the method employed, executed, or implemented by the application program stored therein. It should be noted that the description provided herein sets forth numerous specific details. However, it is understood that the embodiments of the present disclosure can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail to avoid obscuring the understanding of this description. Similarly, it should be understood that in the above description of the exemplary embodiments of the present disclosure, various features of the present disclosure are sometimes grouped together in a single embodiment, figure, or description thereof to streamline the present disclosure and facilitate understanding of one or more of the various inventive aspects. However, this disclosure should not be interpreted as reflecting an intention that the claimed disclosure requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in fewer than all the features of the individual embodiments disclosed above. Therefore, the claims following this detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the present disclosure. Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of this disclosure and form different embodiments.For example, in the following claims, any of the claimed embodiments may be used in any combination. The above description is merely a preferred embodiment of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope of the present disclosure should be covered by the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims. Industrial Applicability: In the embodiments of the present disclosure, when the current scheduling time arrives, based on the instance information of each cloud instance, the target cloud instance to be switched to sleep mode at the current scheduling time is determined, and the sleep mode of the target cloud instance is switched from the first sleep mode to the second sleep mode. This embodiment automatically switches the cloud instance between shallow sleep mode and deep sleep mode using the instance information of the cloud instance. Compared to manually switching the cloud instance between shallow sleep mode and deep sleep mode, this improves the flexibility of cloud instance sleep mode switching.
Claims
Claims 1. A method for switching a sleep mode, comprising: 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 that needs to switch the sleep mode at the current scheduling moment from among 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 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.
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 that needs to switch the sleep mode at the current scheduling moment from among the cloud instances includes: determining 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. 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 among the cloud instances.
3. The method according to claim 2, wherein Based on the target connection data, determining the target cloud instance from among the cloud instances includes: obtaining the target number 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 number of cloud instances in the deep sleep mode and the light sleep mode at the current scheduling moment, and the target number, 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, based on Count the cloud instances to obtain the target cloud instance, where the counted 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, 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: calculating a first difference between the deep sleep rate and the deep sleep rate threshold; calculating a product of the first difference and the total number; calculating a second difference between the product and the target number; and updating the first historical time to the second historical time based on the second difference.
5. The method according to claim 3, wherein, Obtaining the target cloud instance based on the statistical cloud instances includes: when the number of the statistical cloud instances is less than or equal to the maximum pre-awakening number, using the statistical cloud instances as the target cloud instance; the maximum pre-awakening number being 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, selecting the cloud instances with the highest priority and the maximum pre-awakening number from the statistical cloud instances as the target cloud instances.
6. The method according to any one of claims 1-5, wherein, It further includes: obtaining the number of each cloud instance; when the number of each cloud instance is greater than a number threshold, shortening a first scheduling period to a second scheduling period, the first scheduling period being used to calculate the current scheduling moment based on the previous scheduling moment; and calculating a 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, which is used to represent the duration of the cloud instance in the light sleep mode. Based on the instance information, determining a target cloud instance that needs to switch the sleep mode at the current scheduling moment from each cloud instance includes: obtaining 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, determining the cloud instances with the light sleep duration greater than a preset duration threshold in the instance information as the target cloud instances. When the number is greater than or equal to the maximum sleep scheduling number, selecting the cloud instances with the highest priority and the maximum sleep scheduling number from each cloud instance as the target cloud instances.
8. A sleep mode switching device, comprising: An obtaining module, configured to obtain instance information corresponding to each cloud instance in the first sleep mode at the current scheduling moment, the instance information being used to indicate the working modes of each cloud instance at different moments before the current scheduling moment; a determining module, configured to determine a 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 being one of the deep sleep mode and the light sleep mode, and the second sleep mode being 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, wherein 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 stored thereon a computer program, wherein the program is executed by a processor to implement the method according to any one of claims 1-7. 19
Citation Information
Patent Citations
Terminal equipment, network side equipment and communication method
CN113260030A
Energy-saving method and system for Kubernetes cluster, computer medium and electronic equipment
CN114327023A
Sleep control method and device for central processing unit and electronic equipment
CN116430978A
Sleep Mode Operation for Networked End Devices
US20140047254A1
Networked sleep mode management
US20210235310A1
Cited By
Cooperative solution method and device for dormancy awakening area of lunar rover
CN120994933A