Single-point code adjusting method and device

Through shadow service backtracking error handling and training and application of preset code models, single-point obstacle points in business code are automatically identified and repaired, solving the problem that the code cannot run normally after horizontal expansion, and realizing automatic code adjustment and server adjustment stable expansion.

CN119440617APending Publication Date: 2025-02-14SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411550179.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The existing technology is difficult to automatically adjust the single point of business code on the server after horizontal expansion, resulting in the code not being able to run normally.

Method used

The single-point obstacle point is determined through shadow service backtracking error processing, and the sample code training marked single-point obstacle point is obtained to obtain the preset code model, and the single-point obstacle point in the code to be adjusted is identified and repaired based on the preset code model.

Benefits of technology

It realizes automatic identification and repair of single-point problems in business code, ensuring that the code can run normally on the server after horizontal expansion, and solving the problem that single-point problems affect horizontal expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440617A_ABST
    Figure CN119440617A_ABST
Patent Text Reader

Abstract

The invention discloses a single-point code adjustment method and device. The method comprises the steps that a to-be-adjusted code is acquired; inputting the to-be-adjusted code into a preset code model obtained by training, identifying and determining the code of the single-point blocking point contained in the to-be-adjusted code by the preset code model, and repairing the code of the single-point blocking point to obtain an adjusted code; wherein the preset code model is obtained by training based on a sample code marked with a single-point blocking point, and the sample code marked with the single-point blocking point is obtained by executing shadow service backtracking error processing; the shadow service is obtained according to the single-point service of the copied sample code. The method comprises the steps of obtaining a single-point blocking point through shadow service backtracking errors, obtaining a preset code model through training by utilizing a sample code marking the single-point blocking point, identifying and determining the single-point blocking point in a code to be adjusted based on the preset code model, and repairing based on the code of the identified single-point blocking point. The problem that a single-point hindering point code affects horizontal capacity expansion is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a single-point code adjustment method and device. Background Art

[0002] When deploying business code, it can be deployed to a remote server (such as a physical instance, k8s instance, etc.). However, since the server itself also has a performance and capacity load limit, when the load limit is reached, it needs to be expanded horizontally. Horizontal expansion can be achieved by manual or adaptive expansion solutions. However, due to problems with the way the code was written or used, it cannot run normally on the server after horizontal expansion. And because the business is different, the code of different businesses is written and used differently. Only solving a single point problem in a business code cannot automatically adjust the single point problems in other codes.

[0003] Therefore, a single-point code adjustment method is also needed to adapt to each business code and automatically correct single-point problems in the code. Summary of the invention

[0004] In view of the above problems, embodiments of the present application are proposed to provide a single-point code adjustment method and device that overcome the above problems or at least partially solve the above problems.

[0005] According to a first aspect of an embodiment of the present application, a single-point code adjustment method is provided, which includes:

[0006] Get the code to be adjusted;

[0007] The code to be adjusted is input into the trained preset code model, and the preset code model identifies and determines the code of the single-point blocking point contained in the code to be adjusted, and repairs the code of the single-point blocking point to obtain the adjusted code; wherein, the preset code model is trained based on the sample code marking the single-point blocking point, and the sample code marking the single-point blocking point is obtained by executing the shadow service backtracking error processing; the shadow service is obtained based on the single-point service of the copied sample code.

[0008] Optionally, the method further comprises:

[0009] According to the single-point service deployed by the sample code, copy the corresponding shadow service;

[0010] The shadow service and the single point service are executed in isolation, and a first execution result of the shadow service and a second execution result of the single point service are obtained respectively;

[0011] If the first execution result is inconsistent with the second execution result, backtracking error processing is performed on the shadow service to obtain a single point of obstruction in the sample code.

[0012] Optionally, the method further comprises:

[0013] Get sample code; the sample code is the sample code in the code repository;

[0014] Mark the single point of obstruction of the sample code; the single point of obstruction is obtained based on the error handling of the shadow service backtrace;

[0015] The marked sample code is input into the preset code model, the preset code model extracts features according to the single-point obstruction point, and is trained according to the extracted features to obtain a trained preset code model; the preset code model determines the corresponding repair code according to the features of the single-point obstruction point.

[0016] Optionally, the method further comprises:

[0017] Get the test code;

[0018] The trained preset code model is evaluated according to the test code to optimize the preset code model.

[0019] Optionally, the preset code model performs feature extraction based on the single-point blocking point as follows: the preset code model performs feature extraction based on the marked single-point blocking point to obtain the features of the single-point blocking point, and the features of the single-point blocking point include: global state code, shared resource code, synchronization operation code, non-safe thread code and / or concurrent operation code.

[0020] Optionally, the preset code model determines the corresponding repair code according to the characteristics of the single-point blocking point:

[0021] The preset code model determines the feature identification of the code of the single-point obstruction point according to the extracted features;

[0022] The repair code of the single-point blocking point is determined according to the feature identifier and the preset repair rule corresponding to the feature identifier; the repair code is constructed based on the preset middleware component.

[0023] Optionally, the method further comprises:

[0024] Horizontally expand the server capacity based on the adjusted code.

[0025] According to a second aspect of an embodiment of the present application, a single-point code adjustment device is provided, comprising:

[0026] An acquisition module, adapted to acquire the code to be adjusted;

[0027] The adjustment module is suitable for inputting the code to be adjusted into the preset code model obtained by training, and the preset code model identifies and determines the code of the single-point blocking point contained in the code to be adjusted, and repairs the code of the single-point blocking point to obtain the adjusted code; wherein, the preset code model is trained based on the sample code for marking the single-point blocking point, and the sample code for marking the single-point blocking point is obtained by executing the shadow service backtracking error processing; the shadow service is obtained based on the single-point service of copying the sample code.

[0028] According to a third aspect of an embodiment of the present application, there is provided a computing device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0029] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned single-point code adjustment method.

[0030] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned single-point code adjustment method.

[0031] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the above-mentioned single-point code adjustment method.

[0032] According to the single-point code adjustment method and device provided in the present application, a single-point blocking point is obtained by backtracing errors through shadow services, a preset code model is obtained by training with sample codes that mark the single-point blocking point, the single-point blocking point in the code to be adjusted is identified based on the preset code model, and repairs are performed based on the code of the identified single-point blocking point, so as to overcome the problem of the single-point blocking point code affecting horizontal expansion.

[0033] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0035] Figure 1A flow chart of a single-point code adjustment method according to an embodiment of the present application is shown;

[0036] Figure 2 A flow chart of a single-point code adjustment method according to another embodiment of the present application is shown;

[0037] Figure 3 A schematic diagram of the structure of a single-point code adjustment device according to an embodiment of the present application is shown;

[0038] Figure 4 A schematic diagram of the structure of a computing device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0039] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0040] First, the terms involved in one or more embodiments of the present application are explained.

[0041] Horizontal expansion: A method of increasing the performance, capacity, or availability of a system by increasing the number of resources of the same type in the system. In software systems, this usually refers to adding specific machines or instances.

[0042] Single point system: A machine or instance that provides services in a computer service and cannot be horizontally expanded due to code problems.

[0043] Figure 1 A flow chart of a single-point code adjustment method according to an embodiment of the present application is shown. Figure 1 As shown, the method comprises the following steps:

[0044] Step S101, obtaining the code to be adjusted.

[0045] A single-point system is a system with a single point of obstruction. The code of a single point of obstruction refers to the code that cannot be executed normally in the system after horizontal expansion. In order to ensure that the system can execute normally after horizontal expansion, the code needs to be adjusted first to remove the single point of obstruction in the code.

[0046] For the code to be adjusted, you can obtain the code to be adjusted in units of code files, or you can obtain the code to be adjusted for a business function in units of business, such as obtaining the code to be adjusted related to business function A, etc. The specific setting is based on the implementation situation and is not limited here.

[0047] The code to be adjusted can be obtained by, for example, reading the online code of the business, obtaining the code of the code repository, such as the code in the git repository, etc. The code to be adjusted in the same code repository uses the same language, has a clear distinction between business modules and logic processing modules, and focuses on the commonality of the code (the same writing method, usage method, and middleware components called). The code of the single point of obstruction in the code in the same code repository will also have commonality. Adjusting and repairing the code to be adjusted in the same code repository can facilitate the adjustment of the code to be adjusted in the same writing method, usage method, and using the same middleware components.

[0048] Step S102, inputting the code to be adjusted into the preset code model obtained by training, identifying and determining the code of the single-point blocking point contained in the code to be adjusted by the preset code model, and repairing the code of the single-point blocking point to obtain the adjusted code.

[0049] For the code to be adjusted, the code to be adjusted can be identified based on a preset code model, and the code of the single-point blocking point contained in the code to be adjusted can be determined so as to repair it.

[0050] The preset code model is obtained after training based on sample codes marked with single-point blocking points, that is, according to the sample data set with marked labels, CNN (Convolutional Neural Networks) or RNN (Recurrent Neural Network) can be used for training, the sample data set is input, and the loss function is defined through operations such as convolution, activation function, and pooling, so that the loss function of the model is as small as possible to obtain the trained preset code model. The preset code model is trained by learning the characteristics of single-point blocking points. Different single-point blocking points have different characteristics. The characteristics of each single-point blocking point are learned through training, and then the codes of each single-point blocking point can be identified from the code to be adjusted based on the trained preset code model. For example, the code of the single-point blocking point is: an independent var record, which is a global state. When the server is horizontally expanded, the var record may be modified by the horizontally expanded server during execution, resulting in incorrect final execution results. When repairing the code of each single point of obstruction, different repair codes can be used according to the codes of different single points of obstruction. When repairing, middleware components, SDK components, etc. can be used, such as importing middleware components, using the functions of middleware components, etc., to protect and lock the code that is only executable at a single point, so that horizontal expansion will not affect the effect of the original single point execution, such as locking independent var records during execution, such as:

[0051] lock

[0052] Independent var record

[0053] unlock

[0054] By locking independent var records, the modification of independent var records during the execution of horizontally expanded servers is avoided, ensuring the independence and accuracy of code execution, thereby completing the code repair of single-point blocking points. The above is an example. The corresponding repair code is set according to the specific situation of the single-point blocking point, which is not limited here.

[0055] When marking the sample code of the single-point blocking point, it can be manually marked, but it costs a lot of labor costs, and manual marking needs to rely heavily on manual experience, which is prone to problems such as missing marking and wrong marking. Based on the above problems, this embodiment adopts a shadow service. Specifically, after the sample code is put online, a single-point service is obtained. The shadow service is obtained by copying the single-point service of the sample code. At the same time, various traffic and data used by the single-point service are also copied together. The shadow service obtained is a service that is completely consistent with the single-point service. The traffic and data used by the shadow service execution are also consistent with the traffic and data used by the single-point service execution. The single-point service is executed normally, and the execution of the shadow service is isolated from the single-point service. The shadow service is executed in a horizontally expanded server environment, and the respective execution results of the shadow service and the single-point service can be obtained. The execution result of the single-point service is taken as the correct execution result, so that the wrong execution result when the shadow service is executed can be determined, and the wrong execution result is backtracked and error processed. The code of the single-point blocking point in the sample code when it is executed in the horizontally expanded server environment can be determined by, for example, log backtracking, data backtracking, etc.

[0056] When training the preset code model, in order to ensure the accuracy of the preset code model after training, more sample codes can be obtained, and the single-point blocking points in the sample codes can be quickly and accurately determined and marked through the shadow service. Alternatively, after the single-point blocking points in the sample code are determined through the shadow service, the single-point blocking points obtained are sufficient to cover various sample codes. The determined single-point blocking points can be used to mark other sample codes, and there is no need to copy each sample code to obtain the shadow service for determination. The above is an example, which is set according to the implementation situation and is not limited here.

[0057] According to the single-point code adjustment method provided in the present application, a single-point blocking point is obtained by backtracing errors through shadow services, a preset code model is obtained by training with sample codes that mark the single-point blocking point, the single-point blocking point in the code to be adjusted is identified based on the preset code model, and repairs are performed based on the code of the identified single-point blocking point to overcome the problem of the single-point blocking point code affecting horizontal expansion.

[0058] Figure 2A flow chart of a single-point code adjustment method according to an embodiment of the present application is shown. Figure 2 As shown, the method comprises the following steps:

[0059] Step S201, according to the single-point service after the sample code is deployed, copy the corresponding shadow service, isolate the shadow service and the single-point service for execution, and obtain the first execution result of the shadow service and the second execution result of the single-point service respectively. If the first execution result is inconsistent with the second execution result, backtrack the error processing of the shadow service to obtain the single-point blocking point in the sample code.

[0060] The code of the single point of obstruction can be executed normally on a single point server that has not been horizontally expanded, but cannot be executed normally on a horizontally expanded server. Therefore, the code of the single point of obstruction in the code needs to be adjusted to facilitate horizontal expansion of the server.

[0061] In this embodiment, the code for the single point of obstruction is determined by executing the shadow service to reduce the time and labor cost spent on manual inspection, reduce the strong dependence on manual inspection experience, and avoid problems such as missed inspection and false inspection. Specifically, some sample codes can be selected, which can also be used as basic data for subsequent training of preset code models. When obtaining sample codes, sample codes can be selected based on code repositories, such as git repositories. The code language system and framework used in the same code repository are unified, and business modules can be clearly distinguished (specific business processing can be distinguished to avoid affecting business functions during repair, etc.), and commonality can be clustered to facilitate identification training. After the sample code is deployed, an online single point service is obtained. Based on the single point service, copying is performed. For example, for the single point service of serviceA, the shadow service of shadowServiceA is copied, and the two are completely consistent. In addition, the traffic, data, etc. related to serviceA are copied together for the single point service of serviceA, and the traffic, data, etc. related to serviceA are copied and stored separately from the original traffic, data, etc. of serviceA. In an environment where the single point service of serviceA can be executed normally, the single point service of serviceA is executed to obtain the second execution result of the single point service of serviceA. The shadow service of shadowServiceA is executed in isolation from the single-point service of serviceA to avoid data affecting each other during execution and to avoid affecting their respective execution results, thereby obtaining the first execution result of the shadow service of shadowServiceA. For example, the data obtained in the second execution result of the single-point service of serviceA includes data1 and data2, and the data obtained in the first execution result of the shadow service of shadowServiceA includes data1 and data3. The first execution result and the second execution result are compared. If the first execution result is inconsistent with the second execution result, such as data3 and data2 are inconsistent, it indicates that there is a single-point obstruction point in the shadow service of shadowServiceA. The single-point obstruction point in the sample code can be obtained by backtracing the error processing of the shadow service. Backtracing error processing can be performed through the function call sequence recorded during the execution process, the generated log information, the stored database data, etc., or it can be backtraced through backtracing tools, etc. to obtain the code-related line number of the single-point obstruction point, the function to which it belongs, and other information, thereby determining the single-point obstruction point in the sample code.

[0062] In addition to using shadow services to determine single-point blocking points in the sample code, you can also write code containing specific single-point blocking points to supplement the marking of single-point blocking points, so as to facilitate subsequent training of preset code models. The above is an example, which is set according to the implementation situation and is not limited here.

[0063] Step S202, obtain sample code, mark the single-point blocking point of the sample code, input the marked sample code into a preset code model, extract features of the preset code model according to the single-point blocking point, train according to the extracted features, and obtain a trained preset code model.

[0064] The sample code may be the sample code obtained above, which has determined the single-point blocking point of the sample code, has marked or recorded the single-point blocking point, and can be marked directly according to the record. Alternatively, the sample code is newly obtained, based on the various single-point blocking points obtained by the shadow service, and the relevant single-point blocking points in the code are searched and marked. When marking, it can be marked by adding comments, such as: independent var record / / single-point blocking point. The above is an example, which is set according to the implementation situation and is not limited here.

[0065] The marked sample code is input into the preset code model. The preset code model can extract features based on the marked single-point blocking points to obtain the features of the single-point blocking points, thereby determining which code is the single-point blocking point code. The features of single-point blocking points include global state code, shared resource code, synchronous operation code, non-safe thread code, concurrent operation code, etc. For example, in a horizontally expanded server, if the frequency of use is high, the relevant logic needs to call the global state code, shared resource code, etc., which may cause bottlenecks and affect performance. For example, after horizontal expansion, different server nodes may have problems such as data mutual influence when executing synchronous operation code, non-safe thread code, concurrent operation code, etc. The preset code model learns the marked sample code, extracts features based on the single-point blocking points, and trains based on the extracted features to obtain the trained preset code model.

[0066] Furthermore, when the preset code model identifies and determines the code of a single-point blocking point, it can determine the feature identifier of the code corresponding to the single-point blocking point according to different single-point blocking points. Different single-point blocking points have different feature identifiers. The preset code model determines different corresponding repair codes according to the different features of the single-point blocking point. After the preset code model identifies and determines the single-point blocking point in the sample code, it records the corresponding feature identifier for the single-point blocking point according to the feature of the single-point blocking point, and determines the repair code of the single-point blocking point according to the preset repair rules corresponding to the feature identifier. The preset repair rules can be pre-set. For example, if the feature of the single-point blocking point is a global state, shared resources, etc., the code is: independent var record, and the repair code can be: lock independent var record unlock. The feature of the single-point blocking point is a large number of synchronous operation codes, such as the code is: ticker("0 0 0 0 0"), and the repair code can be:

[0067] railgun.ticker(config). The characteristic of a single point of obstruction is non-thread-safe code, such as the code: varmap map[*]*map[key]=value, and the repair code is: var map map[*]*sync map[key]=value. The characteristic of a single point of obstruction is concurrent operation code, such as the code: init(){goprocess()}, and the repair code is: lockgo process()unlock. Based on the characteristic identification of different single point obstruction points, according to the preset repair rules, the preset code model can provide repair code to replace the code of the single point of obstruction point and implement code repair and adjustment. During repair, the repair code used by the preset code model can include, for example, adding a lock, and can also be built based on the preset middleware component, referencing the middleware component, such as adding import xx, using middleware components such as railgun.ticker, etc., to solve the single point execution problem without affecting business functions. If there is only one repair code to choose from, the preset code model can directly use the repair code to replace the code of the single-point blocking point. If the repair code can have multiple different repair codes, the preset code model can provide different repair codes for selection, and perform repair adjustments on the single-point blocking point according to the selected repair code. Furthermore, based on the selected repair code, the priority of different repair codes can be determined, and the repair code can be automatically selected for repair adjustment according to the priority, etc., which is not limited here.

[0068] For the preset code model, the following code can be used to implement the feature conversion of a single-point blocking point, such as:

[0069]

[0070]

[0071] The above code is an example, for example, by counting the keywords of the code of the single-point blocking point, extracting features, identifying the features of the single-point blocking point, etc. The specific settings are based on the implementation situation and are not limited here.

[0072] Step S203, obtaining a test code, and performing a model evaluation on the trained preset code model according to the test code to optimize the preset code model.

[0073] After the preset code model is obtained through training, in order to further improve the accuracy of the preset code model, a test code may be used to perform model evaluation on the trained preset code model.

[0074] The test code is a sample code with a single-point blocking point marked. Some data can be retained from the sample code as the test code. The trained preset code model can be evaluated. The preset code model can be optimized based on an optimizer to improve the accuracy of the preset code model.

[0075] Step S204, obtaining the code to be adjusted.

[0076] The code to be adjusted is obtained in units of code files, or the code to be adjusted for implementing a business function is obtained in units of business, and there is no limitation here.

[0077] Step S205, input the code to be adjusted into the trained preset code model, identify and determine the single-point blocking point code contained in the code to be adjusted by the preset code model, and repair the single-point blocking point code to obtain the adjusted code.

[0078] The code to be adjusted can be input as a whole into the preset code model obtained through training, and the preset code model can identify each code to be adjusted respectively, and determine the single-point blocking point code contained in each code to be adjusted. During identification, if the code to be adjusted does not contain the code of the single-point blocking point, there is no need to record the feature identifier of the single-point blocking point. If the code to be adjusted contains the code of the single-point blocking point, the corresponding feature identifier is recorded at the code position of the single-point blocking point in the code to be adjusted according to the different features of the single-point blocking point. The feature identifier can be marked by means such as comments. According to the feature identifiers of the codes of each single-point blocking point recorded in the code to be adjusted, different repair codes are used to repair it. During repair, the code of the single-point blocking point can be adjusted and repaired by means such as adding a lock, introducing a preset middleware component, using the function of the middleware, etc., so that the adjusted code can be obtained.

[0079] The code fix in the adjusted code will not affect the original business functions. It is only an adjustment to the writing and use of the single point blocking point code so that the adjusted code can be applied to the horizontal expansion of the server. Furthermore, useless comments in the adjusted code, such as the feature markers of the single point blocking point, can be deleted.

[0080] Step S206, performing horizontal expansion of the server according to the adjusted code.

[0081] After the adjusted code is deployed online, the server can be expanded horizontally, such as increasing the number of servers or instances, upgrading server configurations, etc., to improve storage capacity, computing power, etc., to disperse the load and improve the processing power of the server.

[0082] According to the single-point code adjustment method provided by the present application, a shadow service is obtained by copying a single-point service. After executing the shadow service, data that is inconsistent with the first execution result and the second execution result is determined. The code of the single-point blocking point can be obtained by backtracking the inconsistent data. The code of the single-point blocking point is marked as a sample code for training to obtain a preset code model. The preset code model can extract features to determine the feature identifier of the code of the single-point blocking point, determine the repair code of the single-point blocking point according to the preset repair rule corresponding to the feature identifier, and complete the repair of the code to be adjusted, thereby overcoming the problem that the code of the single-point blocking point affects horizontal expansion.

[0083] Figure 3 FIG. 1 is a schematic diagram showing the structure of a single-point code adjustment device provided by an embodiment of the present application. Figure 3 As shown, the device comprises:

[0084] An acquisition module 310, adapted to acquire a code to be adjusted;

[0085] The adjustment module 320 is suitable for inputting the code to be adjusted into the preset code model obtained by training, and the preset code model identifies and determines the code of the single-point blocking point contained in the code to be adjusted, and repairs the code of the single-point blocking point to obtain the adjusted code; wherein, the preset code model is trained based on the sample code for marking the single-point blocking point, and the sample code for marking the single-point blocking point is obtained by executing the shadow service backtracking error processing; the shadow service is obtained based on the single-point service of copying the sample code.

[0086] Optionally, the device also includes: a backtracking module 330, which is suitable for copying the corresponding shadow service according to the single-point service after the sample code is deployed; isolating the shadow service and the single-point service to execute, and respectively obtaining a first execution result of the shadow service and a second execution result of the single-point service; if the first execution result is inconsistent with the second execution result, backtracking error processing is performed on the shadow service to obtain the single-point blocking point in the sample code.

[0087] Optionally, the device also includes: a training module 340, suitable for obtaining sample code; the sample code is a sample code in a code repository; a single-point blocking point of the sample code is marked; the single-point blocking point is obtained based on the shadow service backtracing error processing; the marked sample code is input into a preset code model, the preset code model performs feature extraction based on the single-point blocking point, and is trained based on the extracted features to obtain a trained preset code model; the preset code model determines the corresponding repair code based on the features of the single-point blocking point.

[0088] Optionally, the device further includes: an optimization module 350, adapted to obtain a test code; and perform model evaluation on the trained preset code model according to the test code to optimize the preset code model.

[0089] Optionally, the training module 340 is further adapted to: a preset code model performs feature extraction based on the marked single-point blocking point to obtain features of the single-point blocking point, and the features of the single-point blocking point include: global state code, shared resource code, synchronization operation code, non-safe thread code and / or concurrent operation code.

[0090] Optionally, the training module 340 is further adapted to: a preset code model determines a feature identifier of the code of a single-point obstruction point based on the extracted features; determines a repair code of the single-point obstruction point based on the feature identifier and a preset repair rule corresponding to the feature identifier; and the repair code is constructed based on a preset middleware component.

[0091] Optionally, the device further includes: an expansion module 360, adapted to perform horizontal expansion of the server according to the adjusted code.

[0092] The description of each module above refers to the corresponding description in the method embodiment and will not be repeated here.

[0093] According to the single-point code adjustment device provided by the present application, a single-point blocking point is obtained by backtracing errors through shadow services, a preset code model is obtained by training with sample codes that mark the single-point blocking point, the single-point blocking point in the code to be adjusted is identified based on the preset code model, and repairs are performed based on the code of the identified single-point blocking point, so as to overcome the problem that the code of the single-point blocking point affects horizontal expansion.

[0094] The present application also provides a non-volatile computer storage medium, which stores at least one executable instruction, and the executable instruction can execute the operation corresponding to the single-point code adjustment method in any of the above method embodiments.

[0095] The present application also provides a computer program product, which includes at least one executable instruction or computer program, and the executable instruction or computer program can enable a processor to perform operations corresponding to the single-point code adjustment method in any of the above method embodiments.

[0096] Figure 4 A schematic diagram of the structure of a computing device according to an embodiment of the present application is shown. The specific embodiment of the present application does not limit the specific implementation of the computing device.

[0097] like Figure 4 As shown, the computing device may include: a processor (processor) 402 , a communications interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .

[0098] in:

[0099] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .

[0100] The communication interface 404 is used to communicate with other devices such as clients or other servers.

[0101] The processor 402 is used to execute the program 410, and specifically can execute the relevant steps in the above-mentioned single-point code adjustment method embodiment.

[0102] Specifically, the program 410 may include program codes, which include computer operation instructions.

[0103] The processor 402 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the present application. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0104] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0105] The program 410 can be specifically used to enable the processor 402 to execute the single-point code adjustment method in any of the above-mentioned method embodiments. The specific implementation of each step in the program 410 can refer to the corresponding descriptions in the corresponding steps and units in the above-mentioned single-point code adjustment embodiments, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, which will not be repeated here.

[0106] The algorithm or display provided here is not inherently related to any specific computer, virtual system or other device. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the application described here, and the above description of specific languages ​​is to disclose the preferred embodiment of the application.

[0107] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0108] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.

[0109] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0110] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0111] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0112] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be constructed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A single-point code adjustment method, comprising: Get the code to be adjusted; The code to be adjusted is input into a preset code model obtained by training, the preset code model identifies and determines the code of the single-point blocking point contained in the code to be adjusted, and repairs the code of the single-point blocking point to obtain the adjusted code; wherein the preset code model is trained based on a sample code for marking a single-point blocking point, and the sample code for marking a single-point blocking point is obtained by executing a shadow service backtracking error processing; The shadow service is obtained by copying the single-point service of the sample code.

2. The method according to claim 1, wherein: The method further comprises: According to the single-point service deployed by the sample code, copy the corresponding shadow service; The shadow service and the single point service are executed in isolation, and a first execution result of the shadow service and a second execution result of the single point service are obtained respectively; If the first execution result is inconsistent with the second execution result, backtracking error processing is performed on the shadow service to obtain a single point of obstruction in the sample code.

3. The method according to claim 1 or 2, wherein: The method further comprises: Obtain sample code; the sample code is a sample code in a code repository; Marking a single point of obstruction of the sample code; the single point of obstruction is obtained according to the shadow service backtracking error processing; The marked sample code is input into a preset code model, the preset code model extracts features according to the single-point obstruction point, and is trained according to the extracted features to obtain a trained preset code model; the preset code model determines the corresponding repair code according to the features of the single-point obstruction point.

4. The method according to claim 3, wherein: After obtaining the trained preset code model, the method further includes: Get the test code; Model evaluation is performed on the trained preset code model according to the test code to optimize the preset code model.

5. The method according to claim 3, wherein: The preset code model performs feature extraction based on the single-point blocking point specifically as follows: the preset code model performs feature extraction based on the marked single-point blocking point to obtain the features of the single-point blocking point, and the features of the single-point blocking point include: global state code, shared resource code, synchronization operation code, non-safe thread code and / or concurrent operation code.

6. The method according to claim 3, wherein: The preset code model determines the corresponding repair code according to the characteristics of the single-point blocking point: The preset code model determines the feature identifier of the code of the single-point obstruction point according to the extracted features; The repair code of the single-point blocking point is determined according to the feature identifier and a preset repair rule corresponding to the feature identifier; the repair code is constructed based on a preset middleware component.

7. The method according to any one of claims 1 to 6, wherein: The method further comprises: Horizontally expand the server capacity based on the adjusted code.

8. A single-point code adjustment device, comprising: An acquisition module, adapted to acquire the code to be adjusted; an adjustment module, adapted to input the code to be adjusted into a preset code model obtained by training, identify and determine the code of the single-point blocking point contained in the code to be adjusted by the preset code model, and repair the code of the single-point blocking point to obtain the adjusted code; wherein the preset code model is trained based on a sample code for marking a single-point blocking point, and the sample code for marking a single-point blocking point is obtained by executing a shadow service backtracking error processing; The shadow service is obtained by copying the single-point service of the sample code.

9. A computing device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the single-point code adjustment method according to any one of claims 1-7.

10. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the single-point code adjustment method according to any one of claims 1 to 7.

11. A computer program product, comprising at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the single-point code adjustment method according to any one of claims 1 to 7.