Metadata updating method, device, equipment and storage medium in microservice gateway
The method addresses metadata overwriting in microservice gateways by determining similarity and checking configuration center differences to ensure only relevant metadata is updated, enhancing accuracy and preventing obsolete data from being used.
Patent Information
- Application Number
- CN202211488966.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-25
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-11-25
Smart Images

Figure CN115733750B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a method, device, equipment and storage medium for updating metadata in a microservice gateway. Background Art
[0002] In the open source distributed service framework, the consumer needs to introduce the provider's microservice stub to implement microservice calls. For the microservice gateway of the open source distributed service framework, the gateway should be decoupled from the microservice stub as much as possible. A common practice is to publish the microservice stub metadata as a common configuration in the configuration center. The microservice gateway of the open source distributed service framework subscribes to the configuration center. When the service stub needs to be updated, the service provider needs to synchronize the metadata in the configuration center. The microservice gateway of the open source distributed service framework receives the updated metadata pushed by the configuration center and uses the updated metadata to update its own cached metadata, thereby identifying the newly added or modified methods in the service stub and achieving decoupling from the service stub.
[0003] However, when the microservice gateway is associated with multiple configuration centers, the current method of decoupling the microservice gateway from the service stub will cause metadata coverage problems. Summary of the invention
[0004] Based on this, it is necessary to provide a metadata updating method, device, equipment and storage medium in a microservice gateway that can avoid metadata overlay problems caused by human error or microservice gateway association with different configuration centers for the same microservice metadata in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for updating metadata in a microservice gateway. The method comprises:
[0006] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0007] Obtaining a first feature matrix according to the first metadata;
[0008] If the second metadata of the microservice has been cached in the microservice gateway, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0009] If the similarity is less than a preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0010] In one embodiment, if the similarity is less than the preset similarity threshold, prohibiting the use of the first metadata to update the second metadata includes:
[0011] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0012] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0013] In one embodiment, if the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, then prohibiting the use of the first metadata to update the second metadata includes:
[0014] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0015] In one embodiment, obtaining a first feature matrix according to the first metadata includes:
[0016] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0017] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0018] In one embodiment, the method further comprises:
[0019] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0020] The first metadata is one-hot encoded to obtain a feature vector, including:
[0021] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0022] In one embodiment, the method further comprises:
[0023] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0024] In a second aspect, the present application also provides a metadata updating device in a microservice gateway. The device includes:
[0025] A receiving module, configured to receive first metadata of a target microservice sent by the configuration center when the microservice gateway establishes a communication connection with the configuration center;
[0026] A first determining module, configured to obtain a first feature matrix according to the first metadata;
[0027] A second determination module is used to determine the similarity between the first metadata and the second metadata according to a second feature matrix corresponding to the first feature matrix and the second metadata if the second metadata of the microservice has been cached in the microservice gateway;
[0028] The prohibition module prohibits using the first metadata to update the second metadata if the similarity is less than the preset similarity threshold.
[0029] In one embodiment, the prohibition module includes:
[0030] A first acquisition unit, configured to acquire first attribute information of the first metadata and second attribute information of the second metadata if the similarity is less than the preset similarity threshold;
[0031] The prohibition unit is used to prohibit the use of the first metadata to update the second metadata if the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition.
[0032] In one embodiment, the inhibiting unit comprises:
[0033] A prohibition subunit is used to prohibit the use of the first metadata to update the second metadata if at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset time length, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs.
[0034] In one embodiment, the first determining module includes:
[0035] A first determining unit, configured to perform one-hot encoding on the first attribute information of the first metadata to obtain a feature vector;
[0036] The second determining unit is used to use a word vector encoder to perform word vector encoding on the feature vector and the preset feature to obtain the first feature matrix.
[0037] In one embodiment, the device further comprises:
[0038] A third determining module is used to add the custom attribute information to the first metadata to obtain the first metadata after the custom attribute information is added;
[0039] The fourth determination module, used for performing one-hot encoding on the first metadata to obtain a feature vector, includes:
[0040] The third determining unit is used to perform one-hot encoding on the first metadata after the custom attribute information is added to obtain the feature vector.
[0041] In one embodiment, the device further comprises:
[0042] The fifth determining module is configured to determine to use the first metadata to update the second metadata if the similarity is greater than or equal to the preset similarity threshold.
[0043] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0044] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0045] Obtaining a first feature matrix according to the first metadata;
[0046] If the microservice gateway has cached the second metadata of the microservice, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0047] If the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0048] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0049] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0050] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0051] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0052] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0053] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0054] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0055] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0056] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0057] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0058] The first metadata is one-hot encoded to obtain a feature vector, including:
[0059] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0060] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0061] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0062] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0063] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0064] Obtaining a first feature matrix according to the first metadata;
[0065] If the microservice gateway has cached the second metadata of the microservice, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0066] If the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0067] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0068] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0069] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0070] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0071] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0072] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0073] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0074] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0075] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0076] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0077] The first metadata is one-hot encoded to obtain a feature vector, including:
[0078] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0079] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0080] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0081] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0082] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0083] Obtaining a first feature matrix according to the first metadata;
[0084] If the microservice gateway has cached the second metadata of the microservice, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0085] If the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0086] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0087] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0088] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0089] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0090] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0091] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0092] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0093] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0094] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0095] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0096] The first metadata is one-hot encoded to obtain a feature vector, including:
[0097] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0098] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0099] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0100] The metadata updating method, device, equipment and storage medium in the above-mentioned microservice gateway, the metadata updating method in the microservice gateway provided by the embodiment of the present application, when the microservice gateway establishes a communication connection with the configuration center, the microservice gateway receives the first metadata of the target microservice sent by the configuration center, obtains the first feature matrix according to the first metadata, and if the second metadata of the microservice is already cached in the microservice gateway, then the similarity between the first metadata and the second metadata is determined according to the second feature matrix corresponding to the first feature matrix and the second metadata, and if the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata. In the traditional technology, the microservice gateway subscribes to the metadata in the configuration center, and when the service stub needs to be updated, the service provider will synchronously update and publish the metadata in the configuration center, and the microservice gateway will receive the new metadata pushed by the configuration center, and refresh the metadata cached by the microservice gateway itself. However, when the microservice gateway is associated with different configuration centers, due to factors such as network jitter, the microservice gateway is disconnected from a configuration center containing obsolete metadata. After the configuration center re-establishes the connection with the microservice gateway, it pushes the obsolete metadata to the microservice gateway. The obsolete metadata overwrites the correct metadata cached in the microservice gateway. Therefore, when the microservice gateway is associated with different configuration centers, the traditional technology has the problem of metadata overwriting. This application determines the similarity between the first metadata and the second metadata based on the second feature matrix corresponding to the first feature matrix and the second metadata, and finally determines whether to use the first metadata to update the second metadata based on the similarity, thereby determining whether the second metadata needs to be updated, thereby avoiding the metadata overwriting problem caused by human error or the association of the microservice gateway with different configuration centers. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] Figure 1 An application environment diagram of a metadata update method in a microservice gateway provided in an embodiment of the present application;
[0102] Figure 2 A schematic diagram of a process for updating metadata in a microservice gateway provided in an embodiment of the present application;
[0103] Figure 3 A flowchart of a method for determining whether to prohibit using first metadata to update second metadata provided by an embodiment of the present application;
[0104] Figure 4 A schematic diagram of a flow chart of a method for determining a first characteristic matrix provided in an embodiment of the present application;
[0105] Figure 5 A schematic diagram of a flow chart of a method for determining a feature vector provided in an embodiment of the present application;
[0106] Figure 6It is a structural block diagram of a metadata updating device in a microservice gateway in an embodiment;
[0107] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0108] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0109] The data updating method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the microservice gateway 101 establishes a connection with the configuration center 102 , the metadata in the configuration center 102 is pushed to the microservice gateway 101 , and the microservice gateway 101 caches the metadata pushed by the configuration center 102 . Figure 2 is a flow chart of a data updating method provided in an embodiment of the present application, which is applied to Figure 1 The microservice gateway in the method comprises the following steps:
[0110] S201. When a microservice gateway establishes a communication connection with a configuration center, first metadata of a target microservice sent by the configuration center is received.
[0111] Among them, the configuration center may include the configuration center that currently sends metadata to the gateway; the first metadata of the target microservice includes the metadata newly pushed to the microservice gateway by the configuration center, and the first metadata may include attribute information such as microservice definition content, definition text length, definition modification time, configuration center cluster identifier, etc.
[0112] In an embodiment of the present application, when the microservice gateway establishes a communication connection with the configuration center, the microservice gateway receives the first metadata sent by the configuration center containing attribute information such as microservice definition content, definition text length, definition modification time, and configuration center cluster identifier.
[0113] It should be noted that after the microservice gateway receives the first metadata of the microservice sent by the configuration center, it loads the first metadata and uses the metadata comparison learner added in the microservice gateway to extract the content of the first metadata. For each first metadata, the metadata comparison learner extracts the corresponding metadata content. For example, json
[0114] {
[0115] "service":"com.demo.Service1",
[0116] "version":"1.0",
[0117] "app":"APP1",
[0118] "registerTime":"20220728 20:00:00.000",
[0119] "dc":"001",
[0120] methods:[
[0121] {
[0122] "methodName":"login",
[0123] "paramType":"java.util.Map",
[0124] "returnType":"java.util.Map"
[0125] } ]
[0127] }
[0128] S202: Obtain a first feature matrix according to the first metadata.
[0129] In the embodiment of the present application, according to the first metadata determined in S201 above, the microservice gateway encodes the first metadata to obtain a first feature matrix.
[0130] Specifically, the five types of attribute information, namely, microservice definition content, definition text length, definition modification time, configuration center cluster identifier, and custom attributes, can be used as the attribute information in the first metadata, and the first metadata constructed is in the form of {data:{methodName:“invoke”},datalength:20,mtime:20220902,configCluster:cluster1,Qoe:1}. Among them, the custom attributes include the current network quality of the microservice gateway.
[0131] The first metadata with custom attribute information added can be one-hot encoded to obtain a feature vector, and then the five dimensions of defined definition content, definition text length, definition modification time, configuration center cluster ID, and current network quality of the microservice gateway are considered, and a trainable high-dimensional feature is reserved, for a total of six dimensions. The feature vector obtained after one-hot encoding is then encoded to obtain the first feature matrix.
[0132] S203: If the second metadata of the microservice has been cached in the microservice gateway, determine the similarity between the first metadata and the second metadata according to the second feature matrix corresponding to the first feature matrix and the second metadata.
[0133] The second metadata may include metadata cached in the microservice gateway.
[0134] In an embodiment of the present application, if the second metadata of the microservice is cached in the microservice gateway, the second metadata is first added with custom attribute information and then one-hot encoded, and the feature vector of the second metadata is obtained after one-hot encoding. Then, considering the five dimensions of defined definition content, definition text length, definition modification time, configuration center cluster identifier, and current network quality of the microservice gateway, and reserving a trainable high-dimensional feature, a total of six dimensions, the feature vector of the second metadata generated after one-hot encoding is encoded to obtain a second feature matrix.
[0135] It should be noted that when the cache of the microservice gateway does not contain the second metadata of the microservice, the second metadata is directly cached in the microservice gateway.
[0136] Specifically, the distance between the first feature matrix and the second feature matrix is calculated using the cosine similarity algorithm, that is, the distance between the first metadata and the second metadata is calculated, and the calculated result is normalized to between [0-1] to obtain the similarity between the first metadata and the second metadata. The distance T(x,y) between the first metadata and the second metadata can be calculated by the following formula:
[0137]
[0138] Where x is the second feature matrix corresponding to the second metadata, y is the first feature matrix corresponding to the first metadata, ||x|| represents the Euclidean norm of the second feature matrix corresponding to the second metadata, ||y|| represents the Euclidean norm of the first feature matrix corresponding to the first metadata, x i Represents each row vector in the second feature matrix corresponding to the second metadata, y i represents each row vector in the first feature matrix corresponding to the first metadata, and represents the dot multiplication operation of the elements in the feature matrix.
[0139] S204: If the similarity is less than a preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0140] In the embodiment of the present application, if the similarity between the first metadata and the second metadata is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata, and the gateway does not refresh. On the contrary, if the similarity between the first metadata and the second metadata is greater than or equal to the preset similarity, the first metadata is used to update the second metadata; it can also be that the similarity between the first metadata and the second metadata is multiplied by a preset coefficient to obtain a first result. When the first result is greater than or equal to the preset similarity, it is considered to be a positive update, and the first metadata can be used to update the second metadata.
[0141] It should be noted that the preset similarity threshold can be used to collect positive and negative samples in the microservice environment through the environment collector, and the empirical value is obtained after analyzing the positive and negative samples. Specifically, it is based on the principle of software iterative development: during software iterative development, formal modifications generally only update 1-2 methods, and the number of methods in the existing stock interface is within 5-10. Therefore, when the definition of the interface needs to be updated, if the similarity between the first metadata and the second metadata is 80% or more, that is, most of them are positive samples, then it is determined that the first metadata is used to update the second metadata. If the first metadata and the second metadata are both less than 80%, that is, most of them are negative samples, then it is forbidden to use the first metadata to update the second metadata.
[0142] Assume that there are three configuration centers, namely, configuration center A, configuration center B, and configuration center C. The application is initially deployed in configuration center A, configuration center B, and configuration center C. Metadata is configured in all three configuration centers. Later, due to the splitting of the application, the core functions are retained and deployed only in configuration center A and configuration center B, and the deployment of configuration center C is cancelled. Therefore, the metadata of the application in configuration center A and configuration center B will be continuously updated and kept consistent, such as the service method name and parameter type recorded in the metadata. The metadata in configuration center C is no longer updated, and the service method name in the metadata is no longer applicable to the iteratively updated program and is discarded data. When the microservice gateway is disconnected from configuration center C due to factors such as network jitter, and then configuration center C re-establishes a connection with the gateway, the metadata in configuration center C is pushed to the gateway again, and this metadata is called the first metadata; the gateway has cached metadata from configuration center A and configuration center B, and this metadata is called the second metadata. Then, a first feature matrix is obtained by encoding according to the first metadata, and then the similarity between the first metadata and the second metadata is determined according to the first feature matrix and the second feature matrix corresponding to the second metadata. When the similarity between the first metadata and the second metadata is greater than or equal to 80%, the first metadata is used to update the second metadata. When the similarity between the first metadata and the second metadata is less than 80%, it is prohibited to use the first metadata to update the second metadata.
[0143] The metadata updating method in the microservice gateway provided by the embodiment of the present application, when the microservice gateway establishes a communication connection with the configuration center, the microservice gateway receives the first metadata of the target microservice sent by the configuration center, obtains the first feature matrix according to the first metadata, and if the second metadata of the microservice is already cached in the microservice gateway, the similarity between the first feature matrix and the second metadata is determined according to the second feature matrix corresponding to the first feature matrix and the second metadata, and if the similarity is less than the preset similarity threshold, it is prohibited to update the second metadata with the first metadata. In the traditional technology, the microservice gateway subscribes to the metadata in the configuration center, and when the service stub needs to be updated, the service provider synchronizes and publishes the metadata in the configuration center, and the microservice gateway receives the new metadata pushed by the configuration center, and refreshes the metadata cached by the microservice gateway itself. However, when the microservice gateway is associated with different configuration centers, due to factors such as network jitter, the microservice gateway is disconnected from a configuration center containing abandoned metadata. After the configuration center re-establishes the connection with the microservice gateway, the abandoned metadata is pushed to the microservice gateway, and the abandoned metadata covers the correct metadata cached in the microservice gateway. Therefore, when the microservice gateway is associated with different configuration centers, the traditional technology has the problem of metadata coverage. The present application determines the similarity between the first metadata and the second metadata based on the first feature matrix and the second feature matrix corresponding to the second metadata, and finally determines whether to use the first metadata to update the second metadata based on the similarity, thereby determining whether the second metadata needs to be updated, thereby avoiding metadata coverage problems caused by human error in the same microservice metadata or due to the microservice gateway being associated with different configuration centers.
[0144] Figure 3 A flowchart of a method for determining whether to prohibit the use of first metadata to update second metadata is provided in an embodiment of the present application. This embodiment relates to a possible implementation method of prohibiting the use of first metadata to update second metadata if the similarity is less than a preset similarity threshold. The above S204 includes:
[0145] S301: If the similarity is less than a preset similarity threshold, obtain first attribute information of the first metadata and second attribute information of the second metadata.
[0146] The first attribute information and the second attribute information may include a timestamp defining a modification time.
[0147] In the embodiment of the present application, if the similarity between the first metadata and the second metadata is less than a preset similarity threshold, the timestamp of the definition modification time of the first metadata and the timestamp of the definition modification time of the second metadata are obtained.
[0148] S302: If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to update the second metadata using the first metadata.
[0149] The preset configuration condition may include that the definition modification timestamps of the first metadata and the second metadata differ by more than 3 years.
[0150] In an embodiment of the present application, if the first attribute information of the first metadata and the second attribute information of the second metadata meet the preset configuration conditions, that is, the definition modification timestamp difference between the first metadata and the second metadata exceeds 3 years, then it is prohibited to use the first metadata to update the second metadata, and the gateway will not refresh.
[0151] The embodiment of the present application provides a judgment method for prohibiting the use of first metadata to update second metadata. If the similarity is less than a preset similarity threshold, the first attribute information of the first metadata and the second attribute information of the second metadata are obtained. If the first attribute information of the first metadata and the second attribute information of the second metadata meet the preset configuration conditions, the use of the first metadata to update the second metadata is prohibited. The accuracy of judging whether metadata is updated is improved, thereby avoiding the metadata coverage problem caused by human error or association with different configuration centers for the same microservice metadata.
[0152] In one embodiment, this embodiment relates to a possible implementation method of prohibiting the use of the first metadata to update the second metadata if the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition. Based on the above embodiment, S302 includes:
[0153] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0154] The preset duration is preferably 3 hours; the identifier of the configuration center can be used to determine whether the first metadata and the second metadata are in different configuration centers.
[0155] In an embodiment of the present application, if the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to 3 hours, or the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs (that is, the first metadata and the second metadata are in different configuration centers), then it is prohibited to use the first metadata to update the second metadata, and the gateway does not refresh.
[0156] The judgment method for prohibiting the use of the first metadata to update the second metadata provided in the embodiment of the present application prohibits the use of the first metadata to update the second metadata by assuming that the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to the preset time length, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs. This improves the accuracy of judging whether the metadata is updated, thereby avoiding the metadata coverage problem caused by human error or because the microservice gateway is associated with different configuration centers.
[0157] Figure 4 A flowchart of a method for determining a first characteristic matrix provided in an embodiment of the present application is provided. This embodiment relates to a possible implementation method of how to obtain a first characteristic matrix according to first metadata. In the above embodiment, S202 includes:
[0158] S401. Perform one-hot encoding on the first metadata to obtain a feature vector.
[0159] In the embodiment of the present application, since the metadata does not contain Chinese but is in English, the first metadata can be one-hot encoded using an English dictionary to obtain a feature vector. Specifically, the defined definition content, definition text length, definition modification time, and configuration center cluster identifier are considered to be one-hot encoded to obtain a feature vector; the defined definition content, definition text length, definition modification time, configuration center cluster identifier, and a custom attribute can also be considered to be one-hot encoded to obtain a feature vector.
[0160] S402: Use a word vector encoder to perform word vector encoding on the feature vector and the preset feature to obtain a first feature matrix.
[0161] Among them, the preset features include a trainable high-dimensional feature.
[0162] In an embodiment of the present application, a word vector encoder (word2VecEmbedding) can be used to encode the feature vector and the preset features to obtain a first feature matrix.
[0163] Specifically, the word vector encoding can be performed with 5 dimensions, including the defined definition content, definition text length, definition modification time, and configuration center cluster identifier, as well as a preset feature, to construct a feature matrix. The feature matrix can also be constructed with 6 dimensions, including the defined definition content, definition text length, definition modification time, configuration center cluster identifier, and current network quality of the microservice gateway, as well as a reserved trainable high-dimensional feature (i.e., preset feature). For example: [[0.7429, -0.1430, -0.2286, 0.2764, 0.0352, 0.2620],
[0164] [-0.2458,0.2041,-0.8451,-1.5177,-0.4381,1.9714],
[0165] [0.1536,-1.4522,1.3563,-0.9198,-1.2024,-0.9063],
[0166] [1.3898,-0.2650,-0.0332,-0.2091,1.7436,0.5360],
[0167] [-0.9750,-0.4989,0.4935,0.0069,-0.8472,0.9891],
[0168] [0.2754,1.4006,-0.7781,-0.4653,-0.2444,-1.4417],
[0169] [-1.3187,0.0939,-0.1711,0.6579,0.9924,1.0066],
[0170] [0.2565,-0.8868,-0.0266,2.0472,0.5390,-0.7274],
[0171] [0.3484,-0.2776,1.7845,-0.0941,0.1176,-0.4080],
[0172] [1.0763,0.8564,-0.1878,-0.0547,0.5259,-2.6318],
[0173] [0.3154,0.7991,1.4066,0.1094,0.1874,-0.3941],
[0174] [-0.9348,0.3324,-3.0653,0.5261,-0.1676,-0.3948],
[0175] [-0.0977,-0.0429,1.0277,0.7112,1.7010,0.6622],
[0176] [-1.5802,1.3197,0.3038,-0.6295,0.6849,0.5501],
[0177] [-0.0205,0.2663,1.4262,-0.3821,-0.3236,1.4738],
[0178] [-1.0590,1.5335,0.3938,-0.6251,-1.3143,-1.4214],
[0179] [0.3761,0.2026,-0.9056,0.9442,0.8787,0.1290],
[0180] [-0.5573,-0.3904,0.8717,-2.3217,0.0479,-0.5811],
[0181] [-1.8839,1.2689,-0.8172,1.2722,-0.4869,0.8938],
[0182] [1.1627,1.0851,-0.1640,-1.4984,0.1418,-0.1259],
[0183] [0.7423,-0.4177,-1.2492,-1.3658,-0.3494,-1.6605],
[0184] [0.3596,-1.5221,-0.1379,0.5357,1.0805,1.0964],
[0185] [0.3244,-0.8056,0.8351,-0.8353,-0.6196,-0.5325],
[0186] [0.1302,-0.8698,-0.2589,-1.1874,1.0045,-1.5511],
[0187] [-1.0486,0.0496,0.1910,-0.6786,0.0905,0.7410],
[0188] [0.0527,-0.4918,-0.5578,-0.1881,1.1141,0.1018],
[0189] [1.1707,1.3359,-1.7013,0.8276,-1.0066,-1.2873],
[0190] [-0.1759,1.5320,1.7398,-0.6958,0.0224,-1.0197],
[0191] [-0.4939, 0.4729, -1.1960, -1.2884, 1.3391, 0.6011],
[0192] [-0.0910, -0.5186, 1.5346, 0.0699, 0.2328, -0.5973],
[0193] [0.5900, 0.3725, 0.1969, -0.7658, -0.8607, 2.9495],
[0194] [0.8127, 2.3082, 1.6082, 1.7962, -0.2186, 0.0272],
[0195] [1.2648, -1.0144, 1.7994, 0.3519, -0.7487, -0.4007],
[0196] [-0.1428, -0.1338, 1.3104, -1.6004, -0.8033, 1.1689],
[0197] [-1.2252, -0.2710, 0.4000, 0.8116, 0.9895, 0.3305],
[0198] [1.0993, -0.7478, 0.4610, 1.8034, -0.1326, 0.6724],
[0199] [-0.3462, -0.8695, -0.3788, 0.6121, -1.0364, -0.9020],
[0200] [-0.6563, -0.6356, 0.6254, 0.3693, 0.0355, 0.0584]]
[0201] The first feature matrix determination method provided in the embodiment of the present application obtains a feature vector by one-hot encoding the first attribute information of the first metadata, and obtains the first feature matrix by word vector encoding the feature vector and preset features using a word vector encoder, which can improve the accuracy of the metadata information, and further improve the accuracy of determining whether the metadata is updated.
[0202] Figure 5 A flow chart of a method for determining a feature vector provided in an embodiment of the present application, the method comprising:
[0203] S501: Add custom attribute information to first metadata to obtain first metadata after the custom attribute information is added.
[0204] Among them, the custom attribute information may include the current network quality of the microservice gateway.
[0205] In an embodiment of the present application, the first metadata includes four attribute information: microservice definition content, definition text length, definition modification time, and configuration center cluster identifier. On the basis of the original four attribute information, a custom attribute information is added, and the first metadata after adding the custom attribute information (microservice definition content, definition text length, definition modification time, configuration center cluster identifier, and current network quality of the microservice gateway).
[0206] It should be noted that the current network quality of the microservice gateway is described by the number of reconnections with the configuration center. For example, the initial value of the current network quality of the microservice gateway is defined as 1. When the microservice gateway reconnects with the configuration center C once, the updated value of the current network quality of the microservice gateway = the initial value of the current network quality of the microservice gateway / 2, that is, 0.5; when the microservice gateway reconnects with the configuration center C twice, the updated value of the current network quality of the microservice gateway = quality / 3, that is, 0.3.
[0207] Perform one-hot encoding on the first metadata to obtain a feature vector, including:
[0208] S502: One-hot encode the first metadata after adding the custom attribute information to obtain a feature vector.
[0209] In the embodiment of the present application, the microservice gateway performs one-hot encoding on the first metadata after adding the custom attribute information to obtain a feature vector. Specifically, since the metadata does not contain Chinese but is in English, an English dictionary can be used for one-hot encoding to obtain a feature vector. The feature vector of the first metadata after adding the custom attribute information can be expressed as [28, 33, 30, 0, 9, 3, 12, 30, 2, 12, 11, 20, 5, 36, 30, 20, 11, 5, 31, 30, 0, 9, 3, 12, 30, 7, 23, 9, 30, 0, 33, 3, 11, 4, 2, 7, 5, 37, 23, 18, 35, 35, 2, 19, 32, 32, 7, 23, 0, 30, 26, 3, 33, 29, 30, 0, 13, 3, 20, 30, 2, 14, 37, 14, 14, 37, 21, 14, 17, 1, 14, 37, 2, 37, 37, 2, 37, 37, 5, 37 ,37,37,23,36,12,2,37,37,7,23,20,30,29,15,11,36,33,2,8,28,20,30,29,15,11,36,24,18,20,30,2,27,11,26,3,4,23,35,18,0,18,20,13,10,35,30,2,6,18,9,18,5,22,29,3,27,5,16,18,35,23,0,30,29,22,0,4,13,10,35,30,2,6,18,9,18,5,22,29,3,27,5,16,18,35,25,34,25]
[0210] The feature vector determination method provided in the embodiment of the present application adds custom attribute information to the first metadata to obtain the first metadata after the custom attribute information is added, and then performs one-hot encoding on the first metadata after the custom attribute information is added to obtain the feature vector. This method can improve the accuracy of the metadata information, and further improve the accuracy of determining whether the metadata is updated.
[0211] In one embodiment, this embodiment relates to a possible implementation method of how to determine whether to use the first metadata to update the second metadata according to the similarity. Based on the above embodiment, the above S204 includes:
[0212] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0213] In the embodiment of the present application, if the similarity between the first metadata and the second metadata is greater than or equal to the preset similarity threshold, it is determined that the first metadata is used to update the second metadata, and the gateway is refreshed to the first metadata. If the similarity between the first metadata and the second metadata is 80% or more, that is, most of them are positive samples, it is determined that the first metadata is used to update the second metadata.
[0214] The embodiment of the present application provides a method for determining whether to use the first metadata to update the second metadata based on similarity. When the similarity is greater than or equal to a preset similarity threshold, it is determined that the first metadata is used to update the second metadata, thereby improving the accuracy of determining whether the metadata is updated, thereby avoiding the metadata coverage problem caused by human error in the same microservice metadata or because the microservice gateway is associated with different configuration centers.
[0215] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0216] Based on the same inventive concept, the embodiment of the present application also provides a data updating device for implementing the data updating method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data updating device embodiments provided below can refer to the limitations on the data updating method above, and will not be repeated here.
[0217] In one embodiment, Figure 6 As shown, a metadata updating device 600 in a microservice gateway is provided, comprising: a receiving module 601, a first determining module 602, a second determining module 603 and a prohibiting module 604, wherein:
[0218] The receiving module 601 is used to receive the first metadata of the target microservice sent by the configuration center when the microservice gateway establishes a communication connection with the configuration center.
[0219] The first determining module 602 is configured to obtain a first feature matrix according to the first metadata.
[0220] The second determination module 603 is used to determine the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata if the second metadata of the microservice has been cached in the microservice gateway.
[0221] The prohibition module 604 prohibits using the first metadata to update the second metadata if the similarity is less than the preset similarity threshold.
[0222] In one embodiment, the prohibition module 604 includes:
[0223] A first acquisition unit, configured to acquire first attribute information of the first metadata and second attribute information of the second metadata if the similarity is less than the preset similarity threshold;
[0224] The prohibition unit is used to prohibit the use of the first metadata to update the second metadata if the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition.
[0225] In one embodiment, the inhibiting unit comprises:
[0226] A prohibition subunit is used to prohibit the use of the first metadata to update the second metadata if at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset time length, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs.
[0227] In one embodiment, the first determining module 602 includes:
[0228] A first determining unit, configured to perform one-hot encoding on the first attribute information of the first metadata to obtain a feature vector;
[0229] The second determining unit is used to use a word vector encoder to perform word vector encoding on the feature vector and the preset feature to obtain the first feature matrix.
[0230] In one embodiment, the device further comprises:
[0231] A third determining module is used to add the custom attribute information to the first metadata to obtain the first metadata after the custom attribute information is added;
[0232] The fourth determination module, used for performing one-hot encoding on the first metadata to obtain a feature vector, includes:
[0233] The third determining unit is used to perform one-hot encoding on the first metadata after the custom attribute information is added to obtain the feature vector.
[0234] In one embodiment, the device further comprises:
[0235] The fifth determining module is configured to determine to use the first metadata to update the second metadata if the similarity is greater than or equal to the preset similarity threshold.
[0236] Each module in the above data updating device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0237] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data update method is implemented.
[0238] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0239] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0240] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0241] Obtaining a first feature matrix according to the first metadata;
[0242] If the microservice gateway has cached the second metadata of the microservice, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0243] If the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0244] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0245] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0246] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0247] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0248] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0249] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0250] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0251] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0252] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0253] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0254] The first metadata is one-hot encoded to obtain a feature vector, including:
[0255] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0256] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0257] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0258] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0259] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0260] Obtaining a first feature matrix according to the first metadata;
[0261] If the microservice gateway has cached the second metadata of the microservice, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0262] If the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0263] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0264] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0265] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0266] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0267] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0268] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0269] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0270] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0271] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0272] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0273] The first metadata is one-hot encoded to obtain a feature vector, including:
[0274] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0275] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0276] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0277] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0278] When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center;
[0279] Obtaining a first feature matrix according to the first metadata;
[0280] If the microservice gateway has cached the second metadata of the microservice, determining the similarity between the first metadata and the second metadata according to the first feature matrix and the second feature matrix corresponding to the second metadata;
[0281] If the similarity is less than the preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
[0282] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0283] If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata;
[0284] If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
[0285] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0286] If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
[0287] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0288] Perform one-hot encoding on the first metadata to obtain a feature vector;
[0289] The feature vector and the preset features are encoded using a word vector encoder to obtain the first feature matrix.
[0290] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0291] Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added;
[0292] The first metadata is one-hot encoded to obtain a feature vector, including:
[0293] The feature vector is obtained by performing one-hot encoding on the first metadata after the custom attribute information is added.
[0294] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0295] If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
[0296] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0297] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0298] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0299] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for updating metadata in a microservice gateway, characterized in that: The method comprises: When the microservice gateway establishes a communication connection with the configuration center, receiving first metadata of the target microservice sent by the configuration center; the first metadata includes at least one of microservice definition content, definition text length, definition modification time, and configuration center cluster identifier; Obtaining a first feature matrix according to the first metadata; If the second metadata of the microservice has been cached in the microservice gateway, the similarity between the first metadata and the second metadata is determined according to a second feature matrix corresponding to the first feature matrix and the second metadata; the second feature matrix is obtained by encoding a feature vector of the second metadata after one-hot encoding; If the similarity is less than a preset similarity threshold, it is prohibited to use the first metadata to update the second metadata.
2. The method according to claim 1, characterized in that If the similarity is less than the preset similarity threshold, prohibiting the use of the first metadata to update the second metadata includes: If the similarity is less than the preset similarity threshold, obtaining first attribute information of the first metadata and second attribute information of the second metadata; If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, it is prohibited to use the first metadata to update the second metadata.
3. The method according to claim 2, characterized in that If the first attribute information of the first metadata and the second attribute information of the second metadata meet a preset configuration condition, prohibiting the use of the first metadata to update the second metadata includes: If at least one of the following conditions is met: the difference between the modification timestamp of the first metadata and the modification timestamp of the second metadata is greater than or equal to a preset duration, and the identifier of the configuration center to which the first metadata belongs is different from the identifier of the configuration center to which the second metadata belongs, then it is prohibited to use the first metadata to update the second metadata.
4. The method according to claim 2 or 3, characterized in that: The obtaining a first feature matrix according to the first metadata includes: One-hot encoding the first metadata to obtain a feature vector; The feature vector and the preset feature are encoded by a word vector encoder to obtain the first feature matrix.
5. The method according to claim 4, characterized in that The method further comprises: Adding custom attribute information to the first metadata to obtain first metadata after the custom attribute information is added; The one-hot encoding of the first metadata to obtain a feature vector includes: The feature vector is obtained by performing one-hot encoding on the first metadata after adding the custom attribute information.
6. The method according to claim 1, characterized in that The method further comprises: If the similarity is greater than or equal to the preset similarity threshold, it is determined to use the first metadata to update the second metadata.
7. A metadata updating device in a microservice gateway, characterized in that: The device comprises: A receiving module, configured to receive first metadata of a target microservice sent by the configuration center when the microservice gateway establishes a communication connection with the configuration center; the first metadata includes at least one of microservice definition content, definition text length, definition modification time, and configuration center cluster identifier; A first determining module, configured to obtain a first feature matrix according to the first metadata; A second determination module is used to determine the similarity between the first metadata and the second metadata according to a second feature matrix corresponding to the first feature matrix and the second metadata if the second metadata of the microservice has been cached in the microservice gateway; the second feature matrix is obtained by encoding the feature vector of the second metadata after one-hot encoding; The prohibition module prohibits using the first metadata to update the second metadata if the similarity is less than a preset similarity threshold.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
