Management method and device of applet container pool, equipment, storage medium and product
By dynamically managing the number of containers in the applet container pool and optimizing resource allocation, the WebView applet framework's slow cold start loading and large resource usage are solved, and the system performance and user experience are improved.
Patent Information
- Application Number
- CN202411340098.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-17
AI Technical Summary
The WebView-based applet framework loads for a long time during cold startup, and creates a large number of H5 containers to occupy system resources, affecting performance and stability.
By monitoring the loading time of the applet, we judge the number of containers in the container pool. If the threshold is not reached and there are insufficient free containers, create and allocate free containers; when the threshold is reached, non-idle containers are recycled according to the comprehensive priority, and preset and time priority sorting are adopted Strategy, dynamically adjust container pool resources.
It improves the cold start loading efficiency of mini programs, enhances the scalability and stability of the system, avoids resource waste, and ensures efficient processing of concurrent requests.
Smart Images

Figure CN119322652A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of mobile application development technology, and in particular to a management method, device, equipment, storage medium and product for a mini-program container pool. Background Art
[0002] With the rapid development of mobile Internet technology, the mini-program framework based on WebView (page view) has become an important choice for building lightweight applications due to its flexibility and development efficiency. Since the characteristics of mini-programs require support for multi-task parallel processing, if H5 containers are created in large quantities or frequently in the system, it will not only occupy a large amount of system resources, but also significantly increase system overhead, thus affecting the performance and stability of the overall program.
[0003] At present, when the WebView applet framework uses the H5 container for page rendering, it faces the problem of long loading time during cold start. Therefore, how to optimize the loading and rendering efficiency of the H5 container is a problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of this application is to provide a management method, device, equipment, storage medium and product for a mini-program container pool, aiming to solve the technical problem of the technical problem.
[0005] To achieve the above objectives, the present application proposes a method for managing a mini-program container pool, the method comprising:
[0006] When it is monitored that the loading time of the mini program is longer than the preset time, it is determined whether the number of containers in the container pool reaches a preset threshold, where the number of containers includes the number of idle containers and the number of non-idle containers;
[0007] When the number of containers in the container pool does not reach a preset threshold and the number of free containers in the container pool is less than the user demand, creating a first free container corresponding to the mini program in the container pool according to the mini program initialization request;
[0008] The first idle container is allocated to the applet, and the allocated first idle container is marked as a non-idle state.
[0009] In one embodiment, after the step of marking the allocated first idle container as a non-idle state, the following steps are included:
[0010] Determine again whether the number of containers in the container pool reaches the preset threshold;
[0011] When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to comprehensive priorities;
[0012] When the number of containers does not reach the preset threshold and the number of free containers in the container pool is less than the user demand, return to the step of creating a first free container corresponding to the mini-program in the container pool according to the mini-program initialization request.
[0013] In one embodiment, the comprehensive priority includes a preset priority and a time priority, and when the number of containers reaches a preset threshold, the step of recycling non-idle containers in the container pool according to the comprehensive priority includes:
[0014] When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to a preset priority;
[0015] After the step of recycling the non-idle containers in the container pool according to the preset priority, determining again whether the number of containers in the container pool reaches a preset threshold;
[0016] When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to the time priority.
[0017] In one embodiment, the container includes a page view, the preset priority includes a container usage frequency, and when the number of containers reaches a preset threshold, the step of recycling non-idle containers in the container pool according to the preset priority includes:
[0018] When the number of containers reaches a preset threshold, the non-idle containers in the container pool are sorted according to the usage frequency of the containers to obtain a first sorting result;
[0019] According to the first sorting result, the page views of non-idle containers in the container pool are cleared in sequence to obtain a second idle container, where the second idle container is used to load the target applet.
[0020] In one embodiment, the time priority includes the last use time of the container, and when the number of the containers reaches a preset threshold, the step of recycling the non-idle containers in the container pool according to the time priority includes:
[0021] When the number of containers reaches a preset threshold, the non-idle containers in the container pool are sorted in reverse order according to the last use time to obtain a second sorting result;
[0022] According to the second sorting result, the page views of the non-free containers in the container pool are cleared in sequence to obtain the second free container.
[0023] In one embodiment, the step of recycling non-idle containers in the container pool according to the comprehensive priority level includes:
[0024] Recycling non-idle containers in the container pool according to the comprehensive priority to obtain a second idle container;
[0025] It is determined again whether the number of containers in the container pool reaches a preset threshold, and when the number of containers reaches the preset threshold, the second idle container is deleted.
[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes a management device for a mini-program container pool, and the management device for the mini-program container pool includes:
[0027] A quantity determination module, used to determine whether the number of containers in the container pool reaches a preset threshold when it is detected that the loading time of the mini program is longer than a preset time, wherein the number of containers includes the number of idle containers and the number of non-idle containers;
[0028] A container creation module, configured to create a first idle container corresponding to the mini-program in the container pool according to a mini-program initialization request when the number of containers in the container pool does not reach a preset threshold and the number of idle containers in the container pool is less than the user demand;
[0029] The container marking module is used to allocate the first idle container to the applet and mark the allocated first idle container as a non-idle state.
[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a management device for a mini-program container pool, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the mini-program container pool management method as described above.
[0031] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the mini-program container pool management method as described above are implemented.
[0032] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method for managing the mini-program container pool as described above.
[0033] One or more technical solutions proposed in this application have at least the following technical effects:
[0034] When it is monitored that the loading time of the mini program is longer than the preset time, it is determined whether the number of containers in the container pool reaches the preset threshold, and the number of containers includes the number of idle containers and the number of non-idle containers; when the number of containers in the container pool does not reach the preset threshold and the number of idle containers in the container pool is less than the user demand, the first idle container corresponding to the mini program is created in the container pool according to the mini program initialization request; the first idle container is allocated to the mini program, and the allocated first idle container is marked as non-idle. By creating the first idle container corresponding to the mini program in the container pool according to the mini program initialization request and the intelligent container allocation mechanism, the problem of slow loading of the mini program when cold starting is solved, so that the system can better handle concurrent requests and maintain the stable operation of the system. At the same time, when user demand grows, the system can flexibly increase the number of containers to meet the demand, thereby enhancing the scalability of the system. By judging again whether the number of containers in the container pool reaches the preset threshold, when the number of containers reaches the preset threshold, the non-idle containers in the container pool are recycled according to the comprehensive priority, and the system can make more reasonable decisions to minimize the impact on user experience. When the number of containers does not reach the preset threshold, but the number of free containers in the container pool is still less than the user demand, the container pool management is made into a dynamic cycle process by returning to the step of creating the first free container corresponding to the mini program in the container pool according to the mini program initialization request. The system continuously adjusts according to the current demand and resource status to ensure that the mini program request can be processed efficiently. Through intelligent sorting and clearing strategies, the system can automatically adjust resource allocation to avoid resource waste and overconsumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0037] Figure 1 This is a flowchart of the first embodiment of the management method of the mini-program container pool of the present application;
[0038] Figure 2 This is a flowchart of the second embodiment of the method for managing a mini-program container pool of the present application;
[0039] Figure 3 This is a flowchart of the third embodiment of the method for managing a mini-program container pool of the present application;
[0040] Figure 4 This is a schematic diagram of the container pool state in the embodiment of the present application;
[0041] Figure 5 A schematic diagram of the module structure of a management device for a mini-program container pool according to an embodiment of the present application;
[0042] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the management method of the mini-program container pool in the embodiment of the present application.
[0043] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0045] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0046] The WebView-based mini-program framework has become an important choice for building lightweight applications due to its flexibility and development efficiency. However, this type of framework currently faces a significant problem when using H5 containers for page rendering: the mini-program takes a long time to load and renders data slowly during cold start, which directly affects the user's first impression and experience. At the same time, due to the characteristics of mini-programs requiring support for multi-task parallel processing, if H5 containers are created in large numbers or frequently in the system, it will not only occupy a large amount of system resources, but also significantly increase system overhead, thereby affecting the performance and stability of the overall program, and ultimately resulting in a significant reduction in user experience, and failing to give full play to the convenience and efficiency of mini-programs.
[0047] Therefore, how to optimize the loading and rendering efficiency of the H5 container and reduce the unnecessary consumption of system resources while ensuring the richness of mini-program functions and user experience is a problem that needs to be solved urgently.
[0048] The present application provides a solution. When it is monitored that the loading time of a mini program is longer than the preset time, it is determined whether the number of containers in the container pool has reached the preset threshold, and the number of containers includes the number of idle containers and the number of non-idle containers; when the number of containers in the container pool has not reached the preset threshold, and the number of idle containers in the container pool is less than the user demand, the first idle container corresponding to the mini program is created in the container pool according to the mini program initialization request; the first idle container is allocated to the mini program, and the allocated first idle container is marked as non-idle. By creating idle containers in the container pool according to user needs and mini program initialization requests, and managing the containers, the problem of slow cold start loading of mini programs is solved, and the scalability of the system is enhanced.
[0049] Based on this, the present application embodiment provides a method for managing a mini-program container pool, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the management method of the mini-program container pool of the present application.
[0050] In this embodiment, the method for managing the mini-program container pool includes steps S10 to S30:
[0051] Step S10: When it is monitored that the loading time of the mini program is longer than the preset time, it is determined whether the number of containers in the container pool reaches a preset threshold.
[0052] It should be noted that the loading time of the mini program can be understood as the time required for the mini program to start loading and become fully available. The preset time is a pre-set time threshold, which is used to determine whether the loading of the mini program is too slow. The number of containers includes the number of idle containers and the number of non-idle containers. A container pool is a collection of a group of container instances that are centrally managed logically or physically. Containers (such as Docker containers) are a lightweight, portable, self-sufficient software packaging technology used to package applications and their dependencies into a deployable unit. In a microservice architecture or cloud environment, container pools are often used to dynamically manage and schedule resources.
[0053] Step S20: When the number of containers in the container pool does not reach a preset threshold and the number of free containers in the container pool is less than the user demand, a first free container corresponding to the mini program is created in the container pool according to the mini program initialization request.
[0054] It should be noted that the idle container includes a first idle container and a second idle container. The first idle container can be understood as a new container corresponding to the mini-program created in the container pool according to the mini-program initialization request, and the second idle container is an idle container that is always pre-existing in the container pool. It can be understood that the first idle container corresponds to the mini-program initialization request, and the second idle container may not correspond to a specific mini-program. The number of idle containers is the sum of the number of first idle containers and the number of second idle containers. The user demand can be the number of mini-program requests that need to be processed currently. The system needs to dynamically adjust resources based on this demand to ensure that all requests can be responded to in a timely manner.
[0055] Step S30: allocate the first idle container to the applet, and mark the allocated first idle container as a non-idle state.
[0056] Exemplarily, when an idle container is allocated to a small program and starts running its application, the container enters a non-idle state.
[0057] In this embodiment, when it is monitored that the loading time of the mini-program is longer than the preset time, it is determined whether the number of containers in the container pool has reached the preset threshold, and the number of containers includes the number of idle containers and the number of non-idle containers; when the number of containers in the container pool has not reached the preset threshold, and the number of idle containers in the container pool is less than the user demand, the first idle container corresponding to the mini-program is created in the container pool according to the mini-program initialization request; the first idle container is allocated to the mini-program, and the allocated first idle container is marked as non-idle. By creating the first idle container corresponding to the mini-program in the container pool according to the mini-program initialization request and the intelligent container allocation mechanism, the problem of slow loading of the mini-program when cold-started is solved, so that the system can better handle concurrent requests and maintain stable operation of the system. At the same time, when user demand grows, the system can flexibly increase the number of containers to meet demand, thereby enhancing the scalability of the system.
[0058] Reference Figure 2 , Figure 2 This is a flow chart of the second embodiment of the management method of the mini-program container pool of the present application, based on the above Figure 1 The first embodiment shown is a second embodiment of the method for managing a mini-program container pool of the present application.
[0059] In the second embodiment, after step S30, the following steps are included:
[0060] Step S40, determining again whether the number of containers in the container pool reaches a preset threshold.
[0061] Understandably, as new containers are created, the state of the container pool needs to be re-evaluated. If the number of containers has reached a preset threshold, the system needs to take some action to free up resources so that future requests can be processed.
[0062] Step S50: When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to the comprehensive priority.
[0063] It should be noted that the step of recycling non-idle containers in the container pool according to the comprehensive priority includes: recycling non-idle containers in the container pool according to the comprehensive priority to obtain a second idle container; and again determining whether the number of containers in the container pool reaches a preset threshold, and when the number of containers reaches the preset threshold, deleting the second idle container.
[0064] Among them, the comprehensive priority can be an evaluation indicator used to determine which container among multiple non-idle containers should be recycled first. This priority is usually based on a comprehensive consideration of multiple factors, such as the running time of the container, the importance of the currently running application, the amount of resources occupied by the container (such as CPU, memory), the load of the container, and whether there are other containers that can replace the functions of the current container. The second idle container can be an idle container obtained by recycling a non-idle container. The resources of the non-idle container can be recycled and released so that the container is in an idle state, and these idle containers (i.e., the second idle containers) can be reallocated to new applications or applets for use. If after recycling the non-idle container and judging the container pool status again, it is found that the number of containers still reaches or exceeds the preset threshold, and the number of idle containers also exceeds the range that the system considers reasonable, the system will choose to delete some idle containers (including the second idle containers) to release more resources.
[0065] It should be noted that when the number of containers does not reach the preset threshold and the number of free containers in the container pool is less than the user demand, the process returns to the step of creating the first free container corresponding to the mini program in the container pool according to the mini program initialization request.
[0066] For example, when the number of containers does not reach the preset threshold, but the number of free containers in the container pool is still less than the user demand, the system needs to continue processing new mini-program initialization requests, that is, the system will return to step S20 and create a corresponding mini-program container in the container pool according to the new request.
[0067] In this embodiment, by determining again whether the number of containers in the container pool has reached a preset threshold, when the number of containers reaches the preset threshold, the non-idle containers in the container pool are recycled according to the comprehensive priority, and the system can make more reasonable decisions to minimize the impact on the user experience. When the number of containers does not reach the preset threshold, but the number of idle containers in the container pool is still less than the user demand, by returning to the step of creating the first idle container corresponding to the mini-program in the container pool according to the mini-program initialization request, the container pool management is made into a dynamic cycle process, and the system continuously adjusts according to the current demand and resource status to ensure that the mini-program request can be processed efficiently while maintaining the stability and scalability of the system.
[0068] Reference Figure 3 , Figure 3 This is a flow chart of the third embodiment of the management method of the mini-program container pool of the present application, based on the above Figure 2 The second embodiment shown proposes a third embodiment of the method for managing a mini-program container pool of the present application.
[0069] In the third embodiment, the step S50 includes:
[0070] Step S501: When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to a preset priority.
[0071] It should be noted that when performing a recycling operation, the preset priority can be used to determine the rules or order in which containers should be processed first. For example, the priority can be set according to the importance of the container. For example, the payment applet can be set as frequently used, and the system will not recycle the payment applet.
[0072] Step S502: again determine whether the number of containers in the container pool reaches a preset threshold.
[0073] It is understandable that each time a container in the container pool is recycled or created, it is necessary to determine whether the number of containers in the container pool meets the conditions.
[0074] Step S503: When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to time priority.
[0075] It should be noted that time priority can be another method for determining the order of resource recycling, which is mainly based on the creation time or last activity time of the container or resource. For example, the system can choose to recycle those containers with the earliest creation time or those that have not been used in the recent period of time to release resources for other tasks.
[0076] In this embodiment, by recycling containers according to preset priorities, the system can intelligently identify and retain critical or high-priority containers, which not only improves the stability and reliability of the system, but also ensures the continuity of user experience and avoids service interruptions caused by resource recycling. It is determined again whether the number of containers in the container pool has reached the preset threshold. This step ensures that the system can continuously monitor resource usage and dynamically adjust according to actual needs. By giving priority to recycling containers that have not been used for a long time or were created the earliest, the system can more effectively release resources and make room for new or more active tasks.
[0077] In one implementation, based on the third embodiment, step S501 includes: when the number of containers reaches a preset threshold, sorting the non-idle containers in the container pool according to the container usage frequency to obtain a first sorting result; clearing the page views of the non-idle containers in the container pool in sequence according to the first sorting result to obtain a second idle container, and the second idle container is used to load the target applet.
[0078] It should be noted that the frequency of container use refers to the number of times or frequency that the container is accessed or used. The first sorting result may be an ordered list obtained by sorting the non-idle containers in the container pool according to the frequency of container use. The target applet may be understood as the applet to be loaded. Clearing the page view (WebView) may be understood as removing or destroying the interface of the currently running applet or application from the container. It is understandable that clearing the page view generally involves releasing resources related to the interface (such as memory, graphics resources, etc.), but does not completely destroy the container itself. After clearing the page view, the container becomes idle and the next target applet can be reloaded.
[0079] For example, in order to better understand the above embodiment, the container pool display during the entire processing process can be as follows: Figure 4 As shown, assuming that there is no mini-program in use in the container pool, it is necessary to create a first idle container corresponding to the mini-program in the container pool according to the mini-program initialization request, that is, Figure 4 When the number of containers reaches a preset threshold, the non-idle containers in the container pool are recycled according to the comprehensive priority. Recyclable container 2 can be understood as the recyclable container with the highest priority, container 1 can be understood as the non-idle container, and container 2 can be understood as the second idle container for loading the target applet. It can be understood that the number of non-idle containers in the container pool can be increased according to user needs.
[0080] In this embodiment, by sorting the non-idle containers in the container pool according to the frequency of container use, the system can identify those containers that are less used, thereby ensuring that these containers can be processed first when resources are tight. According to the first sorting result, the page views of the non-idle containers in the container pool are cleared in sequence, and the system can gradually release the resources of the no longer active containers to make room for new tasks or applets. The entire process promotes the effective use of resources and the stable operation of the system. Through intelligent sorting and clearing strategies, the system can automatically adjust resource allocation to avoid resource waste and excessive consumption.
[0081] In one implementation, based on the third embodiment, step S503 includes: when the number of containers reaches a preset threshold, sorting the non-idle containers in the container pool in reverse order according to the last usage time to obtain a second sorting result; and clearing the page views of the non-idle containers in the container pool in sequence according to the second sorting result to obtain a second idle container.
[0082] It should be noted that the last use time may refer to the timestamp when the container was last accessed or used. This timestamp records the last active state of the container and is an important indicator for evaluating the frequency and activity of container use. Reverse sorting is a sorting method in which elements are arranged from large to small (or from newest to oldest). For example, containers can be arranged from the most recently used to the least recently used according to the last use time of the container. The second sorting result is a result list obtained by reverse sorting the containers according to the last use time, which contains all non-free containers sorted by the last use time.
[0083] In this embodiment, by reverse sorting the non-idle containers in the container pool according to the last use time, the system can identify those containers that have not been used for the longest time. This sorting method makes the resource recovery strategy more accurate, giving priority to releasing those resources that have been idle for a long time. According to the second sorting result, the page views of the non-idle containers in the container pool are cleared in sequence, and the system can orderly release the resources of the no longer active containers to ensure that these resources can be reallocated to tasks or applets that need them more. Through the sorting and clearing strategy based on the last use time, the system can automatically optimize resource allocation, reduce resource waste, and improve overall performance.
[0084] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the management method of the mini-program container pool of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0085] This application also provides a management device for a mini-program container pool, please refer to Figure 5 , the management device of the mini-program container pool includes:
[0086] The quantity determination module 10 is used to determine whether the number of containers in the container pool reaches a preset threshold when it is detected that the loading time of the mini program is longer than a preset time, wherein the number of containers includes the number of idle containers and the number of non-idle containers;
[0087] The container creation module 20 is used to create a first idle container corresponding to the mini program in the container pool according to the mini program initialization request when the number of containers in the container pool does not reach a preset threshold and the number of free containers in the container pool is less than the user demand;
[0088] The container marking module 30 is used to allocate the first idle container to the applet and mark the allocated first idle container as a non-idle state.
[0089] The management device of the mini-program container pool provided by the present application adopts the management method of the mini-program container pool in the above embodiment, which can solve the technical problem of the technical problem. Compared with the prior art, the beneficial effects of the management device of the mini-program container pool provided by the present application are the same as the beneficial effects of the management method of the mini-program container pool provided by the above embodiment, and other technical features in the management device of the mini-program container pool are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0090] The present application provides a management device for a mini-program container pool, and the management device for the mini-program container pool includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the management method of the mini-program container pool in the above-mentioned embodiment one.
[0091] Reference below Figure 6 , which shows a schematic diagram of the structure of a management device for a mini-program container pool suitable for implementing an embodiment of the present application. The management device for the mini-program container pool in the embodiment of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The management device of the mini-program container pool shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0092] like Figure 6As shown, the management device of the applet container pool may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the management device of the applet container pool are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the management device of the applet container pool to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 , a management device for a small program container pool having various systems is shown, but it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0093] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0094] The management device of the mini-program container pool provided by the present application adopts the management method of the mini-program container pool in the above embodiment, which can solve the technical problem of the technical problem. Compared with the prior art, the beneficial effects of the management device of the mini-program container pool provided by the present application are the same as the beneficial effects of the management method of the mini-program container pool provided by the above embodiment, and the other technical features in the management device of the mini-program container pool are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0095] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0096] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0097] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the method for managing a mini-program container pool in the above-mentioned embodiment.
[0098] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0099] The computer-readable storage medium may be included in the management device of the mini-program container pool; or may exist independently without being installed in the management device of the mini-program container pool.
[0100] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the management device of the mini-program container pool, the management device of the mini-program container pool: when monitoring that the loading time of the mini-program is longer than the preset time, judge whether the number of containers in the container pool reaches a preset threshold, and the number of containers includes the number of idle containers and the number of non-idle containers; when the number of containers in the container pool does not reach the preset threshold and the number of idle containers in the container pool is less than the user demand, create a first idle container corresponding to the mini-program in the container pool according to the mini-program initialization request; allocate the first idle container to the mini-program, and mark the allocated first idle container as non-idle.
[0101] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0102] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0103] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0104] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for managing the mini-program container pool, and can solve the technical problem of the technical problem. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the method for managing the mini-program container pool provided by the above-mentioned embodiment, and will not be repeated here.
[0105] The present application also provides a computer program product, including a computer program, which implements the steps of the method for managing a mini-program container pool as described above when executed by a processor.
[0106] The computer program product provided by this application can solve the technical problem of the technical problem. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the method for managing the mini-program container pool provided by the above embodiment, which will not be repeated here.
[0107] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for managing a mini-program container pool, characterized in that: The method includes: When it is monitored that the loading time of the mini program is longer than the preset time, it is determined whether the number of containers in the container pool reaches a preset threshold, where the number of containers includes the number of idle containers and the number of non-idle containers; When the number of containers in the container pool does not reach a preset threshold and the number of free containers in the container pool is less than the user demand, creating a first free container corresponding to the mini program in the container pool according to the mini program initialization request; The first idle container is allocated to the applet, and the allocated first idle container is marked as a non-idle state.
2. The method according to claim 1, characterized in that After the step of marking the allocated first idle container as a non-idle state, the method further comprises: Determine again whether the number of containers in the container pool reaches the preset threshold; When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to comprehensive priorities; When the number of containers does not reach the preset threshold and the number of free containers in the container pool is less than the user demand, return to the step of creating a first free container corresponding to the mini-program in the container pool according to the mini-program initialization request.
3. The method according to claim 2, characterized in that The comprehensive priority includes a preset priority and a time priority. When the number of containers reaches a preset threshold, the step of recycling non-idle containers in the container pool according to the comprehensive priority includes: When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to a preset priority; After the step of recycling the non-idle containers in the container pool according to the preset priority, determining again whether the number of containers in the container pool reaches a preset threshold; When the number of containers reaches a preset threshold, non-idle containers in the container pool are recycled according to the time priority.
4. The method according to any one of claims 1 to 3, characterized in that The container includes a page view, the preset priority includes a container usage frequency, and when the number of containers reaches a preset threshold, the step of recycling non-idle containers in the container pool according to the preset priority includes: When the number of containers reaches a preset threshold, the non-idle containers in the container pool are sorted according to the usage frequency of the containers to obtain a first sorting result; According to the first sorting result, the page views of non-idle containers in the container pool are cleared in sequence to obtain a second idle container, where the second idle container is used to load the target applet.
5. The method according to claim 4, characterized in that The time priority includes the last use time of the container. When the number of the containers reaches a preset threshold, the step of recycling the non-idle containers in the container pool according to the time priority includes: When the number of containers reaches a preset threshold, the non-idle containers in the container pool are sorted in reverse order according to the last use time to obtain a second sorting result; According to the second sorting result, the page views of the non-free containers in the container pool are cleared in sequence to obtain the second free container.
6. The method according to claim 5, characterized in that The step of recycling non-idle containers in the container pool according to the comprehensive priority level includes: Recycling non-idle containers in the container pool according to the comprehensive priority to obtain a second idle container; It is determined again whether the number of containers in the container pool reaches a preset threshold, and when the number of containers reaches the preset threshold, the second idle container is deleted.
7. A management device for a mini-program container pool, characterized in that: The device comprises: A quantity determination module, used to determine whether the number of containers in the container pool reaches a preset threshold when it is detected that the loading time of the mini program is longer than a preset time, wherein the number of containers includes the number of idle containers and the number of non-idle containers; A container creation module, configured to create a first idle container corresponding to the mini-program in the container pool according to a mini-program initialization request when the number of containers in the container pool does not reach a preset threshold and the number of idle containers in the container pool is less than the user demand; The container marking module is used to allocate the first idle container to the applet and mark the allocated first idle container as a non-idle state.
8. A management device for a mini-program container pool, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for managing a mini-program container pool as claimed in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method for managing a mini-program container pool as described in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the method for managing a mini-program container pool according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Efficient container resource pool management method and device based on Kubernetes
CN121681073A
A Kubernetes-based efficient container resource pool management method and device
CN121681073B