Page processing method and device, storage medium and electronic equipment
By determining the number of requests after the mini-program page loads and dynamically managing processes and containers, the problem of wasted resources in the mini-program backend is solved, improving resource utilization and server performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-03-16
- Publication Date
- 2026-05-19
AI Technical Summary
Regardless of whether a mini-program H5 page is accessed by a user, the page loading process will run in the background, resulting in low resource utilization.
After the target page is loaded, the number of requests within a preset time period is obtained, and it is determined whether it is equal to a preset value. If it is equal, the process is stopped; otherwise, the process continues to run. The program package is dynamically scheduled and loaded on the container to achieve scaling up and down.
This improves resource utilization by running the loading process only when the mini-program is accessed by a user, dynamically adjusting container resources, and increasing server resource utilization.
Smart Images

Figure CN116304428B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and more specifically, to a page processing method and apparatus, storage medium and electronic device. Background Technology
[0002] Mini-programs are applications that can be used without downloading or installation, realizing the dream of "applications at your fingertips." Users can open the application by scanning a QR code or searching, embodying the "use and go" concept, eliminating concerns about installing too many applications. Moreover, due to their convenience, mini-programs are currently very popular, and more and more users prefer using them. However, in related technologies, mini-program H5 pages, regardless of whether the mini-program is accessed by a user, always have a process running in the server background to load the page. This can lead to resource waste and lower resource utilization.
[0003] There is currently no effective solution to the problem that in related technologies, regardless of whether the mini-program is accessed by users, a process for loading pages will run in the background, resulting in low resource utilization. Summary of the Invention
[0004] The main objective of this application is to provide a page processing method, apparatus, storage medium, and electronic device to solve the problem in related technologies where a process for loading pages runs in the background of a mini-program regardless of whether the mini-program is accessed by a user, resulting in low resource utilization.
[0005] To achieve the above objectives, according to one aspect of this application, a page processing method is provided. The method includes: after a target page is loaded, obtaining a target number of requests to access the target page within a preset time period, wherein the target page is a page generated when a target object accesses a mini-program; determining whether the target number of requests is equal to a target preset value; if the target number of requests is equal to the target preset value, stopping the execution of a target process, wherein the target process is used to load the target page; and if the target number of requests is not equal to the target preset value, continuing to execute the target process.
[0006] Furthermore, after continuing to run the target process for loading the target page if the number of requests is not equal to the target preset value, the method further includes: determining whether the number of requests is less than a first preset value; if the number of requests is not less than the first preset value, starting a target container and running the target process on the target container, wherein the target container is at least one container other than the first container running on the target server, the target server is the server corresponding to the mini-program, and the first container is the container running the target process; if the number of requests is less than the first preset value, re-acquiring the first number of requests to access the target page within a preset time period; determining the working state of the target process based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state, or the target process is in a stopped state.
[0007] Furthermore, before obtaining the target number of requests to access the target page within a preset time period after the target page has been loaded, the method further includes: receiving a target request sent by a target object, wherein the target request is used to request access to the mini-program and load the target page; based on the target request, determining whether there are multiple first processes in a running state in the target server, and obtaining a first determination result, wherein the target server is the server corresponding to the mini-program; starting the target process according to the first determination result, and loading the target page.
[0008] Further, starting the target process and loading the target page based on the first determination result includes: if the first determination result indicates that there are multiple first processes running in the target server, then determining the target process from the multiple first processes; starting the target process and loading the target page; if the first determination result indicates that there are no multiple first processes running in the target server, then determining whether there are multiple schedulable second containers in the target server, obtaining a second determination result; starting the target process and loading the target page based on the second determination result.
[0009] Further, starting the target process and loading the target page based on the second determination result includes: if the second determination result indicates that there are schedulable second containers in the target server, then determining a third container from the multiple second containers; determining whether there is a target package for loading the target page in the third container, and obtaining a third determination result; starting the target process and loading the target page based on the third determination result; if the second determination result indicates that there are no schedulable second containers in the target server, then starting a fourth container and obtaining the target package; installing the target package in the fourth container, and running the target process in the fourth container to load the target page.
[0010] Further, starting the target process and loading the target page based on the third determination result includes: if the third determination result indicates that the target package exists in the third container, then running the target package and running the target process in the third container, and loading the target page; if the third determination result indicates that the target package does not exist in the third container, then obtaining the target package; installing the target package in the third container, and running the target process in the third container, and loading the target page.
[0011] Furthermore, before obtaining the target number of requests to access the target page within a preset time period after the target page has been loaded, the method further includes: obtaining a target application package for loading the target page; parsing the target application package to obtain the preset time period and the target number of requests.
[0012] To achieve the above objectives, according to another aspect of this application, a page processing apparatus is provided. The apparatus includes: a first acquisition unit, configured to acquire, after a target page has been loaded, a target number of requests to access the target page within a preset time period, wherein the target page is a page generated when a target object accesses a mini-program; a first judgment unit, configured to determine whether the target number of requests is equal to a target preset value; a first processing unit, configured to stop running a target process if the target number of requests is equal to the target preset value, wherein the target process is used to load the target page; and a second processing unit, configured to continue running the target process if the target number of requests is not equal to the target preset value.
[0013] Furthermore, the device further includes: a second judging unit, configured to, after continuing to run the target process for loading the target page if the number of requests is not equal to the target preset value, judge whether the number of requests is less than a first preset value; a first starting unit, configured to, if the number of requests is not less than the first preset value, start a target container and run the target process on the target container, wherein the target container is at least one container other than the first container running on the target server, the target server is the server corresponding to the mini-program, and the first container is the container running the target process; a second obtaining unit, configured to, if the number of requests is less than the first preset value, re-obtain the first number of requests to access the target page within a preset time period; and a first determining unit, configured to determine the working state of the target process based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state, or the target process is in a stopped state.
[0014] Furthermore, the device further includes: a first receiving unit, configured to receive a target request sent by a target object before obtaining the target number of requests to access the target page within a preset time period after the target page has been loaded, wherein the target request is used to request access to the mini-program and load the target page; a third judging unit, configured to judge, based on the target request, whether there are multiple first processes in a running state in the target server, and obtain a first judging result, wherein the target server is the server corresponding to the mini-program; and a third processing unit, configured to start the target process according to the first judging result and load the target page.
[0015] Further, the third processing unit includes: a first determining subunit, configured to determine the target process from the plurality of first processes if the first determination result indicates that there are multiple first processes in the target server that are running; a first processing subunit, configured to start the target process and load the target page; a first determining subunit, configured to determine whether there are multiple schedulable second containers in the target server if the first determination result indicates that there are no multiple first processes in the target server that are running, and obtain a second determining result; and a second processing subunit, configured to start the target process and load the target page according to the second determining result.
[0016] Further, the second processing subunit includes: a first determining module, configured to determine a third container from the plurality of second containers if the second determination result indicates that there are schedulable second containers in the target server; a first determining module, configured to determine whether there is a target package for loading the target page in the third container, and obtain a third determining result; a first processing module, configured to start the target process and load the target page according to the third determining result; a second processing module, configured to start a fourth container and obtain the target package if the second determination result indicates that there are no schedulable second containers in the target server; and a third processing module, configured to install the target package in the fourth container, run the target process in the fourth container, and load the target page.
[0017] Further, the first processing module includes: a first processing submodule, configured to run the target package and run the target process in the third container to load the target page if the third determination result indicates that the target package exists in the third container; a first acquisition submodule, configured to acquire the target package if the third determination result indicates that the target package does not exist in the third container; and a second processing submodule, configured to install the target package in the third container and run the target process in the third container to load the target page.
[0018] Furthermore, the device further includes: a third acquisition unit, configured to acquire a target application package for loading the target page before acquiring the target number of requests to access the target page within a preset time period after the target page has been loaded; and a first parsing unit, configured to parse the target application package to obtain the preset time period and the target number of requests.
[0019] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, the storage medium storing a program, wherein the program executes the page processing method described in any of the above claims.
[0020] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the page processing method described in any of the above.
[0021] This application employs the following steps: After the target page is loaded, the target number of requests to access the target page within a preset time period is obtained, where the target page is the page generated when the target object accesses the mini-program; it is determined whether the target number of requests equals a preset target value; if the target number of requests equals the preset target value, the target process (used to load the target page) is stopped; if the target number of requests does not equal the preset target value, the target process continues to run. This solves the problem in related technologies where a process for loading the page runs in the background of the mini-program regardless of whether the mini-program is accessed by a user, resulting in low resource utilization. By determining whether the number of requests to access the page within a preset time period equals a preset value after the target page is loaded, and assuming that the page is the page generated when the target object accesses the mini-program, and stopping the process for loading the page when the number of requests equals the preset value, and continuing to run the process to load the page when the number of requests does not equal the preset value, the process for loading the page is ensured to run in the background of the mini-program when it is accessed by a user, thereby improving resource utilization. Attached Figure Description
[0022] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0023] Figure 1 This is a flowchart of a page processing method provided according to an embodiment of this application;
[0024] Figure 2 This is a flowchart of a page processing method provided according to an embodiment of this application. Figure 1 ;
[0025] Figure 3 This is a flowchart of an optional page processing method provided according to an embodiment of this application;
[0026] Figure 4 This is a schematic diagram of a page processing apparatus according to an embodiment of this application;
[0027] Figure 5 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0028] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0032] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a page processing method provided according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:
[0033] Step S101: After the target page is loaded, obtain the target number of requests to access the target page within a preset time period, where the target page is the page generated when the target object accesses the mini program.
[0034] For example, when a user accesses a mini-program, after generating an H5 page (the target page mentioned above), the number of times the user requests to access the H5 page within time T (the preset time period mentioned above) is obtained (the target number of requests mentioned above).
[0035] Step S102: Determine whether the target number of requests is equal to the target preset value.
[0036] For example, determine whether the number of times the H5 page is requested to be accessed within time T (the aforementioned preset time period) (the aforementioned target number of requests) is equal to 0 (the aforementioned target preset value).
[0037] Step S103: If the target number of requests equals the target preset value, then stop running the target process, whereby the target process is used to load the target page.
[0038] For example, if the number of requests to access the H5 page within time T (the aforementioned preset time period) is equal to 0 (the aforementioned target preset value), then the H5 server process (the aforementioned target process) is stopped, the H5 page is stopped from being displayed, and the container is closed.
[0039] Step S104: If the target number of requests is not equal to the target preset value, then continue running the target process.
[0040] For example, if the number of requests to access the H5 page within time T (the aforementioned preset time period) (the aforementioned target number of requests) is not equal to 0 (the aforementioned target preset value), then the H5 server process continues to run and the H5 page is displayed.
[0041] Through the steps S101 to S104 described above, after the target page is loaded, it is determined whether the number of requests to access the page within a preset time period is equal to a preset value, and the page is generated when the target object accesses the mini-program. When the number of requests to access the page is equal to the preset value, the process for loading the page is stopped. When the number of requests to access the page is not equal to the preset value, the process continues to run and load the page. This ensures that when the mini-program is accessed by a user, the process for loading the page runs in the background of the mini-program, thereby improving the utilization rate of resources.
[0042] Optionally, in the page processing method provided in this application embodiment, before obtaining the target number of requests to access the target page within a preset time period after the target page is loaded, the method further includes: receiving a target request sent by a target object, wherein the target request is used to request access to the mini-program and load the target page; based on the target request, determining whether there are multiple first processes in the target server that are running, and obtaining a first determination result, wherein the target server is the server corresponding to the mini-program; starting the target process according to the first determination result and loading the target page.
[0043] For example, a user first accesses the H5 page of the mini program, that is, the request for the user to access the H5 page of the mini program is received (the target request mentioned above). Then the mini program gateway parses the user request and determines whether there are multiple H5 services running in the backend of the current mini program (the multiple first processes mentioned above).
[0044] The above method can quickly and accurately determine whether there is an H5 service running in the backend of the mini program.
[0045] Optionally, in the page processing method provided in this application embodiment, starting the target process and loading the target page according to the first judgment result includes: if the first judgment result indicates that there are multiple first processes in the target server that are running, then determining the target process from the multiple first processes; starting the target process and loading the target page; if the first judgment result indicates that there are no multiple first processes in the target server that are running, then determining whether there are multiple schedulable second containers in the target server, obtaining a second judgment result; starting the target process and loading the target page according to the second judgment result.
[0046] For example, the mini-program gateway parses the user request and determines whether there is an H5 service running in the backend of the current mini-program. If an H5 service is found to be running, it selects one of the H5 backend services (the target process mentioned above) according to the current routing strategy and returns the corresponding H5 page based on the user request information. If no H5 service is found to be running in the backend of the current mini-program, it queries the container pool to see if there are multiple schedulable containers (the multiple second containers mentioned above).
[0047] In addition, the routing strategies mentioned above can employ random, round-robin, or least-connection-count methods. For example, round-robin involves having three servers, and every three requests are distributed to these three machines in a round-robin fashion. Least-connection-count, on the other hand, prioritizes assigning requests to the server with the lowest number of connections.
[0048] The above method allows for the quick and accurate loading of H5 pages using a running H5 service.
[0049] Optionally, in the page processing method provided in this application embodiment, starting the target process and loading the target page based on the second judgment result includes: if the second judgment result indicates that there are multiple schedulable second containers in the target server, then determining a third container from the multiple second containers; determining whether there is a target program package for loading the target page in the third container, and obtaining a third judgment result; starting the target process and loading the target page based on the third judgment result; if the second judgment result indicates that there are no multiple schedulable second containers in the target server, then starting a fourth container and obtaining the target program package; installing the target program package in the fourth container, running the target process in the fourth container, and loading the target page.
[0050] For example, if multiple schedulable containers are found in the container pool, the container that matches the H5 runtime configuration (the third container mentioned above) is selected from the container pool, and it is checked whether the H5 static program package (the target program package mentioned above) has been cached locally in that container; if no multiple schedulable containers are found in the container pool, a new container is started (the fourth container mentioned above), and the H5 program version package (the target program package mentioned above) is pulled, then the H5 program version package is installed in the newly started container, and the H5 server process is started to load the H5 page (the target page mentioned above).
[0051] The above solution allows for easy startup of the H5 server process and loading of H5 pages by installing the H5 program version package in a newly started container.
[0052] Optionally, in the page processing method provided in the embodiments of this application, starting the target process and loading the target page according to the third judgment result includes: if the third judgment result indicates that the target program package exists in the third container, then the target program package is run, and the target process is run in the third container to load the target page; if the third judgment result indicates that the target program package does not exist in the third container, then the target program package is obtained; the target program package is installed in the third container, and the target process is run in the third container to load the target page.
[0053] For example, select a container in the container pool that meets the H5 runtime configuration, check if the container has cached the H5 static package locally. If the container has cached the H5 static package locally, run the H5 static package, start the H5 server process, and then return the corresponding H5 page according to the user request information. If the container does not have the cached H5 static package locally, pull the H5 program version package, install the H5 program version package in the container (the third container mentioned above), start the H5 server process, and load the H5 page (the target page mentioned above).
[0054] In summary, by installing the H5 program version package in a container without caching the H5 program version package, it is easy to start the H5 server process and load the H5 page.
[0055] Optionally, in the page processing method provided in the embodiments of this application, before obtaining the target number of requests to access the target page within a preset time period after the target page is loaded, the method further includes: obtaining a target program package for loading the target page; parsing the target program package to obtain the preset time period and the target number of requests.
[0056] For example, after obtaining the H5 program version package, the H5 program version package can be parsed to obtain the timeout parameter T (the preset time period mentioned above) and the maximum number of visits N (the target number of requests mentioned above) within the time period T.
[0057] For example, the specific process of parsing the H5 program version package can be as follows: First, use the wget command to pull the installation package from the remote server, and then decompress the installation package. Next, obtain the code program package and configuration file. Then, parse the configuration file to obtain the code startup configuration parameters (such as memory usage) and business parameters (such as timeout T, maximum access N, etc.).
[0058] In summary, by parsing the H5 program version package, the timeout parameter T and the maximum number of visits N within time T can be obtained quickly and accurately.
[0059] Figure 2 This is a flowchart of a page processing method provided according to an embodiment of this application. Figure 1 ,like Figure 2 As shown, in the page processing method provided in this application embodiment, after continuing to run the target process for loading the target page if the number of requests is not equal to the target preset value, the method further includes:
[0060] Step S201: Determine whether the number of requests is less than a first preset value;
[0061] Step S202: If the number of requests is not less than the first preset value, then start the target container and run the target process on the target container. The target container is at least one container other than the first container that runs on the target server. The target server is the server corresponding to the mini-program. The first container is the container that runs the target process.
[0062] Step S203: If the number of requests is less than the first preset value, then re-acquire the first number of requests to access the target page within the preset time period;
[0063] Step S204: Determine the working state of the target process based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state or the target process is in a stopped state.
[0064] For example, if the number of requests to access the H5 page within time T (the aforementioned preset time period) is not equal to 0 (the aforementioned target preset value), then it is determined whether the number of requests to access the H5 page within time T (the aforementioned target request number) is less than N (the aforementioned first preset value); if the number of requests to access the H5 page within time T (the aforementioned target request number) is not less than N (the aforementioned first preset value), then the expansion mechanism is activated, that is, a new container (the aforementioned target container) is started, and then the H5 server process is started and the H5 page is loaded; if the number of requests to access the H5 page within time T (the aforementioned target request number) is less than N (the aforementioned first preset value), then the number of H5 page calls is polled every time T, and the H5 server process is controlled to run based on the number of requests to access the H5 page within time T detected by the polling.
[0065] The above solution allows for dynamic perception of the current service's performance pressure and automatic scaling up or down.
[0066] For example, Figure 3 This is a flowchart of an optional page processing method provided according to an embodiment of this application, such as... Figure 3 As shown, the optional page processing methods include the following steps:
[0067] Step 1: The user visits the mini-program H5 page.
[0068] Step 2: The mini-program gateway parses the user request and determines whether there is an H5 service running in the backend of the current mini-program. If there is, it selects one of the H5 backend services according to the current routing strategy and executes step 8; otherwise, it executes step 3.
[0069] Step 3: If there is no running H5 service in the backend of the current mini program, check if there is a schedulable container in the container pool. If there is, proceed to step 4; otherwise, proceed to step 5.
[0070] Step 4: Select a container in the container pool that matches the H5 runtime configuration, and check if the container has cached the H5 static program package (H5 program media) locally. If not, proceed to step 6; if so, proceed to step 7.
[0071] Step 5: Start a new container.
[0072] Step 6: Retrieve the H5 program version package (H5 program media), parse it, and obtain the timeout parameter T and the maximum number of visits N within the time T.
[0073] Step 7: Start the H5 server process.
[0074] Step 8: Return the corresponding H5 page based on the user's request information.
[0075] Step 9: Poll the H5 page call status every T time interval. If there are no requests to call the H5 page within T time interval, proceed to step 10; if the number of requests to call the H5 page within T time interval is greater than N, perform a scaling operation, i.e., jump to step 5.
[0076] Step 10: Stop the H5 server process and shut down the container.
[0077] The novel H5 page loading method based on mini-programs provided in this application ensures that the H5 process only starts and loads quickly when the mini-program is used by the user. Once the user stops accessing the mini-program, the background process running the H5 page is destroyed, thereby improving resource utilization.
[0078] Furthermore, the H5 page loading method based on mini-programs provided in this application embodiment ensures that the H5 service is only started in the background when actually used, compared to traditional H5 services. When there are few calls, the H5 service remains closed. However, if a request comes in, it can quickly provide service, a strategy that significantly improves server resource utilization. Moreover, the H5 page loading method based on mini-programs provided in this application embodiment, compared to traditional H5 services, can dynamically sense the current service performance pressure and automatically scale up or down. Additionally, the H5 page loading method based on mini-programs provided in this application embodiment, compared to traditional H5 services, employs a container preheating approach. During peak periods, it can prioritize starting a portion of containers in a container pool, allowing for rapid service provision without manual intervention during scaling.
[0079] In summary, the page processing method provided in this application, after the target page is loaded, obtains the target number of requests to access the target page within a preset time period, where the target page is the page generated when the target object accesses the mini-program; determines whether the target number of requests is equal to a target preset value; if the target number of requests is equal to the target preset value, stops running the target process, which is used to load the target page; if the target number of requests is not equal to the target preset value, continues running the target process. This solves the problem in related technologies where a process for loading the page runs in the background of the mini-program regardless of whether the mini-program is accessed by a user, resulting in low resource utilization. By determining whether the number of requests to access the page within a preset time period is equal to a preset value after the target page is loaded, and that the page is the page generated when the target object accesses the mini-program, and stopping the process for loading the page when the number of requests to access the page is equal to the preset value, and continuing to run the process to load the page when the number of requests to access the page is not equal to the preset value, the method ensures that the process for loading the page runs in the background of the mini-program when the mini-program is accessed by a user, thereby improving resource utilization.
[0080] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0081] This application also provides a page processing apparatus. It should be noted that the page processing apparatus of this application can be used to execute the page processing method provided in this application. The page processing apparatus provided in this application will be described below.
[0082] Figure 4 This is a schematic diagram of a page processing apparatus according to an embodiment of this application. Figure 4 As shown, the device includes: a first acquisition unit 401, a first judgment unit 402, a first processing unit 403, and a second processing unit 404.
[0083] Specifically, the first acquisition unit 401 is used to acquire the target number of requests to access the target page within a preset time period after the target page is loaded, wherein the target page is the page generated when the target object accesses the mini program;
[0084] The first judgment unit 402 is used to determine whether the target number of requests is equal to the target preset value;
[0085] The first processing unit 403 is used to stop running the target process if the target number of requests is equal to the target preset value, wherein the target process is used to load the target page;
[0086] The second processing unit 404 is used to continue running the target process if the target number of requests is not equal to the target preset value.
[0087] In summary, the page processing apparatus provided in this application embodiment, through the first acquisition unit 401, after the target page is loaded, acquires the target number of requests to access the target page within a preset time period, wherein the target page is the page generated when the target object accesses the mini-program; the first judgment unit 402 determines whether the target number of requests is equal to a target preset value; the first processing unit 403 stops running the target process if the target number of requests is equal to the target preset value, wherein the target process is used to load the target page; the second processing unit 404 continues to run the target process if the target number of requests is not equal to the target preset value. This solves the problem in related technologies that regardless of whether the mini-program is accessed by the user, the process for loading the page will run in the background of the mini-program, resulting in low resource utilization. After the target page is loaded, it is determined whether the number of requests to access the page within a preset time period equals a preset value, and the page is generated when the target object accesses the mini program. When the number of requests to access the page equals the preset value, the process for loading the page stops running; when the number of requests to access the page does not equal the preset value, the process continues to run and load the page. This ensures that when the mini program is accessed by a user, the process for loading the page runs in the background of the mini program, thereby improving resource utilization.
[0088] Optionally, in the page processing apparatus provided in the embodiments of this application, the apparatus further includes: a second judging unit, configured to judge whether the number of requests is less than a first preset value after continuing to run the target process for loading the target page if the number of requests is not equal to a target preset value; a first starting unit, configured to start a target container and run the target process on the target container if the number of requests is not less than the first preset value, wherein the target container is at least one container other than the first container running on the target server, the target server is the server corresponding to the mini-program, and the first container is the container running the target process; a second obtaining unit, configured to re-obtain the first number of requests to access the target page within a preset time period if the number of requests is less than the first preset value; and a first determining unit, configured to determine the working state of the target process based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state, or the target process is in a stopped state.
[0089] Optionally, in the page processing apparatus provided in the embodiments of this application, the apparatus further includes: a first receiving unit, configured to receive a target request sent by a target object before obtaining the target number of requests to access the target page within a preset time period after the target page is loaded, wherein the target request is used to request access to the mini-program and load the target page; a third judging unit, configured to judge whether there are multiple first processes in a running state in the target server based on the target request, and obtain a first judging result, wherein the target server is the server corresponding to the mini-program; and a third processing unit, configured to start the target process and load the target page according to the first judging result.
[0090] Optionally, in the page processing apparatus provided in this application embodiment, the third processing unit includes: a first determining subunit, configured to determine a target process from the multiple first processes if a first determination result indicates that multiple first processes exist in the target server and are running; a first processing subunit, configured to start the target process and load the target page; a first determining subunit, configured to determine whether multiple schedulable second containers exist in the target server if the first determination result indicates that multiple first processes do not exist in the target server and obtain a second determination result; and a second processing subunit, configured to start the target process and load the target page according to the second determination result.
[0091] Optionally, in the page processing apparatus provided in this application embodiment, the second processing subunit includes: a first determining module, configured to determine a third container from the multiple second containers if a second determination result indicates that there are multiple schedulable second containers in the target server; a first determining module, configured to determine whether there is a target program package for loading the target page in the third container, and obtain a third determination result; a first processing module, configured to start a target process and load the target page according to the third determination result; a second processing module, configured to start a fourth container and obtain the target program package if the second determination result indicates that there are no multiple schedulable second containers in the target server; and a third processing module, configured to install the target program package in the fourth container, run the target process in the fourth container, and load the target page.
[0092] Optionally, in the page processing apparatus provided in the embodiments of this application, the first processing module includes: a first processing submodule, configured to run the target package and run the target process in the third container to load the target page if the third judgment result indicates that the target package exists in the third container; a first acquisition submodule, configured to acquire the target package if the third judgment result indicates that the target package does not exist in the third container; and a second processing submodule, configured to install the target package in the third container and run the target process in the third container to load the target page.
[0093] Optionally, in the page processing apparatus provided in the embodiments of this application, the apparatus further includes: a third acquisition unit, configured to acquire a target program package for loading the target page before acquiring the target number of requests to access the target page within a preset time period after the target page is loaded; and a first parsing unit, configured to parse the target program package to obtain the preset time period and the target number of requests.
[0094] The page processing device includes a processor and a memory. The first acquisition unit 401, the first judgment unit 402, the first processing unit 403, and the second processing unit 404 are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.
[0095] A processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and resource utilization can be improved by adjusting kernel parameters.
[0096] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0097] This invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements a method for processing the page.
[0098] This invention provides a processor for running a program, wherein the program executes a method for processing the page during runtime.
[0099] like Figure 5 As shown, this embodiment of the invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: after the target page is loaded, it obtains the target number of requests to access the target page within a preset time period, wherein the target page is the page generated when the target object accesses the mini-program; it determines whether the target number of requests is equal to a target preset value; if the target number of requests is equal to the target preset value, it stops running the target process, wherein the target process is used to load the target page; if the target number of requests is not equal to the target preset value, it continues running the target process.
[0100] When the processor executes the program, it also implements the following steps: after continuing to run the target process for loading the target page if the number of requests is not equal to the target preset value, the method further includes: determining whether the number of requests is less than a first preset value; if the number of requests is not less than the first preset value, starting a target container and running the target process on the target container, wherein the target container is at least one container other than the first container running on the target server, the target server is the server corresponding to the mini-program, and the first container is the container running the target process; if the number of requests is less than the first preset value, re-acquiring the first number of requests to access the target page within a preset time period; determining the working state of the target process based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state, or the target process is in a stopped state.
[0101] When the processor executes the program, it also performs the following steps: before obtaining the target number of requests to access the target page within a preset time period after the target page is loaded, the method further includes: receiving a target request sent by a target object, wherein the target request is used to request access to the mini-program and load the target page; based on the target request, determining whether there are multiple first processes in a running state in the target server, and obtaining a first determination result, wherein the target server is the server corresponding to the mini-program; starting the target process according to the first determination result and loading the target page.
[0102] When the processor executes the program, it also performs the following steps: starting the target process and loading the target page based on the first judgment result includes: if the first judgment result indicates that there are multiple first processes in the target server that are running, then determining the target process from the multiple first processes; starting the target process and loading the target page; if the first judgment result indicates that there are no multiple first processes in the target server that are running, then determining whether there are multiple schedulable second containers in the target server, obtaining a second judgment result; starting the target process and loading the target page based on the second judgment result.
[0103] When the processor executes the program, it also performs the following steps: starting the target process and loading the target page based on the second judgment result includes: if the second judgment result indicates that there are schedulable second containers in the target server, then determining a third container from the multiple second containers; determining whether there is a target program package for loading the target page in the third container, and obtaining a third judgment result; starting the target process and loading the target page based on the third judgment result; if the second judgment result indicates that there are no schedulable second containers in the target server, then starting a fourth container and obtaining the target program package; installing the target program package in the fourth container, and running the target process in the fourth container to load the target page.
[0104] When the processor executes the program, it also performs the following steps: starting the target process and loading the target page based on the third judgment result includes: if the third judgment result indicates that the target package exists in the third container, then the target package is run, and the target process is run in the third container, and the target page is loaded; if the third judgment result indicates that the target package does not exist in the third container, then the target package is obtained; the target package is installed in the third container, and the target process is run in the third container, and the target page is loaded.
[0105] When the processor executes the program, it also performs the following steps: before obtaining the target number of requests to access the target page within a preset time period after the target page is loaded, the method further includes: obtaining a target program package for loading the target page; parsing the target program package to obtain the preset time period and the target number of requests.
[0106] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0107] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: after the target page is loaded, obtaining the target number of requests to access the target page within a preset time period, wherein the target page is the page generated when the target object accesses the mini-program; determining whether the target number of requests is equal to a target preset value; if the target number of requests is equal to the target preset value, stopping the execution of the target process, wherein the target process is used to load the target page; if the target number of requests is not equal to the target preset value, continuing to execute the target process.
[0108] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: after continuing to run the target process for loading the target page if the number of requests is not equal to the target preset value, the method further includes: determining whether the number of requests is less than a first preset value; if the number of requests is not less than the first preset value, starting a target container and running the target process on the target container, wherein the target container is at least one container other than the first container running on the target server, the target server is the server corresponding to the mini-program, and the first container is the container running the target process; if the number of requests is less than the first preset value, re-acquiring the first number of requests to access the target page within a preset time period; determining the working state of the target process based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state, or the target process is in a stopped state.
[0109] When executed on a data processing device, it is also suitable to execute a program with the following initialization steps: after the target page is loaded, before obtaining the target number of requests to access the target page within a preset time period, the method further includes: receiving a target request sent by a target object, wherein the target request is used to request access to the mini-program and load the target page; based on the target request, determining whether there are multiple first processes in a running state in the target server, and obtaining a first determination result, wherein the target server is the server corresponding to the mini-program; starting the target process according to the first determination result, and loading the target page.
[0110] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: starting the target process and loading the target page based on the first judgment result includes: if the first judgment result indicates that there are multiple first processes in the target server that are running, then determining the target process from the multiple first processes; starting the target process and loading the target page; if the first judgment result indicates that there are no multiple first processes in the target server that are running, then determining whether there are multiple schedulable second containers in the target server, obtaining a second judgment result; starting the target process and loading the target page based on the second judgment result.
[0111] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: starting the target process and loading the target page based on the second judgment result includes: if the second judgment result indicates that there are schedulable plurality of second containers in the target server, then determining a third container from the plurality of second containers; determining whether there is a target program package for loading the target page in the third container, and obtaining a third judgment result; starting the target process and loading the target page based on the third judgment result; if the second judgment result indicates that there are no schedulable plurality of second containers in the target server, then starting a fourth container and obtaining the target program package; installing the target program package in the fourth container, and running the target process in the fourth container to load the target page.
[0112] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: starting the target process and loading the target page based on the third judgment result, including: if the third judgment result indicates that the target package exists in the third container, then running the target package and running the target process in the third container, and loading the target page; if the third judgment result indicates that the target package does not exist in the third container, then obtaining the target package; installing the target package in the third container, and running the target process in the third container, and loading the target page.
[0113] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: after the target page is loaded, before obtaining the target number of requests to access the target page within a preset time period, the method further includes: obtaining a target package for loading the target page; parsing the target package to obtain the preset time period and the target number of requests.
[0114] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0115] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0116] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0117] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0118] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0119] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0120] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media 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 memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0121] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0122] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for processing a webpage, characterized in that, include: After the target page is loaded, obtain the target number of requests to access the target page within a preset time period, wherein the target page is the page generated when the target object accesses the mini program; Determine whether the target number of requests is equal to a target preset value, wherein the target preset value is 0; If the target number of requests equals the target preset value, then the target process is stopped, wherein the target process is used to load the target page; If the target number of requests is not equal to the target preset value, then the target process continues to run.
2. The method according to claim 1, characterized in that, After the method continues to run the target process for loading the target page if the number of requests is not equal to the target preset value, the method further includes: Determine whether the number of requests is less than a first preset value; If the number of requests is not less than the first preset value, then the target container is started and the target process is run on the target container. The target container is at least one container other than the first container running on the target server. The target server is the server corresponding to the mini-program. The first container is the container running the target process. If the number of requests is less than the first preset value, then the first number of requests to access the target page within the preset time period is re-acquired; The working state of the target process is determined based on the first number of requests, wherein the working state of the target process is one of the following: the target process is in a running state, or the target process is in a stopped state.
3. The method according to claim 1, characterized in that, Before obtaining the target number of requests to access the target page within a preset time period after the target page has been loaded, the method further includes: Receive a target request sent by the target object, wherein the target request is used to request access to the mini-program and load the target page; Based on the target request, it is determined whether there are multiple first processes running in the target server, and a first determination result is obtained, wherein the target server is the server corresponding to the mini-program; The target process is started based on the first determination result, and the target page is loaded, wherein the first determination result is used to indicate: to select one process from the plurality of first processes as the target process, or to start the target process by scheduling a container.
4. The method according to claim 3, characterized in that, Starting the target process and loading the target page based on the first determination result includes: If the first determination result indicates that there are multiple first processes running in the target server, then the target process is determined from the multiple first processes; Start the target process and load the target page; If the first judgment result indicates that there are no running first processes in the target server, then it is determined whether there are schedulable second containers in the target server, and a second judgment result is obtained. The target process is started based on the second judgment result, and the target page is loaded. The second judgment result is used to indicate whether the target process is started based on an existing container in the target server or by starting a new container.
5. The method according to claim 4, characterized in that, Starting the target process and loading the target page based on the second determination result includes: If the second determination result indicates that there are schedulable second containers in the target server, then a third container is determined from the multiple second containers; Determine whether a target program package for loading the target page exists in the third container, and obtain a third determination result; The target process is started based on the third judgment result, and the target page is loaded, wherein the third judgment result is used to indicate: the target process is started based on the target package that already exists in the third container, or the target process is started by pulling the target package; If the second determination result indicates that there are no schedulable second containers in the target server, then the fourth container is started and the target program package is obtained, wherein the fourth container is a new container; The target package is installed in the fourth container, and the target process is run in the fourth container to load the target page.
6. The method according to claim 5, characterized in that, Starting the target process and loading the target page based on the third judgment result includes: If the third determination result indicates that the target program package exists in the third container, then the target program package is run, the target process is run in the third container, and the target page is loaded; If the third determination result indicates that the target package does not exist in the third container, then the target package is obtained; The target package is installed in the third container, and the target process is run in the third container to load the target page.
7. The method according to claim 1, characterized in that, Before obtaining the target number of requests to access the target page within a preset time period after the target page has been loaded, the method further includes: Obtain the target package used to load the target page; The target package is parsed to obtain the preset time period and the target number of requests.
8. A page processing apparatus, characterized in that, include: The first acquisition unit is used to acquire the target number of requests to access the target page within a preset time period after the target page is loaded, wherein the target page is the page generated when the target object accesses the mini program; The first judgment unit is used to determine whether the target number of requests is equal to a target preset value, wherein the target preset value is 0. The first processing unit is configured to stop running the target process if the target number of requests equals the target preset value, wherein the target process is used to load the target page; The second processing unit is configured to continue running the target process if the target number of requests is not equal to the target preset value.
9. A computer-readable storage medium, characterized in that, The storage medium stores a program, wherein the program executes the page processing method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, It includes one or more processors and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the page processing method according to any one of claims 1 to 7.