Application starting method and device, terminal equipment and computer readable storage medium

CN121523759BActive Publication Date: 2026-10-20JUHAOKAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511574232.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-10-20
Estimated Expiration
2045-10-30

AI Technical Summary

Technical Problem

该情况下,可能会因为系统资源调度(如磁盘I/O资源竞争等)产生线程等待,即部分线程因磁盘繁忙而阻塞,从而增加了应用了启动时间

Benefits of technology

[0006]本申请实施例中,键值长度较短的键值对存储在第一配置文件,键值长度较长的键值对存储在键值对所属的功能模块所述对应的第二配置文件中,通过这种方式,相当于根据键值长度对应用的配置信息进行分类存储,并且对于键值长度较长的键值对根据其所属的功能模块进行分类存储,与仅通过一个配置文件存储所有键值对的方式相比,当某个键值对发生变化需要重新写入时,通过本申请实施例的方式,仅需重写发生变化的键值对所对应的一个配置文件,无需重写所有配置文件,有效减少了冗余写入,利于提高应用启动速度。另外,对于键值长度较长的键值对,根据其所属的功能模块进行分类存储,得到至少一个第二配置文件,与分散存储多个配置文件的方式相比,本申请实施例的方式有效减少了配置文件的数量,这样在应用启动过程中,可以减少读取配置文件的线程数量,进而减少了因线程较多所增加的应用启动时间,从而大大提升了应用的启动速度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121523759B_ABST
    Figure CN121523759B_ABST
Patent Text Reader

Abstract

The application is suitable for the software technical field, and provides an application starting method and device, terminal equipment and computer readable storage medium. In the embodiment of the application, the configuration file storing the key-value pair is classified according to the key-value length of the key-value pair and the function module to which the key-value pair belongs, the problems of too many threads caused by dispersed storage and redundant writing are considered, and the starting speed of the application is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of software technology, and in particular relates to an application startup method, apparatus, terminal device and computer-readable storage medium. Background Technology

[0002] During application startup, threads need to read application configuration information and other data. For example, in Android's data caching mechanism, application configuration information (such as key-value pairs) is stored in a configuration file. During application startup, threads read the configuration file, parse out the key-value pairs, and store them in a map data structure in memory as cached data. Then, they retrieve data from the cached data in memory.

[0003] For some memory-intensive or large-scale applications, the number of configuration files storing key-value pairs is large, and during application startup, many threads will simultaneously read different configuration files. In this case, thread waiting may occur due to system resource scheduling (such as disk I / O resource contention), meaning that some threads are blocked due to disk busyness, thereby increasing application startup time. Summary of the Invention

[0004] This application provides an application startup method, apparatus, terminal device, and computer-readable storage medium, which can greatly improve application startup speed.

[0005] In a first aspect, embodiments of this application provide an application launch method, including: During the startup process of the first application, a first configuration file of the first application is obtained from the service side of the system; wherein, the service side also includes at least one second configuration file of the first application; the first configuration file includes key-value pairs in the configuration information of the first application whose key-value length is less than a preset threshold; the second configuration file includes key-value pairs in the configuration information of the first application whose key-value length is greater than the preset threshold, and the key-value pairs included in the same second configuration file belong to the same functional module in the first application; each key-value pair includes a key name and a key value; For the first key-value pair in the configuration information of the first application, if the first key-value pair does not exist in the first configuration file, then the third configuration file corresponding to the functional module to which the first key-value pair belongs is obtained from at least one second configuration file of the first application. If the first key-value pair exists in the third configuration file, then the key value of the first key-value pair in the third configuration file is returned to the business side of the system.

[0006] In this embodiment, short key-value pairs are stored in a first configuration file, while longer key-value pairs are stored in a second configuration file corresponding to the functional module to which they belong. This effectively categorizes and stores application configuration information based on key-value length. Furthermore, for longer key-value pairs, categorizing them by their functional module reduces redundant writing compared to storing all key-value pairs in a single configuration file. When a key-value pair changes and needs to be rewritten, this embodiment only requires rewriting the configuration file corresponding to the changed key-value pair, eliminating the need to rewrite all configuration files and improving application startup speed. Additionally, categorizing longer key-value pairs by their functional module to obtain at least one second configuration file reduces the number of configuration files compared to storing multiple files in a scattered manner. This reduces the number of threads reading configuration files during application startup, thereby reducing the application startup time caused by a large number of threads and significantly improving application startup speed.

[0007] In one possible implementation of the first aspect, after obtaining the first configuration file of the first application in the service side of the system, the method further includes: If the first key-value pair exists in the first configuration file, then the key value of the first key-value pair in the first configuration file is returned to the service side.

[0008] In one possible implementation of the first aspect, obtaining the third configuration file corresponding to the functional module to which the first key-value pair belongs from at least one second configuration file of the first application includes: Obtain the key name of the first key-value pair to get the first key name; wherein, the first key name includes a first field, the first field being used to indicate the functional module to which the first key-value pair belongs in the first application; Based on the first field, search for a third configuration file in at least one second configuration file of the first application that matches the first key name; Read the third configuration file.

[0009] In one possible implementation of the first aspect, the step of searching for a third configuration file matching the first key name in at least one second configuration file of the first application based on the first field includes: Obtain the filename of each of the second configuration files; wherein the filename of each of the second configuration files includes a second field, which is used to indicate the functional module corresponding to the third configuration file; The second configuration file corresponding to the second field that matches the first field is used as the third configuration file.

[0010] In this embodiment, a special field in the key name of the key-value pair is set to indicate the functional module to which the key-value pair belongs. Similarly, a special field is set in the name of the configuration file to indicate the functional module corresponding to the configuration file. This method facilitates quick lookup of key-value pairs, improves the writing and reading efficiency of key-value pairs, and thus helps to improve application startup speed.

[0011] In one possible implementation of the first aspect, after obtaining the key value of the first key-value pair in the third configuration file, the method further includes: If the key value in the first key-value pair changes, a second key-value pair is generated based on the key name of the first key-value pair and the latest key value of the first key-value pair. Write the second key-value pair into the third configuration file.

[0012] Because the configuration files for the first application are categorized according to the length of the key-value pairs and the module to which they belong during the writing process, only the configuration file corresponding to the key-value pair needs to be updated when the key-value pair is updated. There is no need to update all the configuration files of the first application, thus avoiding the thundering herd effect and effectively improving the efficiency of updating configuration information.

[0013] In one possible implementation of the first aspect, the method further includes: Obtain the third key-value pair of the first application; If the key length of the third key-value pair is greater than the preset threshold, then it is determined whether the third key-value pair exists in the first configuration file; If the third key-value pair exists in the first configuration file, then delete the third key-value pair from the first configuration file; Obtain the fourth configuration file corresponding to the functional module to which the third key-value pair belongs from at least one second configuration file of the first application; Write the third key-value pair into the fourth configuration file.

[0014] In one possible implementation of the first aspect, the method further includes: If the key length of the third key-value pair is less than the preset threshold, then the third key-value pair is written into the first configuration file.

[0015] In one possible implementation of the first aspect, the method further includes: If at least one second configuration file of the first application does not contain a fourth configuration file corresponding to the functional module to which the third key-value pair belongs, then the key name of the third key-value pair is obtained to obtain a second key name; wherein, the second key name includes a third field, the third field being used to indicate the functional module to which the third key-value pair belongs in the first application; The fourth configuration file is created based on the second key name; Write the third key-value pair into the fourth configuration file.

[0016] In this embodiment, the multiple scattered configuration files of the first application can be classified into 1+M configuration files, where M is less than or equal to the number of functional modules N of the first application. In practical applications, the number of key-value pairs exceeding a preset threshold is relatively small, i.e., the value of M is small, thus the number of configuration files for the first application is small. This reduces the number of threads reading configuration files during application startup, thereby reducing the application startup time caused by a large number of threads and significantly improving the application startup speed.

[0017] Secondly, embodiments of this application provide an application launching device, including: The first reading unit is used to obtain a first configuration file of the first application in the system's server side during the startup process of the first application; wherein the server side further includes at least one second configuration file of the first application; the first configuration file includes key-value pairs in the configuration information of the first application whose key-value length is less than a preset threshold; the second configuration file includes key-value pairs in the configuration information of the first application whose key-value length is greater than the preset threshold, and the key-value pairs included in the same second configuration file belong to the same functional module in the first application; each key-value pair includes a key name and a key value; The second reading unit is used to, for the first key-value pair in the configuration information of the first application, if the first key-value pair does not exist in the first configuration file, obtain the third configuration file corresponding to the functional module to which the first key-value pair belongs from at least one second configuration file of the first application; The acquisition unit is configured to return the key value of the first key value pair in the third configuration file to the service side of the system if the first key value pair exists in the third configuration file.

[0018] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the application launch method as described in any one of the first aspects above.

[0019] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the application startup method as described in any one of the first aspects above.

[0020] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the application startup method described in any one of the first aspects.

[0021] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of the software architecture of the terminal device provided in the embodiments of this application; Figure 2 This is a schematic diagram of the interactive flow of the application startup process provided in the embodiments of this application; Figure 3 This is a schematic diagram of the interactive flow of the application startup process provided in another embodiment of this application; Figure 4 This is a flowchart illustrating the key-value pair writing process provided in the embodiments of this application; Figure 5 This is a flowchart illustrating the configuration file reading process provided in an embodiment of this application; Figure 6 This is a schematic diagram of the interactive flow of the application startup process provided in the embodiments of this application; Figure 7 This is a structural block diagram of the application launching device provided in the embodiments of this application; Figure 8 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. Detailed Implementation

[0024] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0025] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0026] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0027] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0028] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0029] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0030] The application launch method provided in this application can be applied to terminal devices, which can also be called terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablets, smart screens, computers with wireless transceiver capabilities, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and so on. The embodiments of this application do not limit the specific technologies or device forms used in the electronic devices.

[0031] Terminal devices run operating systems, such as iOS, Android (an open-source operating system), and Windows. Applications can be installed and run on these operating systems.

[0032] The following example illustrates the software architecture of a terminal device. See also... Figure 1 This is a schematic diagram of the software architecture of the terminal device provided in the embodiments of this application. Figure 1 As shown, the software architecture of a terminal device includes a business side and a service side. The business side is the functional implementation layer directly facing the user or specific scenarios, and may include a series of applications. The service side is the "underlying support" of the business side, providing capability support for the implementation of its functions. For example, the service side may include a startup manager module, which provides application startup management services.

[0033] During application startup, threads need to read application configuration information and other data. For example, in Android's data caching mechanism, application configuration information (such as key-value pairs) is stored in a configuration file. During application startup, threads read the configuration file, parse out the key-value pairs, and store them in a map data structure in memory as cached data. Then, they retrieve data from the cached data in memory.

[0034] In one example, see Figure 2 This is a schematic diagram of the interactive flow of the application startup process provided in the embodiments of this application. For example... Figure 2 As shown, during the write process, the business-side functional module 1 sends the key-value pair (key1, value1) to the service side (e.g., ...). Figure 2 As shown in the SaveString(key1, value1) example, the server writes the key-value pair (key1, value1) to configuration file 1. The business-side functional module 2 sends the key-value pair (key2, value2) to the server (e.g., ...). Figure 2 As shown in SaveString(key2, value2) , the server side will write the key-value pair (key2, value2) to configuration file 1.

[0035] During the reading process, the business side sends the key name of the key-value pair to the service side (e.g., ...). Figure 2 As shown in key3 and key4, the service side reads the key-value pairs corresponding to the key names from configuration file 1 and returns them to the business side, such as key3 corresponding to key3 (key3, value3) and key4 corresponding to key4 (key4, value4).

[0036] exist Figure 2 In the example, all key-value pairs in the first application are written to the same configuration file (configuration file 1). In this way, when a key-value pair changes and needs to be rewritten, the entire configuration file, i.e. all key-value pairs, needs to be rewritten, resulting in redundant writing, which increases the writing speed and thus affects the application startup speed.

[0037] See another example. Figure 3 This is a schematic diagram of the interactive flow of the application startup process provided in another embodiment of this application. Figure 3 As shown, during the write process, the business-side functional module 1 sends the key-value pair (key1, value1) to the service side (e.g., ...). Figure 3 As shown in the SaveString(key1, value1) example, the server writes the key-value pair (key1, value1) to configuration file 1. The business-side functional module 2 sends the key-value pair (key2, value2) to the server (e.g., ...). Figure 3 As shown in the SaveString(key2, value2) example, the server writes the key-value pair (key2, value2) to configuration file 2. The business-side functional module N sends the key-value pair (keyN, valueN) to the server (e.g., ...). Figure 3As shown in SaveString(keyN, valueN) , the server side will write the key-value pair (keyN, valueN) to the configuration file N.

[0038] During the reading process, the business-side functional module 1 sends the key name key3 (e.g., key3) of the key-value pair to the service side. Figure 3 As shown in `getString(key3)`, the server reads the key-value pair 3 (key3, value3) corresponding to key3 from configuration file 1 and returns it to functional module 1 on the business side. Functional module 2 on the business side sends the key name key4 (e.g., key3, value3) of the required key-value pair to the server side. Figure 3 As shown in `getString(key4)`, the server reads the key-value pair 4 (key4, value4) corresponding to key4 from configuration file 2 and returns it to the functional module 2 on the business side. The functional module N on the business side sends the key name key5 of the required key-value pair to the server (e.g., ...) Figure 3 As shown in getString(key5)), the corresponding key-value pair 5(key5, value5) corresponding to key5 is read from the configuration file N and returned to the functional module N on the business side.

[0039] exist Figure 3 In the example, the key-value pairs in the first application's configuration information are scattered across different configuration files, resulting in a large number of configuration files. This is especially problematic for memory-intensive or large-scale applications, which often have numerous configuration files storing key-value pairs. During application startup, many threads will simultaneously read these different configuration files. In this case, thread waiting may occur due to system resource scheduling issues (such as disk I / O resource contention), meaning some threads may be blocked due to disk congestion, thus increasing application startup time.

[0040] Based on this, this application provides an application startup method. In this application, the configuration files storing key-value pairs are classified according to the key-value length and the functional module to which the key-value pairs belong. This takes into account the problems of a large number of threads and redundant writes caused by distributed storage, and greatly improves the application startup speed.

[0041] The application startup method provided in this application embodiment is described below. As mentioned above, application startup involves two processes: writing and reading configuration files. The process of writing configuration files is described first.

[0042] See Figure 4 This is a flowchart illustrating the key-value pair writing process provided in an embodiment of this application. It is intended as an example and not a limitation. Figure 4 As shown, the process of writing key-value pairs may include the following steps: S101, the service side stores the key-value pairs in the configuration information required to start the first application into the service side, and the service side receives the key-value pairs sent by the service side.

[0043] Optionally, the business side can call a function interface for saving data to send key-value pairs to the service side. For example, the business side sends key-value pairs to the service side through the save interface, where the save interface is used to store the business side's data (such as configuration information, business data, and temporary state data) in a specified location on the service side (such as a file or cache) to ensure that the data is not lost after the device restarts or the application exits.

[0044] In one implementation, the business side can send key-value pairs to the startup manager on the service side, and the startup manager will execute the following steps S102-S106.

[0045] In this embodiment, each key-value pair includes a key and a value. The key uniquely identifies a set of data, and the value is the data itself identified by the key, i.e., the specific content. During application startup, the key-value pair represents the application's configuration information.

[0046] Each application can include multiple functional modules, and each functional module includes key-value pairs representing its configuration information. For example, the key-value pairs for the application's basic configuration module can represent the basic environment parameters for application startup. The key-value pairs for the application's network module can represent data such as initializing network connections and domain names. The key-value pairs for the application's storage module can represent data such as the application's local storage path and cache size. The key-value pairs for the application's logging module can represent the application's historical data.

[0047] S102, for the third key-value pair of the first application, the server side determines whether the key-value length of the third key-value pair is greater than a preset threshold.

[0048] The third key-value pair can be any key-value pair from the configuration information of the first application.

[0049] The preset threshold can be set according to actual needs. For example, the preset threshold can be set to 1KB.

[0050] S103, if the key length of the third key-value pair is less than or equal to a preset threshold, the service side stores the third key-value pair in the first configuration file.

[0051] It is understandable that the first configuration file is equivalent to a common startup file, which includes key-value pairs in the configuration information of the first application whose key-value length is less than or equal to a preset threshold. These key-value pairs may belong to different functional modules of the first application.

[0052] S104, if the key length of the third key-value pair is greater than the preset threshold, the service side determines whether the third key-value pair exists in the first configuration file.

[0053] If the first configuration file contains a third key-value pair, execute S105; if the first configuration file does not contain a third key-value pair, execute S106.

[0054] S105, if the first configuration file contains a third key-value pair, the server deletes the third key-value pair from the first configuration file.

[0055] This step avoids redundant key-value pair storage, as the data is stored in both the first and second configuration files simultaneously. This reduces repeated readings during configuration file retrieval and improves application startup speed.

[0056] S106, the server obtains the fourth configuration file corresponding to the functional module to which the third key-value pair belongs from at least one second configuration file of the first application.

[0057] The service side includes not only the first configuration file, but also at least one second configuration file of the first application; the second configuration file includes key-value pairs in the configuration information of the first application whose key-value length is greater than a preset threshold, and the key-value pairs included in the same second configuration file belong to the same functional module in the first application.

[0058] Optionally, the key name in each key-value pair may include two fields. One field indicates the functional module to which the key-value pair belongs in the first application, and the other field can be a unique identifier for the key-value pair, such as the specific application scenario or function name. For example, the key name can be a module-function structure, where module is one field and function is the other.

[0059] Optionally, the filename of each second configuration file includes a second field, which is used to indicate the functional module corresponding to the second configuration file.

[0060] In one implementation, S106 may include: the server obtaining the second field of the filename of each second configuration file of the first application; determining whether each second field matches the third field of the key name of the third key-value pair, wherein the third field is used to indicate the functional module to which the third key-value pair belongs in the first application; if a certain second field matches the third field of the key name of the third key-value pair, then the second configuration file corresponding to the second field is recorded as the fourth configuration file.

[0061] Optionally, the steps for creating the fourth configuration file may include: using the third field of the key name in the third key-value pair as the second field of the filename of the fourth configuration file, generating the filename of the fourth configuration file based on the second field, and creating the fourth configuration file based on the filename.

[0062] S107, the server stores the third key-value pair in the fourth configuration file corresponding to the third key-value pair.

[0063] In this embodiment, a special field in the key name of the key-value pair is set to indicate the functional module to which the key-value pair belongs. Similarly, a special field is set in the name of the configuration file to indicate the functional module corresponding to the configuration file. This method facilitates quick lookup of key-value pairs, improves the writing and reading efficiency of key-value pairs, and thus helps to improve application startup speed.

[0064] It is understandable that during the first few startups of the first application, the configuration information of some functional modules may not be involved, so the configuration file of the first application may not contain the second configuration file corresponding to those modules. However, as the number of startups of the first application increases, key-value pairs of configuration information for all functional modules of the first application are written to the configuration file. Therefore, the configuration file of the first application includes the first configuration file and the second configuration file corresponding to each functional module.

[0065] The above Figure 1 The steps described in the embodiments describe the process of writing configuration information for the first application. The process of writing configuration information for other applications is based on the same principle as that for the first application, and will not be repeated here. It should be noted that each application corresponds to one first configuration file and at least one second configuration file. For example, the first and second configuration files of the first application store key-value pairs of configuration information for the first application, and the first and second configuration files of the second application store key-value pairs of configuration information for the second application.

[0066] Optionally, for String type data, execute S101-S107 above; for non-String type data, the key-value length is usually short, so non-String type data can be directly stored in the first configuration file.

[0067] pass Figure 1In the writing process described in this embodiment, the multiple scattered configuration files of the first application can be categorized into 1+M configuration files, where M is less than or equal to the number of functional modules N of the first application. In practical applications, the number of key-value pairs exceeding a preset threshold is relatively small, i.e., the value of M is small, resulting in a smaller number of configuration files for the first application. This reduces the number of threads reading configuration files during application startup, thereby reducing the application startup time caused by a large number of threads and significantly improving the application startup speed.

[0068] In some embodiments, the writing process may further include: If the key value of a key-value pair in a second configuration file of the first application changes, the second configuration file is rewritten, such as generating a new key-value pair based on the key name and the latest key value of the key-value pair; and writing the new key-value pair into the second configuration file. If the key value of a key-value pair in the first configuration file of the first application changes, the first configuration file is rewritten, such as generating a new key-value pair based on the key name of the key-value pair and the latest key value of the key-value pair; the new key-value pair is then written into the first configuration file.

[0069] For example, if the first key-value pair is (key1, value1), and its key-value pair value1 is changed to value2, then the generated second key-value pair will be (key1, value2).

[0070] Because the configuration files for the first application are categorized according to the length of the key-value pairs and the module to which they belong during the writing process, only the configuration file corresponding to the key-value pair needs to be updated when the key-value pair is updated. There is no need to update all the configuration files of the first application, thus avoiding the thundering herd effect and effectively improving the efficiency of updating configuration information.

[0071] Based on the above writing process, the following describes the configuration file reading process.

[0072] See Figure 5 This is a flowchart illustrating the configuration file reading process provided in an embodiment of this application. It is intended as an example and not a limitation. Figure 5 As shown, the process of reading the configuration file may include the following steps: S201, during the startup process of the first application, obtain the first configuration file of the first application from the server side of the system.

[0073] The first configuration file includes key-value pairs in the configuration information of the first application whose key-value length is less than a preset threshold. Each key-value pair includes a key name and a key value. For example... Figure 4As described in the embodiment, the service side also includes at least one second configuration file of the first application. The second configuration file includes key-value pairs in the configuration information of the first application whose key-value length is greater than the preset threshold, and the key-value pairs included in the same second configuration file belong to the same functional module in the first application.

[0074] It is understandable that the first configuration file is pre-loaded, meaning that the first configuration file has been loaded into memory. Therefore, S201-S202 are executed in memory, and the reading speed of this process is relatively fast.

[0075] S202, for the first key-value pair in the configuration information of the first application, the server side determines whether the first key-value pair exists in the first configuration file.

[0076] If the first key-value pair exists in the first configuration file, then execute S205; if the first key-value pair does not exist in the first configuration file, then execute S203-S204.

[0077] S203, if the first key-value pair does not exist in the first configuration file, the service side obtains the third configuration file corresponding to the functional module to which the first key-value pair belongs from at least one second configuration file of the first application.

[0078] In one implementation, S203 may include: Get the key name of the first key-value pair; wherein, the first key name includes a first field, which is used to indicate the functional module to which the first key-value pair belongs in the first application; Based on the first field, search for a third configuration file that matches the first key name in at least one second configuration file of the first application; Read the third configuration file.

[0079] Optionally, the process of finding a third profile that matches the first key name may include: Obtain the filename of each of the second configuration files; wherein the name of each second configuration file includes a second field, which is used to indicate the functional module corresponding to the second configuration file; the second configuration file corresponding to the second field that matches the first field is taken as the third configuration file.

[0080] In this embodiment, a special field in the key name of the key-value pair is set to indicate the functional module to which the key-value pair belongs. Similarly, a special field is set in the name of the configuration file to indicate the functional module corresponding to the configuration file. This method facilitates quick lookup of key-value pairs, improves the reading efficiency of key-value pairs, and thus helps to improve application startup speed.

[0081] S204, If the first key-value pair exists in the third configuration file, the service side will return the key value of the first key-value pair in the third configuration file to the business side of the system.

[0082] If the first key-value pair does not exist in the third configuration file, the default value is returned. Understandably, if the third configuration file does not exist, a thread will not be started to read it.

[0083] S205, if the first key-value pair exists in the first configuration file, the service side will return the key-value pair of the first key-value pair in the first configuration file to the business side.

[0084] See Figure 6 This is a schematic diagram of the interactive flow of the application startup process provided in the embodiments of this application. For example... Figure 6 As shown, during the write process, the business-side functional module 1 sends the key-value pair (module1_key1, value1) to the service side (e.g., ...). Figure 6 The code snippet shows `SaveString(module1_key1, value1)`. Correspondingly, the server checks if the key-value pair 1's key value is less than a preset threshold. If `value1` is less than the preset threshold, the server writes key-value pair 1 (module1_key1, value1) to the first configuration file. The business-side functional module 2 sends key-value pair 2 (key2, value2) to the server (e.g., ...). Figure 6 The code shows SaveString(module2_key2, value2); correspondingly, the server side determines whether the key value of key-value pair 2 is less than a preset threshold; where, if value2 is greater than the preset threshold, the server side first checks whether key-value pair 2 exists in the first configuration file; if it exists, the server side deletes key-value pair 2 from the first configuration file and writes key-value pair 2(module2_key2, value2) into the second configuration file corresponding to functional module 2 (i.e., the configuration file corresponding to the functional module module2 to which key-value pair 2 belongs).

[0085] During the reading process, the business-side functional module 1 sends the key name of the key-value pair 3 to the service side. The key name includes a field indicating the functional module to which key-value pair 3 belongs (e.g., ...). Figure 6 As shown in module1_key3, where module1 is a field used to indicate the functional module to which key-value pair 3 belongs; accordingly, the service side first reads and caches the first configuration file, and determines whether key-value pair 3 exists in the first configuration file; if it exists, key-value pair 3 in the first configuration file is returned to the business side; if it does not exist, the second configuration file corresponding to the functional module 1 to which key-value pair 3 belongs is obtained from at least one second configuration file of the first application, and key-value pair 3 in the second configuration file corresponding to functional module 1 is returned to the business side.

[0086] Similarly, the business-side functional module 2 sends the key name of the key-value pair 4 to the service side, where the key name includes a field indicating the functional module to which the key-value pair 4 belongs (e.g., ...). Figure 6 As shown in module2_key4, where module2 is a field used to indicate the functional module to which key-value pair 4 belongs; accordingly, the service side first reads and caches the first configuration file, and determines whether key-value pair 3 exists in the first configuration file; if it exists, key-value pair 4 in the first configuration file is returned to the business side; if it does not exist, the second configuration file corresponding to the functional module 2 to which key-value pair 4 belongs is obtained from at least one second configuration file of the first application, and key-value pair 4 in the second configuration file corresponding to functional module 2 is returned to the business side.

[0087] In this embodiment, shorter key-value pairs are stored in a first configuration file, while longer key-value pairs are stored in a second configuration file corresponding to the functional module to which they belong. This method effectively categorizes and stores application configuration information based on key-value length, and further categorizes longer key-value pairs based on their respective functional modules. Figure 2 Compared to the method shown in this application, which stores all key-value pairs in a single configuration file, when a key-value pair changes and needs to be rewritten, the method in this application embodiment only requires rewriting the configuration file corresponding to the changed key-value pair, instead of rewriting all configuration files. This effectively reduces redundant writing and helps improve application startup speed.

[0088] Secondly, for key-value pairs with long key-value lengths, they are categorized and stored according to their functional modules, resulting in at least one second configuration file. Figure 3 Compared to the distributed storage of multiple configuration files shown elsewhere, the method in this embodiment effectively reduces the number of configuration files. This reduces the number of threads reading configuration files during application startup, thereby reducing the increased application startup time caused by a larger number of threads and significantly improving application startup speed. Furthermore, this embodiment uses a special field in the key name of the key-value pair to indicate the functional module to which the key-value pair belongs, and similarly, a special field is set in the configuration file name to indicate the corresponding functional module. This method facilitates quick lookup of key-value pairs, improves the efficiency of key-value pair reading, and thus enhances application startup speed.

[0089] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0090] Corresponding to the application launch method described in the above embodiments, Figure 7 This is a structural block diagram of the application launching device provided in the embodiments of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0091] Reference Figure 7 The device includes: The first reading unit 71 is used to obtain a first configuration file of the first application in the service side of the system during the startup process of the first application; wherein the service side further includes at least one second configuration file of the first application; the first configuration file includes key-value pairs in the configuration information of the first application whose key-value length is less than a preset threshold; the second configuration file includes key-value pairs in the configuration information of the first application whose key-value length is greater than the preset threshold, and the key-value pairs included in the same second configuration file belong to the same functional module in the first application; each key-value pair includes a key name and a key value.

[0092] The second reading unit 72 is used to, for the first key-value pair in the configuration information of the first application, if the first key-value pair does not exist in the first configuration file, obtain the third configuration file corresponding to the functional module to which the first key-value pair belongs from at least one second configuration file of the first application.

[0093] The acquisition unit 73 is used to return the key value of the first key value pair in the third configuration file to the service side of the system if the first key value pair exists in the third configuration file.

[0094] Optionally, the acquisition unit 73 is also used for: If the first key-value pair exists in the first configuration file, then the key value of the first key-value pair in the first configuration file is returned to the service side.

[0095] Optionally, the second reading unit 72 is also used for: Obtain the key name of the first key-value pair to get the first key name; wherein, the first key name includes a first field, the first field being used to indicate the functional module to which the first key-value pair belongs in the first application; Based on the first field, search for a third configuration file in at least one second configuration file of the first application that matches the first key name; Read the third configuration file.

[0096] Optionally, the second reading unit 72 is also used for: Obtain the filename of each of the second configuration files; wherein, the name of each second configuration file includes a second field, which is used to indicate the functional module corresponding to the second configuration file; The second configuration file corresponding to the second field that matches the first field is used as the third configuration file.

[0097] Optionally, device 7 also includes: The writing unit 74 is configured to generate a second key-value pair based on the key name of the first key-value pair and the latest key value of the first key-value pair if the key value in the first key-value pair changes; and write the second key-value pair into the third configuration file.

[0098] Optionally, the write unit 74 is also used for: Obtain the third key-value pair of the first application; If the key length of the third key-value pair is greater than the preset threshold, then it is determined whether the third key-value pair exists in the first configuration file; If the third key-value pair exists in the first configuration file, then delete the third key-value pair from the first configuration file; Obtain the fourth configuration file corresponding to the functional module to which the third key-value pair belongs from at least one second configuration file of the first application; Write the third key-value pair into the fourth configuration file.

[0099] Optionally, the write unit 74 is also used for: If the key length of the third key-value pair is less than the preset threshold, then the third key-value pair is written into the first configuration file.

[0100] Optionally, the write unit 74 is also used for: If at least one second configuration file of the first application does not contain a fourth configuration file corresponding to the functional module to which the third key-value pair belongs, then the key name of the third key-value pair is obtained to obtain a second key name; wherein, the second key name includes a third field, the third field being used to indicate the functional module to which the third key-value pair belongs in the first application; The fourth configuration file is created based on the second key name; Write the third key-value pair into the fourth configuration file.

[0101] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0102] in addition, Figure 7 The application launch device shown can be a software unit, hardware unit, or a combination of software and hardware built into an existing terminal device, or it can be integrated into the terminal device as an independent component, or it can exist as an independent terminal device.

[0103] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0104] Figure 8 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. For example... Figure 8 As shown, the terminal device 8 of this embodiment includes: at least one processor 80 ( Figure 8 (Only one is shown in the diagram) a processor, a memory 81, and a computer program 82 stored in the memory 81 and executable on the at least one processor 80, wherein the processor 80 executes the computer program 82 to implement the steps in any of the above-described application startup method embodiments.

[0105] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. This terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 8 This is merely an example of terminal device 8 and does not constitute a limitation on terminal device 8. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0106] The processor 80 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0107] In some embodiments, the memory 81 may be an internal storage unit of the terminal device 8, such as a hard disk or memory of the terminal device 8. In other embodiments, the memory 81 may be an external storage device of the terminal device 8, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the terminal device 8. Furthermore, the memory 81 may include both internal and external storage units of the terminal device 8. The memory 81 is used to store the operating system, applications, boot loader, data, and other programs, such as the program code of the computer program. The memory 81 can also be used to temporarily store data that has been output or will be output.

[0108] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the above-described method embodiments.

[0109] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments.

[0110] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / terminal equipment, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0111] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0112] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0113] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0114] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0115] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An application launch method, characterized in that, include: During the startup process of the first application, a first configuration file of the first application is obtained from the service side of the system; wherein, the service side also includes at least one second configuration file of the first application; the first configuration file includes key-value pairs in the configuration information of the first application whose key-value length is less than a preset threshold; the second configuration file includes key-value pairs in the configuration information of the first application whose key-value length is greater than the preset threshold, and the key-value pairs included in the same second configuration file belong to the same functional module in the first application; each key-value pair includes a key name and a key value; For the first key-value pair in the configuration information of the first application, if the first key-value pair does not exist in the first configuration file, then the third configuration file corresponding to the functional module to which the first key-value pair belongs is obtained from at least one second configuration file of the first application. If the first key-value pair exists in the third configuration file, then the key value of the first key-value pair in the third configuration file is returned to the business side of the system.

2. The application launch method as described in claim 1, characterized in that, After obtaining the first configuration file of the first application in the service side of the system, the method further includes: If the first key-value pair exists in the first configuration file, then the key value of the first key-value pair in the first configuration file is returned to the service side.

3. The application launch method as described in claim 1, characterized in that, The step of obtaining the third configuration file corresponding to the functional module to which the first key-value pair belongs from at least one second configuration file of the first application includes: Obtain the key name of the first key-value pair to get the first key name; wherein, the first key name includes a first field, which is used to indicate the functional module to which the first key-value pair belongs in the first application; Based on the first field, search for a third configuration file in at least one second configuration file of the first application that matches the first key name; Read the third configuration file.

4. The application launch method as described in claim 3, characterized in that, The step of searching for a third configuration file that matches the first key name in at least one second configuration file of the first application based on the first field includes: Obtain the filename of each of the second configuration files; wherein the filename of each of the second configuration files includes a second field, the second field being used to indicate the functional module corresponding to the second configuration file; The second configuration file corresponding to the second field that matches the first field is used as the third configuration file.

5. The application launch method as described in claim 1, characterized in that, After obtaining the key value of the first key-value pair in the third configuration file, the method further includes: If the key value in the first key-value pair changes, a second key-value pair is generated based on the key name of the first key-value pair and the latest key value of the first key-value pair. Write the second key-value pair into the third configuration file.

6. The application launch method as described in claim 1, characterized in that, The method further includes: Obtain the third key-value pair from the first application; If the key length of the third key-value pair is greater than the preset threshold, then it is determined whether the third key-value pair exists in the first configuration file; If the third key-value pair exists in the first configuration file, then delete the third key-value pair from the first configuration file; Obtain the fourth configuration file corresponding to the functional module to which the third key-value pair belongs from at least one second configuration file of the first application; Write the third key-value pair into the fourth configuration file.

7. The application launch method as described in claim 6, characterized in that, The method further includes: If the key length of the third key-value pair is less than the preset threshold, then the third key-value pair is written into the first configuration file.

8. The application launch method as described in claim 6, characterized in that, The method further includes: If at least one second configuration file of the first application does not contain a fourth configuration file corresponding to the functional module to which the third key-value pair belongs, then the key name of the third key-value pair is obtained to obtain a second key name; wherein, the second key name includes a third field, the third field being used to indicate the functional module to which the third key-value pair belongs in the first application; The fourth configuration file is created based on the second key name; Write the third key-value pair into the fourth configuration file.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and device for data access, electronic apparatus and storage medium

    US20250036302A1

  • Configuration file processing method, apparatus and system, and storage medium

    WO2021121188A1