An update loading method based on dynamic isolation
By obtaining the library status of the dependent library to be selected, determining the dependent library selection method and filtering, the problem of not considering the dependency complexity and historical usage effect in the existing technology is solved, and a more accurate dependent library selection and a more efficient loading process are achieved.
Patent Information
- Application Number
- CN202410962023.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-07-18
AI Technical Summary
The prior art fails to effectively consider the dependency complexity and historical use effect of the third-party library to be selected, resulting in an increase in the probability of dependency conflicts in the selected third-party library, which in turn leads to the waste of data processing resources.
By obtaining the library status of the dependent library to be selected, determine the method of selecting the dependent library, including filtering according to the dependent library update frequency or complex reference value, selecting the first preparatory dependent library, and performing secondary filtering to select the target dependent library, and finally selecting direct loading or environmental isolation loading based on whether there is a dependency conflict in the dependent library.
Effectively reflect the complexity and distribution of the dependent library, improve the accuracy of the selection of dependent library, reduce the probability of dependency conflict, improve loading efficiency, and avoid resource waste.
Smart Images

Figure CN118885233B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software development, and in particular to an update loading method based on dynamic isolation. Background Art
[0002] During the software development process, developers use a large number of third-party libraries to achieve code reuse. There are dependencies between different third-party libraries. Incompatibility between third-party libraries will cause errors in the installation, loading, and calling of third-party libraries, which will in turn cause system abnormalities. This type of problem is called a third-party library dependency conflict problem. At present, the most common solution to this type of problem is to use environment isolation for loading. However, as the number of isolated environments increases, the complexity of managing these environments will also increase. More environment configurations and dependencies need to be tracked. Each isolated environment may require independent resources, resulting in a significant increase in resource consumption. Therefore, how to select a better third-party library in the dynamic isolation update loading process is an urgent problem to be solved by technical personnel in this field.
[0003] Chinese Patent Publication No. CN115495058A discloses a method, device and related equipment for recommending a third-party library, the method includes obtaining historical data and multiple third-party libraries, the historical data includes a record of the reference software replacing the third-party library to be processed with any third-party library in the multiple third-party libraries. Then, based on the acquired historical data, a target third-party library is determined from multiple third-party libraries, and the target third-party library is used to replace the third-party library to be processed called by the target software, thereby presenting the determined target third-party library. It can be seen that the above technical solution has the following problems: the dependency complexity and historical usage effect of the third-party library to be selected are not taken into account, resulting in an increased probability of dependency conflicts in the selected third-party library, which in turn leads to a waste of data processing resources. Summary of the invention
[0004] To this end, the present invention provides an update loading method based on dynamic isolation to overcome the problem that the prior art fails to take into account the dependency complexity and historical usage effects of the third-party library to be selected, resulting in an increased probability of dependency conflicts in the selected third-party library, thereby leading to a waste of data processing resources.
[0005] To achieve the above object, the present invention provides an update loading method based on dynamic isolation, comprising:
[0006] Obtain the dependent library to be selected, and determine the library status according to the complex comparison value of the dependent library and the complex reference value of the dependent library;
[0007] Determine a method for selecting a dependent library according to the library status of the dependent library to be selected, including screening the dependent library according to the update frequency of the dependent library, or screening the dependent library according to the complex reference value of the dependent library;
[0008] Selecting a plurality of first prepared dependent libraries in response to different dependent library selection modes;
[0009] When the number of the first prepared dependent libraries is less than or equal to the preset number or when there is a dependent library complexity reference value greater than or equal to the preset dependent library complexity reference value, a secondary screening of the first prepared dependent library is performed;
[0010] In the secondary screening, the secondary screening benchmark is determined according to the API usage bias, and the target dependency library is selected based on the secondary screening benchmark;
[0011] The final dependency library is determined for the target dependency library, and direct loading or environment isolation loading is selected based on whether there is a dependency conflict in the final dependency library.
[0012] Further, the dependent library to be selected corresponding to the target to be updated is obtained, and the dependent library selection method is determined according to the library status of the dependent library to be selected;
[0013] If the library state is the first preset library state, the dependent library selection method is to screen the dependent library according to the dependent library update frequency;
[0014] If the library state is the second preset library state, the dependent library is screened according to the dependent library complex reference value.
[0015] Further, the library state includes a first preset library state and a second preset library state;
[0016] The first preset library state is that the dependent library complex comparison value is within the preset complex comparison value range, or the dependent library complex reference value is less than or greater than the preset dependent library complex reference value;
[0017] The second preset library status is that the dependent library complex comparison value is within the difference complex comparison value range, and the dependent library complex reference value is not all less than or greater than the preset dependent library complex reference value.
[0018] Furthermore, dependent libraries are screened according to the complex reference value of the dependent libraries, including:
[0019] Selecting a first preliminary dependent library that meets the first screening condition according to the dependent library complex reference value;
[0020] Detecting the number of the first prepared dependent libraries, and performing secondary screening when the number of the first prepared dependent libraries is greater than a preset number;
[0021] Among them, the first screening condition is that the dependency library complexity reference value is less than the preset dependency library complexity reference value.
[0022] Further, the dependent libraries are screened according to the dependent library update frequency, wherein, if the dependent library complexity reference values are all less than the preset dependent library complexity reference values, a preset number of dependent libraries to be selected are selected in the order of the dependent library update frequency from small to large and recorded as target dependent libraries;
[0023] If there are dependent libraries whose dependent library complexity reference values are greater than or equal to the preset dependent library complexity reference values, a preset number of dependent libraries are selected in the order of dependent library update frequency from small to large as the first preliminary dependent libraries and subjected to secondary screening.
[0024] Furthermore, the dependency library complexity reference value is determined according to the number of relationship tree branches corresponding to the dependency library and the average value of relationship tree extension.
[0025] Furthermore, the secondary screening is to detect the API usage bias of each first prepared dependent library, and determine the secondary screening benchmark according to the API usage bias, and the secondary screening benchmark is the API usage frequency difference, or update activity.
[0026] Furthermore, the calculation formula of the API usage bias S is:
[0027]
[0028] Among them, for a single first prepared dependency library, Fi is the usage frequency corresponding to the i-th API of the first prepared dependency library, F0 is the average usage frequency of all APIs, and n is the number of APIs of the first prepared dependency library.
[0029] Furthermore, a target dependency library corresponding to each target to be updated is selected and recorded as the final dependency library, dependency conflicts between the final dependency libraries are analyzed, the final dependency library with dependency conflicts is recorded as the problem dependency library, and environment isolation loading is performed.
[0030] Furthermore, environment isolation loading includes:
[0031] Use the environment isolation tool to create a corresponding separate isolated environment for the problem dependency library and set environment variables;
[0032] Install the dependencies required by the project in a separate isolated environment;
[0033] Use dependency management tools to manage dependencies and resolve dependency conflicts;
[0034] Mark the dependencies and their versions in the project's configuration files;
[0035] Activate a separate isolated environment;
[0036] Test in a separate isolated environment.
[0037] Compared with the prior art, the beneficial effect of the present invention lies in that the library status is determined according to the complex comparison value of the dependent library and the complex reference value of the dependent library in the technical solution of the present invention, so that the library status effectively reflects the complexity of each dependent library and the distribution of the complexity between the dependent libraries to be selected, thereby making the subsequent selection of the dependent library selection method more accurate, avoiding the problem of poor judgment accuracy caused by a single selection method, and in the secondary screening, the secondary screening benchmark is determined according to the API usage bias, and the target dependent library is selected according to the secondary screening benchmark. The setting of the secondary screening avoids the problem that the accuracy of a single screening method cannot meet the actual usage requirements, making the judgment method more flexible, and further reflects the usage status of the corresponding dependent library according to the API usage bias, avoiding the problem of API version errors in the subsequent use process caused by uneven API usage of the dependent library, further improving the loading efficiency of the present invention, avoiding the problem that the prior art does not take into account the dependency complexity and historical usage effects of the third-party library to be selected, resulting in an increased probability of dependency conflicts in the selected third-party library, and reducing the waste of data processing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of an update loading method based on dynamic isolation of the present invention;
[0039] Figure 2 The present invention is a flow chart of determining a dependent library selection method according to the library status of the dependent library to be selected. DETAILED DESCRIPTION
[0040] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; 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.
[0041] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0042] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.
[0043] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0044] See also Figure 1 to Figure 2 As shown, the present invention provides an update loading method based on dynamic isolation, comprising:
[0045] Obtain the dependent library to be selected, and determine the library status according to the complex comparison value of the dependent library and the complex reference value of the dependent library;
[0046] Determine a method for selecting a dependent library according to the library status of the dependent library to be selected, including screening the dependent library according to the update frequency of the dependent library, or screening the dependent library according to the complex reference value of the dependent library;
[0047] Selecting a plurality of first prepared dependent libraries in response to different dependent library selection modes;
[0048] When the number of the first prepared dependent libraries is less than or equal to the preset number or when there is a dependent library complexity reference value greater than or equal to the preset dependent library complexity reference value, a secondary screening of the first prepared dependent library is performed;
[0049] In the secondary screening, the secondary screening benchmark is determined according to the API usage bias, and the target dependency library is selected based on the secondary screening benchmark;
[0050] The final dependency library is determined for the target dependency library, and direct loading or environment isolation loading is selected based on whether there is a dependency conflict in the final dependency library.
[0051] The target to be updated in the present invention is the target dependency library to be selected.
[0052] Specifically, obtain the dependent library to be selected corresponding to the target to be updated, and determine the dependent library selection method according to the library status of the dependent library to be selected;
[0053] If the library state is the first preset library state, the dependent library selection method is to screen the dependent library according to the dependent library update frequency;
[0054] If the library state is the second preset library state, the dependent library is screened according to the dependent library complex reference value.
[0055] Specifically, the library state includes a first preset library state and a second preset library state;
[0056] The first preset library state is that the dependent library complex comparison value is within the preset complex comparison value range, or the dependent library complex reference value is less than or greater than the preset dependent library complex reference value;
[0057] The second preset library status is that the dependent library complex comparison value is within the difference complex comparison value range, and the dependent library complex reference value is not all less than or greater than the preset dependent library complex reference value.
[0058] The calculation formula for the complex comparison value H of the dependent library is:
[0059]
[0060] Among them, Si is the complex reference value of the i-th dependent library to be selected, S0 is the complex reference value of all dependent libraries to be selected, n is the total number of dependent libraries to be selected corresponding to a single target to be updated, and the preset complex comparison value range and the difference complex comparison value comparison range can be set according to the actual application scenario, but it is necessary to ensure that the minimum value of the difference complex comparison value range is greater than the maximum value of the preset complex comparison value range. It can be understood that the dependent library complex comparison value reflects the degree of difference in the dependent library complex reference values between the dependent libraries to be selected corresponding to the target to be updated. The greater the user's demand for the accuracy of dependent library screening, the smaller the maximum value of the preset complex comparison value range. A preset complex comparison value range and a difference complex comparison value comparison range are provided. The values within the preset complex comparison value range are all less than 30% of S0, and the values within the difference complex comparison value range are all greater than or equal to 30% of S0.
[0061] Specifically, dependent libraries are screened based on the complex reference values of dependent libraries, including:
[0062] Selecting a first preliminary dependent library that meets the first screening condition according to the dependent library complex reference value;
[0063] Detecting the number of the first prepared dependent libraries, and performing secondary screening when the number of the first prepared dependent libraries is greater than a preset number;
[0064] Among them, the first screening condition is that the dependency library complexity reference value is less than the preset dependency library complexity reference value.
[0065] Specifically, the dependent libraries are screened according to the dependent library update frequency, wherein, if the dependent library complexity reference values are all less than the preset dependent library complexity reference values, a preset number of dependent libraries to be selected are selected in the order of the dependent library update frequency from small to large and recorded as target dependent libraries;
[0066] If there are dependent libraries whose dependent library complexity reference values are greater than or equal to the preset dependent library complexity reference values, a preset number of dependent libraries are selected in the order of dependent library update frequency from small to large as the first preliminary dependent libraries and subjected to secondary screening.
[0067] Specifically, the dependency library complexity reference value is determined according to the number of relationship tree branches corresponding to the dependency library and the average value of the relationship tree extension.
[0068] The complex reference value of the dependency library S=P×α1+K×α2, wherein P is the number of branches in the relationship tree, and K is the average value of the extension of the relationship tree. The present invention establishes a relationship tree corresponding to each dependency library, and the relationship tree includes a trunk, branches, and sub-branches. The trunk is the name of the dependency library, and the branches are other dependency libraries that have dependency relationships with the dependency library. The sub-branches are connected to the branches, and the sub-branches are other dependency libraries that have dependency relationships with each dependency library that serves as a branch. α1 is the first reference coefficient, and α2 is the second reference coefficient. The values of α1 and α2 are related to the degree of importance attached by the user. The greater the degree of importance attached to P by the user, the greater the α1, and the greater the degree of importance attached to K, the greater the α2. It is worth noting that α1+α2=1, and α1>0, α2>0.
[0069] The calculation formula for the average value K of the relationship tree extension is:
[0070] K=(Kq1-Kq2) / K0,
[0071] Among them, Kq1 is the first reference value, Kq2 is the second reference value, Kq1 is the 25th percentile position after arranging the number of sub-branches of each branch in ascending order, if the total number of branches is an odd number, Kq1 is the value arranged at the (N+1) / 4 position, if the total number of branches is an even number, then the value arranged at the N / 4 position is taken, Kq2 is the 75th percentile position after arranging the number of sub-branches of each branch in ascending order, if the total number of branches is an odd number, Kq1 is the value arranged at the 3(N+1) / 4 position, if the total number of branches is an even number, then the value arranged at the 3N / 4 position is taken, and N is the total number of branches. The value of the preset dependency library complex reference value can be set by the user according to the actual application scenario. It can be understood that the larger the dependency library complex reference value, the greater the load level of the dependency relationship of the dependency library, the greater the probability of subsequent dependency conflicts. The user can determine the preset dependency library complex reference value according to the degree of demand for the load level of the dependency relationship of the dependency library. The lower the user's demand for the load level of the dependency relationship of the dependency library, the smaller the value of the preset dependency library complex reference value. A value of the preset dependency library complex reference value is provided, and the preset dependency library complex reference value is 20% of K0.
[0072] Specifically, the secondary screening is to detect the API usage bias of each first prepared dependent library, and determine the secondary screening benchmark according to the API usage bias. The secondary screening benchmark is the API usage frequency difference, or the update activity.
[0073] If the API usage bias is greater than the preset API usage bias, the secondary screening criterion is the API usage frequency difference, and the preset number of first prepared dependency libraries are selected in order of the API usage frequency difference from small to large and recorded as the target dependency library;
[0074] If the API usage bias is less than or equal to the API usage bias, the secondary screening criterion is the update activity. A preset number of first preparation dependency libraries are selected in order of update activity from small to large and recorded as target dependency libraries. The update activity is the number of historical updates of the dependency library.
[0075] The value of the preset API usage bias can be determined by the user based on the historical dependency library usage records. The average value of the API usage bias of the dependency libraries with dependency conflicts in the historical dependency library usage records is detected and recorded as the preset API usage bias. The absolute value of the difference between the API usage bias of each first preparation dependency library and the preset API usage bias is detected, and the absolute value is recorded as the API usage frequency difference.
[0076] Specifically, the calculation formula for the API usage bias S is:
[0077]
[0078] Among them, for a single first prepared dependency library, Fi is the usage frequency corresponding to the i-th API of the first prepared dependency library, F0 is the average usage frequency of all APIs, and n is the number of APIs of the first prepared dependency library.
[0079] After the target dependency library is selected, the user can freely select the target dependency library to be updated and loaded, which is recorded as the final dependency library. Each target to be updated corresponds to a final dependency library. The dependency conflicts between the final dependency libraries are analyzed, and the final dependency libraries with dependency conflicts are recorded as problem dependency libraries, and loaded in environmental isolation.
[0080] Specifically, environment isolation loading includes:
[0081] Use the environment isolation tool to create a corresponding separate isolated environment for the problem dependency library and set environment variables;
[0082] Install the dependencies required by the project in a separate isolated environment;
[0083] Use dependency management tools to manage dependencies and resolve dependency conflicts;
[0084] Mark the dependencies and their versions in the project's configuration files;
[0085] Activate a separate isolated environment;
[0086] Test in a separate isolated environment.
[0087] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0088] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An update loading method based on dynamic isolation, characterized in that: include: Obtain the dependent library to be selected, and determine the library status according to the complex comparison value of the dependent library and the complex reference value of the dependent library; Determine a method for selecting a dependent library according to the library status of the dependent library to be selected, including screening the dependent library according to the update frequency of the dependent library, or screening the dependent library according to the complex reference value of the dependent library; In response to different dependency library selection methods, select a number of first prepared dependency libraries; When the number of the first prepared dependent libraries is less than or equal to the preset number or when there is a dependent library complexity reference value greater than or equal to the preset dependent library complexity reference value, a secondary screening of the first prepared dependent library is performed; In the secondary screening, the secondary screening benchmark is determined according to the API usage bias, and the target dependency library is selected based on the secondary screening benchmark; Determine the final dependency library for the target dependency library, and choose direct loading or environment isolation loading based on whether there is a dependency conflict in the final dependency library; The calculation formula for the complex comparison value H of the dependent library is: Wherein, Si is the complex reference value of the i-th dependency library to be selected, S0 is the complex reference value of all dependency libraries to be selected, and n is the total number of dependency libraries to be selected corresponding to a single target to be updated; The dependency library complexity reference value is determined according to the number of associated libraries corresponding to the dependency library and the associated distribution depth; The calculation formula for the API usage bias S is: Among them, for a single first prepared dependency library, Fi is the usage frequency corresponding to the i-th API of the first prepared dependency library, F0 is the average usage frequency of all APIs, and n is the number of APIs of the first prepared dependency library.
2. The update loading method based on dynamic isolation according to claim 1 is characterized in that: The dependency library to be selected is the dependency library to be selected corresponding to the target to be updated; The dependent library selection method is determined according to the library status of the dependent library to be selected, including: If the library state is the first preset library state, the dependent library selection method is to screen the dependent library according to the dependent library update frequency; If the library state is the second preset library state, the dependent library is screened according to the dependent library complex reference value.
3. The update loading method based on dynamic isolation according to claim 2 is characterized in that: The library state includes a first preset library state and a second preset library state; The first preset library state is that the dependent library complex comparison value is within the preset complex comparison value range, or the dependent library complex reference value is less than or greater than the preset dependent library complex reference value; The second preset library state is that the dependent library complex comparison value is within the difference complex comparison value range, and the dependent library complex reference value is not all less than or greater than the preset dependent library complex reference value; The minimum value of the difference complex comparison value range is greater than the maximum value of the preset complex comparison value range.
4. The update loading method based on dynamic isolation according to claim 3 is characterized in that: Dependent libraries are screened based on complex reference values of dependent libraries, including: Selecting a first preliminary dependent library that meets the first screening condition according to the dependent library complexity reference value; Detecting the number of the first prepared dependent libraries, and performing secondary screening when the number of the first prepared dependent libraries is greater than a preset number; Among them, the first screening condition is that the dependency library complexity reference value is less than the preset dependency library complexity reference value.
5. The update loading method based on dynamic isolation according to claim 4 is characterized in that: Dependency libraries are screened according to the dependency library update frequency. If the dependency library complexity reference values are all less than the preset dependency library complexity reference values, a preset number of dependency libraries to be selected are selected in the order of dependency library update frequency from small to large and recorded as target dependency libraries. If there are dependent libraries whose dependent library complexity reference values are greater than or equal to the preset dependent library complexity reference values, a preset number of dependent libraries are selected in the order of dependent library update frequency from small to large as the first preliminary dependent libraries and subjected to secondary screening.
6. The update loading method based on dynamic isolation according to claim 5 is characterized in that: The secondary screening is to detect the API usage bias of each first prepared dependent library, and determine the secondary screening benchmark according to the API usage bias. The secondary screening benchmark is the API usage frequency difference, or the update activity.
7. The update loading method based on dynamic isolation according to claim 6 is characterized in that: Select a target dependency library corresponding to each target to be updated as the final dependency library, analyze the dependency conflicts between the final dependency libraries, record the final dependency library with dependency conflicts as the problem dependency library, and perform environment isolation loading.
8. The update loading method based on dynamic isolation according to claim 7 is characterized in that: Environment isolation loading includes: Use the environment isolation tool to create a corresponding separate isolated environment for the problem dependency library and set environment variables; Install the dependencies required by the project in a separate isolated environment; Use dependency management tools to manage dependencies and resolve dependency conflicts; Mark the dependencies and their versions in the project's configuration files; Activate a separate isolated environment; Test in a separate isolated environment.
Citation Information
Patent Citations
Method and device for recommending third-party library and related equipment
CN115495058A
Dependence library management method and device, storage medium and computer equipment
CN111124526A
Conflict dependency library detection method and device
CN111679852A