Preheating method, device and equipment for application
By obtaining and using preheating elements with high frequency when the application starts, the problem of untimely response caused by cold start is solved, and the efficiency and user experience of the application are improved.
Patent Information
- Application Number
- CN202411327711.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-01-10
AI Technical Summary
Modern mobile applications may cause untimely user interface response after cold startup, affecting user experience and reducing user satisfaction.
By obtaining preheating elements with high frequency when the application is started, preheating operations are performed to improve cold start efficiency, and quickly respond to user requests during subsequent operations, reducing business timeout problems.
Improves application usability and rapid response capabilities and improves user experience.
Smart Images

Figure CN119292692A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of software development technology, and in particular to a preheating method, device, and equipment for an application. Background Art
[0002] In the development and use of modern mobile applications, user experience (UX) is a crucial factor. Users expect applications to respond quickly to their operations and provide a smooth interactive experience.
[0003] However, in actual applications, especially after the cold start of the application system, after the user interface (UI) is loaded, there may still be untimely responses. This phenomenon not only affects the user experience, but may also cause users to lose satisfaction with the application and even give up using the application. Summary of the invention
[0004] In view of the above problems, the embodiments of the present invention provide a method, device, and equipment for preheating an application, which are used to solve the problems such as service timeout caused by cold start in the prior art.
[0005] According to one aspect of an embodiment of the present invention, a method for preheating an application is provided, which is applied to a terminal device, and the method includes:
[0006] When detecting that an application is started in the terminal device, obtaining at least one type of preheating item, each type of preheating item includes: a preset number of preheating elements of the type with a usage frequency from high to low, the preheating elements being elements that require preparation operations, verification operations, precalculation operations, or / and initialization operations before the application is run;
[0007] According to the at least one type of preheating item, a preheating operation is performed on the application.
[0008] According to another aspect of an embodiment of the present invention, a preheating method for an application is provided, which is applied to a service device, and the method includes:
[0009] Obtaining a preheating request sent by a terminal device on which the application is installed;
[0010] According to the preheating request, a preset number of preheating elements of the at least one type of preheating items whose usage frequency is from high to low are determined in the indicator warehouse of the service device, wherein the usage frequency of each preheating element in different types of preheating items is recorded in the indicator warehouse, and the preheating elements are elements that require preparation operations, verification operations, precalculation operations, or / and initialization operations before the application is run;
[0011] A preset number of preheating elements in descending order of usage frequency in the at least one type of preheating items are sent to the terminal device.
[0012] According to another aspect of an embodiment of the present invention, there is provided a preheating device for an application, which is applied to a terminal device, and the device includes:
[0013] an acquisition module, configured to acquire at least one type of preheating item upon detecting that an application is started in the terminal device, wherein each type of preheating item includes: a preset number of preheating elements of the type with a usage frequency from high to low, wherein the preheating elements are elements that require preparation operations, verification operations, precalculation operations, or / and initialization operations before the application is run;
[0014] A processing module is used to perform a preheating operation on the application according to the at least one type of preheating item.
[0015] According to another aspect of an embodiment of the present invention, there is provided a preheating device for application, which is applied to a service device, and the device comprises:
[0016] An acquisition module, used to acquire a preheating request sent by a terminal device on which the application is installed;
[0017] a determination module, configured to determine, in an indicator warehouse of the service device, according to the preheating request, a preset number of preheating elements of the preheating items of the at least one type, the usage frequencies of the preheating elements in the preheating items of different types being recorded in the indicator warehouse, the preheating elements being elements that require preparation operations, verification operations, precalculation operations, or / and initialization operations before the application is run;
[0018] The sending module is used to send a preset number of preheating elements in the at least one type of preheating items, with the usage frequency ranging from high to low, to the terminal device.
[0019] According to another aspect of an embodiment of the present invention, there is provided an electronic device, which may be the above-mentioned terminal device or service device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus;
[0020] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the operation of the preheating method of the application as described above.
[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores at least one executable instruction, wherein the executable instruction enables a device / equipment to perform the operation of the preheating method of the above application.
[0022] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the operation of the above-mentioned application preheating method is implemented.
[0023] The embodiment of the present invention uses a preheating method, device, and equipment to obtain a preset number of preheating elements with a decreasing usage frequency when detecting the startup of an application program, and use a better resource strategy during startup to improve the efficiency of the cold start in the preheating stage; the obtained preheating elements can then be used to preheat the application program, so that in the subsequent running of the application program, the user's business request can be quickly responded to, business timeouts and other problems caused by cold start can be reduced, and the availability, rapid response capability, and user experience of the application program can be improved.
[0024] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0026] Figure 1 A schematic diagram showing the architecture of the preheating method for an application provided by the present invention;
[0027] Figure 2 A flow chart showing a first embodiment of the preheating method applied by the present invention;
[0028] Figure 3 A flow chart showing a second embodiment of the preheating method applied by the present invention;
[0029] Figure 4 A flow chart showing a third embodiment of the preheating method applied in the present invention;
[0030] Figure 5 A schematic structural diagram of a first embodiment of a preheating device applied in the present invention is shown;
[0031] Figure 6 A schematic structural diagram showing a second embodiment of a preheating device applied in the present invention;
[0032] Figure 7 A schematic structural diagram of an embodiment of the electronic device of the present invention is shown. DETAILED DESCRIPTION
[0033] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0034] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0035] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments provided herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the embodiments provided below are partial embodiments for implementing the present invention, rather than providing all embodiments for implementing the present invention. In the absence of conflict, the technical solutions recorded in the embodiments of the present invention can be implemented in any combination.
[0036] It should be noted that, in the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or apparatus including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or apparatus. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other related elements (such as steps in a method or modules in an apparatus, such as a module that can be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or apparatus including the element.
[0037] For example, the preheating method for an application provided in an embodiment of the present invention includes a series of steps, but the preheating method for an application provided in an embodiment of the present invention is not limited to the steps described in this document. Similarly, the preheating device for an application provided in an embodiment of the present invention includes a series of modules, but the preheating device for an application provided in an embodiment of the present invention is not limited to including the modules explicitly described, and may also include modules that need to be set for obtaining relevant information or performing processing based on information.
[0038] Before introducing the applied preheating method, the application background of the present invention is first explained.
[0039] In the development and use of modern mobile applications, user experience (UX) is a crucial factor. Users expect applications to respond quickly to their operations and provide a smooth interactive experience.
[0040] However, in actual applications, especially after the cold start of the application system, after the user interface (UI) is loaded, there may still be untimely responses. This phenomenon not only affects the user experience, but may also cause users to lose satisfaction with the application and even give up using the application.
[0041] Based on the above technical problems, the technical concept of the present invention is as follows: if the process of preparation operation, verification operation, pre-calculation operation, or / and initialization operation of the application can be implemented in advance during the cold start phase of the application, then the problem of slow business response speed caused by the above process can be avoided in the subsequent operation phase. That is, the application can be preheated in advance. In the implementation of the preheating operation, different types of preheating elements are obtained. If the relevant elements of functions or scenarios that are frequently used by the application during operation can be preferentially selected as preheating elements, then when the application is cold started, the implementation of the preheating operation occupies less operating resources and ensures the purpose of rapid response of subsequent business.
[0042] The technical solution of the present invention is described in detail below through specific embodiments. The execution subject of the present invention is an electronic device, which can be a terminal device or a service device.
[0043] Optionally, the terminal device is a device with an application installed, such as a mobile phone, a computer, a tablet, some servers, etc.; the service device is a device that provides services for the application in a distributed system, such as a control server, etc.
[0044] Accordingly, Figure 1 The schematic diagram of the architecture of the preheating method for the application provided by the present invention is shown as follows: Figure 1 As shown, the architecture includes: a preheating component (English: Warmuper) and a startup component (English: Bootstrap).
[0045] In the first part, the Warmuper component abstracts the warmup() interface of the warmup logic. This component can implement the specific warmup logic by inheritance, namely, the following components: the interface warmup component (English: ApiWarmuper), the database warmup component (English: SqlWarmuper), the Shardingsphere warmup component of Structured Query Language (SQL) (English: ShardingsphereWarmuper), and the Java virtual machine (English abbreviation: JVM) warmup component (English: JVMWarmuper);
[0046] Exemplarily, the ApiWarmuper component is used to perform related operations of the preheating element of the interface verification type, that is, to simulate actual user requests and perform basic processing on the response of each interface, such as checking the response status code to ensure that the interface can correctly return the expected result; the SqlWarmuper component is used to perform related operations of the preheating element of the database query type, that is, to execute SQL queries and return the query results to the database; the Shardingsphere preheating component is used to perform related operations of the preheating element of the database script type, that is, to perform syntax analysis of each SQL and cache the analysis results; the JVM preheating component is used to perform related operations of the preheating element of the function call type, that is, through performance analysis (English: profiling), frequently called functions or hot code in the application are identified, and the JVM's JIT (Just-in-time compiler) is triggered to compile the code path of the commonly used code into local machine code.
[0047] The second part is the Bootstrap component abstraction Bootstrap() interface. This component abstraction is used to integrate various systems so that the warm-up operation can be performed within the initialization life cycle before each system is started, that is, the health check type component (English: HealthIndicator) of the boot class or mechanism and the service interaction type component are obtained;
[0048] Exemplarily, the health check type component of the bootstrap class or mechanism is used to perform related operations of the preheating element of the health check type. The health check operation is automatically performed when the application starts to check whether the database connection, cache system or other dependent services are normal; the service interaction type component is used to perform related operations of the preheating element of the service interaction type. The readinessProbe is configured in the Kubernetes configuration file to check whether the application has completed preheating and is ready to receive traffic, ensuring that the application is ready to process requests before officially receiving traffic.
[0049] Above Figure 1 The embodiment shown is a structure of a component to be implemented. In practical applications, the configuration thereof can be changed, expanded, or reduced based on user needs or other factors. The technical solution of the present invention is described in detail below through specific embodiments.
[0050] Figure 2 FIG. 1 is a flow chart showing a first embodiment of a preheating method applied by the present invention, the method being executed by a terminal device. Figure 2 As shown, the method comprises the following steps:
[0051] S21. When detecting that an application is started in the terminal device, obtaining at least one type of preheating item;
[0052] Among them, each type of preheating item includes: a preset number of preheating elements with a usage frequency from high to low under the type, and the preheating elements are elements that require preparation operations, verification operations, pre-calculation operations, or / and initialization operations before the application is run.
[0053] In this step, when the startup of an application in the terminal device is detected, that is, before the application provides the user with an interactive interface for operation, after the user clicks the icon of the application, or during the loading process of the application, at least one type of preheating item is obtained, and each type of preheating item includes: a preset number of preheating elements with a usage frequency from high to low.
[0054] Optionally, the value of the preset number can be based on experience and can be determined by taking into account the loading performance of the application, the system resources of the terminal device, and other conditions.
[0055] For example, 10, 20, etc., the preset number corresponding to each type of preheating item may be different and is not limited here.
[0056] Optionally, the type of the warm-up item includes at least one of the following: interface verification type, database query type, database script type, function call type, health check type, and service interaction type.
[0057] In a possible implementation, the types of the above preheating items are illustrated as follows:
[0058] 1. Preheating elements of interface verification type: various business-related API interfaces;
[0059] 2. Warm-up elements of database query type: various SQL query interfaces;
[0060] 3. Warm-up elements of database script type: various SQL;
[0061] 4. Preheating elements of function call type: functions or hot code called in the application;
[0062] 5. Health check type warm-up elements: various health check probe types, such as checking database connections, cache systems, and other dependent services;
[0063] 6. Warm-up elements of service interaction type: service class, such as loading cache, establishing database connection, etc., to implement elements that are ready to process requests before officially receiving traffic.
[0064] Optionally, at least one type of preheating item may be pre-cached in the terminal device, or may be obtained from the service device in real time.
[0065] S22: Perform a preheating operation on the application program according to at least one type of preheating item.
[0066] In this step, each preheating element in the at least one type of preheating item obtained above is used to preheat the application.
[0067] Optionally, for each type of preheating item, the execution order of the preheating operation may be to start with the most frequently used preheating element; different types of preheating items may be executed one by one in sequence; or the preheating operation may be executed using each preheating element at the same time.
[0068] In a possible implementation, the types of the above preheating items are exemplified:
[0069] 1. Preheating elements of interface verification type, such as calling the API interface of the product list, can simulate user requests, then access the API interface, cache the response results of the API interface, and complete the preheating operation corresponding to the API interface; one implementation is the interface preheating component ApiWarmuper, which is used to perform application initialization operations and cache preheating operations through the interface;
[0070] 2. Warm-up element of database query type: For example, for the SQL query interface of A, execute the SQL query of A and cache the query result to complete the warm-up operation corresponding to the SQL query interface of A; one implementation is the database warm-up component SqlWarmuper, which is used to trigger the database cache or even the data warm-up in the database when the application starts;
[0071] 3. Warm-up elements of database script type: For example, for SQL of B, execute syntax analysis of SQL of B, change the analysis result into cache, and complete the warm-up operation corresponding to SQL of B; one implementation is Shardingsphere warm-up component ShardingsphereWarmuper, which is used to warm-up SQL syntax analyzer, perform syntax analysis on important SQL in advance and write into cache, so as to reduce the cost of later SQL syntax analysis.
[0072] 4. Preheating elements of function call type: For example, the hotspot code C called in the application triggers the JVM's JIT to compile the code path of the frequently used hotspot code C into local machine code. One implementation is the JVM preheating component JVMWarmuper, which is used to preheat the JVM when the JVM starts. For example, it starts preheating for functions that are frequently called after profiling to trigger local machine code conversion. It can even reduce the JIT preheating time by importing the JVM information in the pre-release environment into the production environment.
[0073] 5. Preheating elements of health check type: for example, checking the health check probe class of database connection, executing the health check operation of checking the database connection, exchanging the execution result into cache, and completing the preheating operation corresponding to the health check probe class of checking the database connection; one implementation is that SpringCloudWebBootstrap is used to integrate SpringCloud's network (English: Web) application, and through the HealthIndicator (health check probe) mechanism, preheating operation is performed before the life cycle of the Web application providing external services;
[0074] 6. Preheating elements of service interaction type: for example, establishing a database connection, executing the database connection establishment operation, caching the establishment result, and completing the preheating operation corresponding to establishing the database connection. One implementation is that K8sBootstrap is used to integrate Kubernetes and perform preheating operations before the Kubernetes application is available.
[0075] Optionally, S22 may include any of the following implementations:
[0076] First, preheating the application programs one by one according to each of the preheating elements of a preset number in at least one type of preheating items;
[0077] In this implementation, for each of the first preset number of preheating elements in each preheating item, for example, the first three preheating elements, the first preheating element can be used to preheat the application. After completion, the second preheating element can be used to preheat the application, and then the third one can be executed. This process can provide consistency in the data used in the preheating process and facilitate the control of the preheating process.
[0078] Secondly, the application is preheated at the same time according to each preheating element of a preset number of preheating items of at least one type.
[0079] In this implementation, for each of the first preset number of preheating elements in each preheating item, for example, the first three preheating elements, these three preheating elements can be used simultaneously to preheat the application program, and this process can improve the efficiency of preheating.
[0080] Furthermore, if the preheating operation on the application is not completed within a preset time period, the preheating operation on the application is stopped.
[0081] In this implementation, a time limit for executing the preheating operation, that is, a preset time, can be set. If the preheating operation is not fully completed within the preset time, entering the interactive interface of the application can be directly terminated.
[0082] For example, 2s, 3s, etc.
[0083] In a possible implementation, the preheating operation can be performed synchronously or in parallel based on Bootstrap, and the preheating time can be controlled by timeout configuration to avoid the risk of application unavailability due to excessive preheating operation cost.
[0084] In the preheating method for an application provided by an embodiment of the present invention, when the terminal device detects that an application is started, the terminal device obtains at least one type of preheating item; wherein each type of preheating item includes: a pre-preset number of preheating elements with a usage frequency from high to low under the type, and the preheating element is an element that requires preparation operation, verification operation, pre-calculation operation, or / and initialization operation before the application is run, and then the application is preheated according to at least one type of preheating item. In this technical solution, a pre-preset number of preheating elements with a usage frequency from high to low can be obtained, and a better resource strategy can be used at startup to improve the efficiency of the cold start in the preheating stage; then the obtained preheating elements can be used to preheat the application, so that in the subsequent application operation process, the user's business request can be quickly responded to, reducing business timeouts and other problems caused by cold start, and improving the availability, rapid response capability, and user experience of the application.
[0085] Based on the above embodiments, Figure 3 FIG. 1 is a flow chart showing a second embodiment of the preheating method applied in the present invention, which describes the above S21 in detail from the perspective of interaction between the terminal device and the service device. Figure 3 As shown, the following steps are included:
[0086] S31, the terminal device sends a preheating request to the service device corresponding to the application;
[0087] The preheating request is used to trigger the service device to determine a preset number of preheating elements with a usage frequency in descending order of at least one type of preheating items in the indicator warehouse;
[0088] In this step, when the terminal device detects that the application is started, the terminal device sends a preheating request to the service device corresponding to the application to request to obtain the preheating elements required for the preheating operation.
[0089] Optionally, the preheating request may carry an identifier of the terminal device;
[0090] In other implementations, the type of the preheating item and the number of preheating elements corresponding to each type may also be carried.
[0091] For example, the type of the preheating item to be obtained is an interface verification type, and the number of preheating elements to be obtained is 5.
[0092] S32, the service device obtains a preheating request sent by the terminal device on which the application is installed;
[0093] In this step, after the terminal device sends the preheating request, the service device obtains the preheating request.
[0094] S33, the service device determines, according to the preheating request, a preset number of preheating elements of at least one type of preheating items in the indicator warehouse of the service device, with the usage frequency ranging from high to low;
[0095] Among them, the indicator warehouse records the usage frequency of each preheating element in different types of preheating items.
[0096] In this step, after obtaining the preheating request, the service device determines at least one type of preheating item in the local indicator warehouse, and selects a preset number of preheating elements in each type of preheating item from high to low usage frequency.
[0097] For example, for a warm-up item of interface verification type, the top five API interfaces with the highest to lowest usage frequency can be obtained; for a warm-up item of database script type, the top ten SQLs with the highest to lowest usage frequency can be obtained, and so on.
[0098] In other implementations, if the preheating request carries the type of preheating item to be obtained as an interface verification type, and the number of preheating elements to be obtained is 5, then the top 5 API interfaces with the highest to lowest usage frequency are obtained from the preheating items of the interface verification type.
[0099] S34, the service device sends a preset number of preheating elements of at least one type of preheating item in descending order of usage frequency to the terminal device;
[0100] In this step, after determining a first preset number of preheating elements with a usage frequency from high to low in at least one type of preheating items, the preheating elements are sent to the terminal device.
[0101] S35. The terminal device receives a preset number of preheating elements of at least one type of preheating items sent by the service device, with the usage frequency ranging from high to low.
[0102] In this step, the terminal device receives the preheating element returned from the service device and then performs a preheating operation.
[0103] In an embodiment of the present invention, in a possible implementation, taking the database script type as an example: the application starts bootstrap to pull the top 20 frequently used SQLs from the indicator warehouse through a remote procedure call (RPC), and preheats these frequently used SQLs through ShardingSphereSqlWarmuper.
[0104] The preheating method of the application provided by the embodiment of the present invention, the terminal device sends a preheating request to the service device corresponding to the application; wherein the preheating request is used to trigger the service device to determine the pre-set number of preheating elements with the highest to lowest frequency of use in at least one type of preheating item in the indicator warehouse; then the service device obtains the preheating request sent by the terminal device on which the application is installed; then the service device determines the pre-set number of preheating elements with the highest to lowest frequency of use in at least one type of preheating item in the indicator warehouse of the service device according to the preheating request; wherein the indicator warehouse records the frequency of use of each preheating element in different types of preheating items, and then the service device sends the pre-set number of preheating elements with the highest to lowest frequency of use in at least one type of preheating item to the terminal device; finally, the terminal device receives the pre-set number of preheating elements with the highest to lowest frequency of use in at least one type of preheating item sent by the service device. In this technical solution, the service device pre-stores the pre-set number of preheating elements with the highest to lowest frequency of use in at least one type of preheating item, so as to achieve the purpose of allocating the preheating elements used when the application is cold started, thereby improving the accuracy of the current preheating business response for the subsequent application runtime.
[0105] Based on the above embodiments, Figure 4 The flowchart of the third embodiment of the preheating method applied by the present invention is shown. The method describes in detail the relevant implementation of the collection of usage information of the preheating element from the perspective of the interaction between the terminal device and the service device. Figure 4 As shown, the following steps are included:
[0106] S41. When the terminal device detects that the application is running, it obtains the usage log of the application;
[0107] The usage log records usage information of at least one preheating element during the running phase of the application program;
[0108] In this step, when the application is running, the terminal device continuously generates a usage log, and the usage log records the relevant usage information of the preheating elements involved when the application is running.
[0109] Optionally, the usage information may be, for example, the number of calls to A's SQL query interface; the number of calls to B's SQL; the number of calls to hotspot code C, and so on.
[0110] In a possible implementation, the frequency of obtaining the application usage log can be set, such as once a day, every time the application is used, and so on.
[0111] S42, the terminal device sends a usage log to the service device;
[0112] Among them, the usage log is used to determine the usage frequency of each warm-up element in different types of warm-up items in the indicator warehouse.
[0113] In this step, after obtaining the usage log, the terminal device sends the usage log to the service device.
[0114] In a possible implementation, the frequency of reporting the usage log of the application to the service device may be consistent with the frequency of obtaining the usage log, or a longer period may be used.
[0115] S43, the service device obtains the usage log of the application sent by the terminal device;
[0116] Optionally, in actual implementation, the number of terminal devices on which the application is installed is at least one, that is, in this step, for each terminal device, when the application is running, the corresponding usage log can be obtained at a certain frequency.
[0117] S44. The service device determines the usage frequency of at least one preheating element according to the acquired usage log, and stores it in the indicator warehouse.
[0118] In this step, after obtaining the usage log of the terminal device, the usage log is parsed to obtain usage information of the preheating element involved in the usage log;
[0119] For each preheating element, based on the usage information, the usage frequency of the preheating element is determined. The determination here can be divided into two cases:
[0120] 1. If the preheating element does not exist in the indicator warehouse, a new statistic for the preheating element can be created, and the usage frequency can be used as the usage frequency after the preheating element statistics; if the usage frequency of the preheating element exists in the indicator warehouse, the usage frequency of the preheating element statistics can be updated using the obtained usage frequency.
[0121] In one possible implementation, if it is parsed that the API interface for calling the product list is used 5 times in one day, 5 times can be added to the usage frequency of the API interface for calling the product list in the indicator warehouse; if it is parsed that the SQL query interface of A is used 3 times in one day, if there is no SQL query interface of A in the indicator warehouse, then the SQL query interface of A is created and the usage frequency is recorded as 3 times.
[0122] In addition, the usage frequency of unchanged preheating components can also be updated periodically. For example, if no new usage information is received within 10 days after calling the API interface for the product list, it can be considered that the business corresponding to the API interface for calling the product list is offline, and the usage frequency of the API interface for calling the product list and other related information can be cleared from the indicator warehouse.
[0123] In an embodiment of the present invention, in a possible implementation, taking the database script type as an example above: when the application is running, the SQL parser (English: Parser) interface performs syntax tree parsing on the SQL involved to obtain standardized SQL, and then reports the standardized SQL to the indicator warehouse based on the MeterReporter interface, so that the indicator warehouse can be used for frequency statistics of preheating elements of the database script type, that is, SQL statistics.
[0124] In the application preheating method provided by the embodiment of the present invention, when the terminal device detects that the application is running, it obtains the usage log of the application; wherein the usage log records the usage information of at least one preheating element during the running stage of the application; then the terminal device sends the usage log to the service device; then the service device obtains the usage log of the application sent by the terminal device; finally, the service device determines the usage frequency of at least one preheating element based on the usage information of at least one preheating element obtained, and stores it in the indicator warehouse. In this technical solution, the service device collects the running log of the application in the terminal device and determines the preheating elements with higher usage frequency therefrom, which can increase the accuracy of the preheating elements pulled during subsequent preheating, and improve the availability, response rate, and usage fit when the subsequent application is running.
[0125] Figure 5 FIG. 1 is a schematic diagram showing the structure of the first embodiment of the preheating device used in the present invention. Figure 5 As shown, the device is applied to a terminal device, including:
[0126] The acquisition module 51 is used to acquire at least one type of preheating items when detecting that an application is started in the terminal device, each type of preheating items respectively including: a preset number of preheating elements of the type with a usage frequency from high to low, the preheating elements being elements that require preparation operations, verification operations, pre-calculation operations, or / and initialization operations before the application is run;
[0127] The processing module 52 is used to perform a preheating operation on the application according to at least one type of preheating item.
[0128] In an optional manner, the acquisition module 51 is specifically configured to:
[0129] Sending a preheating request to a service device corresponding to the application, the preheating request is used to trigger the service device to determine a preset number of preheating elements with a high to low usage frequency in at least one type of preheating items in the indicator warehouse;
[0130] A preset number of preheating elements in descending order of usage frequency among at least one type of preheating items sent by a receiving service device.
[0131] In an optional manner, the type of the preheating item includes at least one of the following:
[0132] Interface verification type, database query type, database script type, function call type, health check type, service interaction type.
[0133] In an optional manner, the processing module 52 is further configured to:
[0134] When detecting that the application is running, obtaining a usage log of the application, wherein the usage log records usage information of at least one preheating element during the running phase of the application;
[0135] A usage log is sent to the service device, where the usage log is used to determine the usage frequency of each warm-up element in different types of warm-up items in the indicator warehouse.
[0136] In an optional manner, the processing module 52 performs a preheating operation on the application according to at least one type of preheating item, specifically for:
[0137] Preheating the application programs one by one according to each of the preheating elements of a preset number in at least one type of preheating items;
[0138] or, performing a preheating operation on the application program at the same time according to each preheating element of a preset number of preheating items of at least one type;
[0139] The processing module 52 is further used for:
[0140] If the preheating operation on the application is not completed within the preset time, the preheating operation on the application is stopped.
[0141] From the above, it can be seen that in the application preheating method provided by the embodiment of the present invention, when the terminal device detects the startup of the application, it can obtain a preset number of preheating elements with usage frequency from high to low, and use a better resource strategy during startup to improve the efficiency of cold start in the preheating stage; thereafter, the obtained preheating elements can be used to preheat the application, so that in the subsequent application running process, the user's business request can be quickly responded to, reducing business timeouts and other problems caused by cold start, and improving the application's availability, rapid response capability, and user experience.
[0142] Figure 6 FIG. 2 shows a schematic diagram of the structure of the second embodiment of the preheating device used in the present invention. Figure 6 As shown, the device is applied to service equipment, including:
[0143] An acquisition module 61 is used to acquire a preheating request sent by a terminal device on which an application is installed;
[0144] A determination module 62 is used to determine, in an indicator warehouse of a service device, a preset number of preheating elements of at least one type of preheating items, whose usage frequencies are ranked from high to low, according to the preheating request, wherein the indicator warehouse records the usage frequencies of each preheating element in different types of preheating items, and the preheating element is an element that requires preparation operation, verification operation, precalculation operation, or / and initialization operation before the application is run;
[0145] The sending module 63 is used to send a preset number of preheating elements of at least one type of preheating items whose usage frequency is ranked from high to low to the terminal device.
[0146] In an optional manner, the determination module 62 is further configured to:
[0147] Obtaining a usage log of an application sent by at least one terminal device, wherein the usage log records usage information of at least one preheating element during a running phase of the application;
[0148] Based on all the acquired usage logs, the usage frequency of at least one preheating element is determined and stored in the indicator warehouse.
[0149] From the above, it can be seen that in the application preheating method provided by the embodiment of the present invention, after receiving the preheating request, the service device determines the preheating elements required for preheating of the terminal device, thereby realizing the subsequent preheating operation of the terminal device based on the preheating elements; and the service device, as a device that counts the usage frequency of each preheating element, can also obtain preheating elements that are more in line with the application program when it is running, thereby increasing the availability and reliability of subsequent application program preheating.
[0150] It should be noted that it should be understood that the division of the modules of the two devices involved above is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements. They can also be implemented in the form of hardware. Some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, these modules can be integrated together in whole or in part, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in a processor element or instructions in the form of software.
[0151] Figure 7 The schematic diagram of the structure of an embodiment of the electronic device of the present invention is shown, and the specific embodiment of the present invention does not limit the specific implementation of the electronic device.
[0152] Among them, Figure 7As shown, the electronic device may be the terminal device or service device mentioned above.
[0153] The electronic device may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .
[0154] The processor 702, the communication interface 704, and the memory 706 communicate with each other via the communication bus 708. The communication interface 704 is used to communicate with other devices such as a client or other server network elements. The processor 702 is used to execute the program 710, which can specifically execute the relevant steps in the above method embodiment.
[0155] Specifically, the program 710 may include program code including computer executable instructions.
[0156] The processor 702 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs. They may also be processors of different types, such as one or more CPUs and one or more ASICs.
[0157] The memory 706 is used to store the program 710. The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0158] Program 710 can be specifically called by processor 702 to enable the electronic device to perform the following operations:
[0159] 1. When the electronic device is a terminal device:
[0160] When detecting that an application is started in a terminal device, obtaining at least one type of preheating item, each type of preheating item includes: a preset number of preheating elements of the type with a usage frequency from high to low, the preheating element being an element that requires a preparation operation, a verification operation, a pre-calculation operation, or / and an initialization operation before the application is run;
[0161] A preheating operation is performed on the application program according to at least one type of preheating item.
[0162] In a possible implementation, obtaining at least one type of preheating item includes:
[0163] Sending a preheating request to a service device corresponding to the application, the preheating request is used to trigger the service device to determine a preset number of preheating elements with a high to low usage frequency in at least one type of preheating items in the indicator warehouse;
[0164] A preset number of preheating elements in descending order of usage frequency among at least one type of preheating items sent by a receiving service device.
[0165] In a possible implementation, the type of the preheating item includes at least one of the following:
[0166] Interface verification type, database query type, database script type, function call type, health check type, service interaction type.
[0167] In a possible implementation, the method further includes:
[0168] When detecting that the application is running, obtaining a usage log of the application, wherein the usage log records usage information of at least one preheating element during the running phase of the application;
[0169] A usage log is sent to a service device, where the usage log is used to determine the usage frequency of each preheating element in different types of preheating items in the indicator warehouse.
[0170] In a possible implementation, performing a preheating operation on the application according to at least one type of preheating item includes:
[0171] Preheating the application programs one by one according to each of the preheating elements of a preset number in the preheating items of the at least one type;
[0172] or, performing a preheating operation on the application program simultaneously according to each preheating element of a pre-preset number of preheating items of the at least one type;
[0173] In one possible implementation, the following is also performed:
[0174] If the preheating operation on the application is not completed within the preset time, the preheating operation on the application is stopped.
[0175] 2. When the electronic equipment is a service device, execute:
[0176] Obtain a preheating request sent by a terminal device on which the application is installed;
[0177] According to the preheating request, a preset number of preheating elements with a usage frequency in descending order in at least one type of preheating items are determined in an indicator warehouse of the service device, wherein the usage frequency of each preheating element in different types of preheating items is recorded in the indicator warehouse, and the preheating element is an element that requires preparation operation, verification operation, precalculation operation, or / and initialization operation before the application is run;
[0178] A preset number of preheating elements in descending order of usage frequency in at least one type of preheating items are sent to the terminal device.
[0179] In a possible implementation, the method further includes:
[0180] Obtaining a usage log of an application sent by at least one terminal device, wherein the usage log records usage information of at least one preheating element during a running phase of the application;
[0181] Based on all the acquired usage logs, the usage frequency of at least one preheating element is determined and stored in the indicator warehouse.
[0182] From the above, it can be known that the electronic device provided by the embodiment of the present invention, when the electronic device is a terminal device, can obtain a preset number of preheating elements with a high to low usage frequency when detecting the startup of an application, and use a better resource strategy at startup to improve the efficiency of cold start in the preheating stage; then the obtained preheating elements can be used to preheat the application, so that in the subsequent application running process, the user's business request can be quickly responded to, and the business timeout caused by cold start and other problems can be reduced, thereby improving the availability, rapid response capability, and user experience of the application. When the electronic device is a service device, it can determine the preheating elements required for the preheating of the terminal device after receiving the preheating request, so as to realize the subsequent preheating operation of the terminal device based on the preheating elements; and the service device, as a device for counting the usage frequency of each preheating element, can also obtain preheating elements that are more in line with the corresponding application when it is running, which increases the availability and reliability of the subsequent application when preheating.
[0183] An embodiment of the present invention provides a computer-readable storage medium, which stores at least one executable instruction. When the executable instruction is executed on a device / equipment, the device / equipment executes the application preheating method in any of the above method embodiments.
[0184] The executable instructions may be used to enable the device / equipment to perform the following operations:
[0185] 1. When the device / equipment is a device or terminal device of a terminal device, execute:
[0186] When detecting that an application is started in a terminal device, obtaining at least one type of preheating item, each type of preheating item includes: a preset number of preheating elements of the type with a usage frequency from high to low, the preheating element being an element that requires a preparation operation, a verification operation, a pre-calculation operation, or / and an initialization operation before the application is run;
[0187] A preheating operation is performed on the application program according to at least one type of preheating item.
[0188] In a possible implementation, obtaining at least one type of preheating item includes:
[0189] Sending a preheating request to a service device corresponding to the application, the preheating request is used to trigger the service device to determine a preset number of preheating elements with a high to low usage frequency in at least one type of preheating items in the indicator warehouse;
[0190] A preset number of preheating elements in descending order of usage frequency among at least one type of preheating items sent by a receiving service device.
[0191] In a possible implementation, the type of the preheating item includes at least one of the following:
[0192] Interface verification type, database query type, database script type, function call type, health check type, service interaction type.
[0193] In a possible implementation, the method further includes:
[0194] When detecting that the application is running, obtaining a usage log of the application, wherein the usage log records usage information of at least one preheating element during the running phase of the application;
[0195] A usage log is sent to a service device, where the usage log is used to determine the usage frequency of each preheating element in different types of preheating items in the indicator warehouse.
[0196] In a possible implementation, performing a preheating operation on the application according to at least one type of preheating item includes:
[0197] Preheating the application programs one by one according to each of the preheating elements of a preset number in the preheating items of the at least one type;
[0198] or, performing a preheating operation on the application program simultaneously according to each preheating element of a pre-preset number of preheating items of the at least one type;
[0199] In one possible implementation, the following is also performed:
[0200] If the preheating operation on the application is not completed within the preset time, the preheating operation on the application is stopped.
[0201] 2. When the device / equipment is a device or service equipment of a service equipment, execute:
[0202] Obtain a preheating request sent by a terminal device on which the application is installed;
[0203] According to the preheating request, a preset number of preheating elements with a usage frequency in descending order in at least one type of preheating items are determined in an indicator warehouse of the service device, wherein the usage frequency of each preheating element in different types of preheating items is recorded in the indicator warehouse, and the preheating element is an element that requires preparation operation, verification operation, precalculation operation, or / and initialization operation before the application is run;
[0204] A preset number of preheating elements in descending order of usage frequency in at least one type of preheating items are sent to the terminal device.
[0205] In a possible implementation, the method further includes:
[0206] Obtaining a usage log of an application sent by at least one terminal device, wherein the usage log records usage information of at least one preheating element during a running phase of the application;
[0207] Based on all the acquired usage logs, the usage frequency of at least one preheating element is determined and stored in the indicator warehouse.
[0208] As can be seen from the above, the execution instructions in the computer-readable storage medium provided in the embodiment of the present invention can be specifically used to enable the device / equipment, when the device is a terminal device or the device is a device of a terminal device, to obtain a preset number of preheating elements with a usage frequency from high to low when detecting the startup of an application, and use a better resource strategy at startup to improve the efficiency of cold start in the preheating stage; then the obtained preheating elements can be used to preheat the application, so that in the subsequent application running process, the user's business request can be quickly responded to, and the business timeout caused by cold start and other problems can be reduced, thereby improving the availability, rapid response capability, and user experience of the application. When the device is a service device or the device is a device of a service device, after receiving the preheating request, the preheating elements required for the preheating of the terminal device can be determined, thereby realizing the subsequent preheating operation of the terminal device based on the preheating elements; and the service device, as a device that counts the usage frequency of each preheating element, can also obtain preheating elements that are more in line with the corresponding application when it is running, increasing the availability and reliability of the subsequent application preheating.
[0209] An embodiment of the present invention provides a computer program product, including a computer program, which implements the operations of the above method when executed by a processor.
[0210] Its implementation principle and technical effects are shown in the above disclosure.
[0211] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0212] The methods disclosed in the various method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.
[0213] The features disclosed in the various product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.
[0214] The features disclosed in the various method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0215] It should be noted that the computer-readable storage medium may be a ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM), etc. It may also be various vehicles including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0216] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0217] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0218] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus necessary general hardware nodes, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for a device to execute the methods described in each embodiment of the present invention.
[0219] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices, apparatuses, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0220] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0221] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0222] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A preheating method for application, characterized in that: Applied to a terminal device, the method comprises: When detecting that an application is started in the terminal device, obtaining at least one type of preheating item, each type of preheating item includes: a preset number of preheating elements of the type with a usage frequency from high to low, the preheating elements being elements that require preparation operations, verification operations, precalculation operations, or / and initialization operations before the application is run; According to the at least one type of preheating item, a preheating operation is performed on the application.
2. The method according to claim 1, characterized in that The obtaining of at least one type of preheating item includes: Sending a preheating request to a service device corresponding to the application, wherein the preheating request is used to trigger the service device to determine a preset number of preheating elements of the at least one type of preheating items in an indicator warehouse, with the frequency of use being from high to low; A preset number of preheating elements of at least one type of preheating items sent by the service device are received, with the usage frequency ranging from high to low.
3. The method according to claim 1 or 2, characterized in that: The types of preheating items include at least one of the following: Interface verification type, database query type, database script type, function call type, health check type, service interaction type.
4. The method according to claim 2, characterized in that: The method further comprises: When detecting that the application is running, obtaining a usage log of the application, wherein the usage log records usage information of at least one preheating element during the running phase of the application; The usage log is sent to the service device, where the usage log is used to determine the usage frequency of each preheating element in different types of preheating items in the indicator warehouse.
5. The method according to claim 1 or 2, characterized in that: The preheating operation of the application according to the at least one type of preheating item includes: Preheating the application programs one by one according to each of the preheating elements of a preset number in the preheating items of the at least one type; or, performing a preheating operation on the application program simultaneously according to each preheating element of a pre-preset number of preheating items of the at least one type; The method further comprises: If the preheating operation on the application is not completed within the preset time, the preheating operation on the application is stopped.
6. A preheating method for application, characterized in that: Applied to a service device corresponding to an application program, the method comprises: Obtaining a preheating request sent by a terminal device on which the application is installed; According to the preheating request, a preset number of preheating elements of at least one type of preheating items with a usage frequency in descending order are determined in the indicator warehouse of the service device, wherein the usage frequency of each preheating element in different types of preheating items is recorded in the indicator warehouse, and the preheating element is an element that requires a preparation operation, a verification operation, a precalculation operation, or / and an initialization operation before the application is run; A preset number of preheating elements in descending order of usage frequency in the at least one type of preheating items are sent to the terminal device.
7. The method according to claim 6, characterized in that The method further comprises: Obtaining a usage log of an application sent by at least one terminal device, wherein the usage log records usage information of at least one preheating element during a running phase of the application; The usage frequency of the at least one preheating element is determined according to all the acquired usage logs, and is stored in the indicator warehouse.
8. A preheating device for use, characterized in that: Applied to a terminal device, the device comprises: an acquisition module, configured to acquire at least one type of preheating item upon detecting that an application is started in the terminal device, wherein each type of preheating item includes: a preset number of preheating elements of the type with a usage frequency from high to low, wherein the preheating elements are elements that require preparation operations, verification operations, precalculation operations, or / and initialization operations before the application is run; A processing module is used to perform a preheating operation on the application according to the at least one type of preheating item.
9. A preheating device for use, characterized in that: Applied to a service device corresponding to an application program, the device comprises: An acquisition module, used to acquire a preheating request sent by a terminal device on which the application is installed; a determination module, configured to determine, according to the preheating request, a preset number of preheating elements of a preheating item of at least one type, whose usage frequency is from high to low, in an indicator warehouse of the service device, wherein the usage frequency of each preheating element in different types of preheating items is recorded in the indicator warehouse, and the preheating element is an element that requires a preparation operation, a verification operation, a precalculation operation, or / and an initialization operation before the application is run; The sending module is used to send a preset number of preheating elements in the at least one type of preheating items, with the usage frequency ranging from high to low, to the terminal device.
10. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the operation of the preheating method for application as described in any one of claims 1-7.