CN116243910A - Micro-service domain division method and device, electronic equipment and storage medium - Google Patents

Micro-service domain division method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116243910A
CN116243910A CN202310274480.XA CN202310274480A CN116243910A CN 116243910 A CN116243910 A CN 116243910A CN 202310274480 A CN202310274480 A CN 202310274480A CN 116243910 A CN116243910 A CN 116243910A
Authority
CN
China
Prior art keywords
service
micro
domain
class
division
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310274480.XA
Other languages
Chinese (zh)
Inventor
焦佳成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202310274480.XA priority Critical patent/CN116243910A/en
Publication of CN116243910A publication Critical patent/CN116243910A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure provides a micro-service domain dividing method, a micro-service domain dividing device, electronic equipment and a storage medium, relates to the technical field of computers, and particularly relates to the field of micro-services. The specific implementation scheme is as follows: acquiring a request message, wherein the request message is used for requesting access to a target micro-service; embedding a proxy class in a service code of the request message, wherein the proxy class is used for collecting execution information of a calling relation chain in the service code; acquiring execution information by using the proxy class; generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain; and carrying out domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating the micro-service splitting of the target micro-service.

Description

Micro-service domain division method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of computers, and further relates to the field of micro services, in particular to a method and a device for dividing the field of micro services, electronic equipment and a storage medium.
Background
Domain-Driven Design (DDD) is mainly used to guide how to decouple a service system, divide a service module, define a service Domain model and its interaction mode. The separation field in the field driving design means that in the process of software development, the field object needs to be separated from other functions in the system, so that confusion between field knowledge and concepts related to software technology is avoided, the field knowledge can be maintained in a software system, and the large-scale system can be clearly micro-served. In the related art, the field driving design is generally performed by adopting an event storm mode, and the mode depends on the understanding capability of developers to field knowledge when the field model is divided, so that the field driving design period of a software system and the micro-serviced transformation period can be prolonged.
Disclosure of Invention
The disclosure provides a method, a device, an electronic device and a storage medium for dividing a micro-service domain, which at least solve the technical problem that in the related art, the domain driving design period and the micro-serviceization transformation period of a software system are longer due to the fact that the understanding capability of a developer on domain knowledge is relied on when domain models are divided.
According to an aspect of the present disclosure, there is provided a micro service domain division method, including: acquiring a request message, wherein the request message is used for requesting access to a target micro-service; embedding a proxy class in a service code of the request message, wherein the proxy class is used for collecting execution information of a calling relation chain in the service code; acquiring execution information by using the proxy class; generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain; and carrying out domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating the micro-service splitting of the target micro-service.
According to still another aspect of the present disclosure, there is provided a micro service domain division apparatus including: the first acquisition module is used for acquiring a request message, wherein the request message is used for requesting to access the target micro-service; the embedding module is used for embedding the proxy class in the service code of the request message, wherein the proxy class is used for collecting the execution information of the calling relation chain in the service code; the second acquisition module is used for acquiring the execution information by using the proxy class; the generation module is used for generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain; the division module is used for dividing the domain according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating the micro-service splitting of the target micro-service.
According to still another aspect of the present disclosure, there is provided an electronic apparatus including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the micro-service domain partitioning method set forth in the present disclosure.
According to yet another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the micro-service domain partitioning method set forth in the present disclosure.
According to yet another aspect of the present disclosure, there is provided a computer program product comprising a computer program for executing the micro-service domain partitioning method proposed by the present disclosure in a processor.
In the method, the device and the system, the request message for requesting access to the target micro-service is obtained, then the proxy class is embedded in the service code of the request message, the execution information is obtained by utilizing the proxy class, then the domain knowledge graph is generated based on the execution information, the domain is divided according to the domain knowledge graph to obtain the division result, the purpose of rapidly dividing the domain based on the request message is achieved, the effect of effectively shortening the domain driving design period and the micro-serviced transformation period of the software system is achieved, and the technical problem that the domain driving design period and the micro-serviced transformation period of the software system are long due to the fact that the understanding capability of developers on domain knowledge is relied on when the division of the domain model is carried out in the related art is solved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a hardware configuration block diagram of a computer terminal (or mobile device) for implementing a micro service domain division method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of a micro-service domain partitioning method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a micro-service domain partitioning method according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a startup process of a proxy class according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a process for generating a domain knowledge-graph, in accordance with an embodiment of the disclosure;
FIG. 6 is a schematic diagram of a cell of a domain knowledge-graph, in accordance with an embodiment of the disclosure;
FIG. 7 is a schematic diagram of yet another micro-service domain partitioning method according to an embodiment of the present disclosure;
FIG. 8 is a process schematic diagram of a domain division according to an embodiment of the present disclosure;
fig. 9 is a block diagram of a micro service domain division apparatus according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the early stage of service, the functions of the software system are very simple, and the common functions of adding, checking, modifying and deleting (Create Read Update Delete, CRUD) can be realized, so that the software system is clear. As software systems continue to evolve iteratively, business logic becomes more and more complex, and software systems become more and more complex, different modules in the system are associated with each other, and it is difficult to determine the specific function of each module. Thus, when a function is modified, a lot of time is often spent on tracing back the point of modification required for the function, and the modification performed also brings an unpredictable influence.
The micro-service transformation is taken as a basic paradigm in the development transformation of the current large-scale project, most project research and development teams can select micro-service as the evolution direction of the system in the process of design, model selection and reconstruction, and the step of separating the field in the field driving design can clearly realize micro-service of the large-scale system.
In the related art, an event storm mode is adopted to carry out field-driven design, and the event storm is an activity in a flexible workshop (workshop) form aiming at cooperatively exploring a complex service field. The method brings ideal forward results for each participant by exploring the place with the most improvement value in the existing healthy business line, exploring the feasibility of a new business mode and designing new service, and can design Event-Driven (Event-Driven) software which is clean and maintainable to support the adaptability of a rapidly-developed business Event storm. Event storms allow project owners with different backgrounds to communicate and communicate across disciplines in a complex manner, and can provide a novel collaboration mode across information islands and professional boundaries.
Event storms are generally organized by team technical staff, first of all, the individual view needs to be switched to the role of the designer of the system, and the main focus is on the operation process of the software system in a specific scene, and details outside the system can be ignored temporarily; then, the service objects are required to be identified, the service object life cycle is analyzed, the aggregation root analysis is refined, the context and the calling relation are identified, and the service objects are continuously identified and the service model is split on the basis of the event storm, so that the micro-serviceization transformation of the software system can be performed.
However, when the existing domain driving design mode is used for dividing the domain model, the comparison depends on the understanding of the software developer on the domain knowledge and the expert knowledge, and a great limitation of the mode is that the software developer is not a technical expert in the domain, so that the splitting of the service model cannot quickly reach a well-operated and decoupled state, and the cycle of domain driving design of the system and the transformation cycle of micro-serviceization are prolonged. In view of the above problems, no effective solution has been proposed at present.
According to an embodiment of the present disclosure, a micro-service domain partitioning method is provided, it being noted that the steps shown in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order other than that shown or described herein.
The method embodiments provided by the embodiments of the present disclosure may be performed in a mobile terminal, a computer terminal, or similar electronic device. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein. Fig. 1 shows a hardware block diagram of a computer terminal (or mobile device) for implementing a micro service domain division method.
As shown in fig. 1, the computer terminal 100 includes a computing unit 101 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 102 or a computer program loaded from a storage unit 108 into a Random Access Memory (RAM) 103. In the RAM 103, various programs and data required for the operation of the computer terminal 100 can also be stored. The computing unit 101, ROM 102, and RAM 103 are connected to each other by a bus 104. An input/output (I/O) interface 105 is also connected to bus 104.
Various components in computer terminal 100 are connected to I/O interface 105, including: an input unit 106 such as a keyboard, a mouse, etc.; an output unit 107 such as various types of displays, speakers, and the like; a storage unit 108 such as a magnetic disk, an optical disk, or the like; and a communication unit 109 such as a network card, modem, wireless communication transceiver, etc. The communication unit 109 allows the computer terminal 100 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 101 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 101 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 101 performs the micro-service domain partitioning method described herein. For example, in some embodiments, the micro-service domain partitioning method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 108. In some embodiments, part or all of the computer program may be loaded and/or installed onto the computer terminal 100 via the ROM 102 and/or the communication unit 109. When a computer program is loaded into RAM 103 and executed by computing unit 101, one or more steps of the micro-service domain partitioning method described herein may be performed. Alternatively, in other embodiments, the computing unit 101 may be configured to perform the micro-service domain partitioning method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here can be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
It should be noted here that, in some alternative embodiments, the electronic device shown in fig. 1 described above may include hardware elements (including circuits), software elements (including computer code stored on a computer readable medium), or a combination of both hardware and software elements. It should be noted that fig. 1 is only one example of a specific example, and is intended to illustrate the types of components that may be present in the above-described electronic devices.
In the above-described operating environment, the present disclosure provides a micro service domain division method as shown in fig. 2, which may be performed by a computer terminal or similar electronic device as shown in fig. 1. Fig. 2 is a flowchart of a method for micro-service domain partitioning, which may be performed by a server, according to an embodiment of the present disclosure. As shown in fig. 2, the method may include the steps of:
step S21, acquiring a request message, wherein the request message is used for requesting access to a target micro-service;
the request message may be a user request received by a back-end service system, where the back-end service system is a software system, and the user request may specifically include a network path of the request, a request parameter carried by the request, and a hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) method of the request. The network path of the request and the HTTP method can be used for determining the code segment corresponding to the target micro-service. After receiving the user request, the back-end service system processes the service logic in the system, and finally returns the system response to the user.
Specifically, the request message includes a plurality of actions, so the business logic for processing the request message can be regarded as a plurality of method (method) links, such as method a, method B, method C, and method D, where the plurality of method links specifically includes a user request link, and the user request can be mapped to a certain code segment in the system; the requested transaction processes for processing user requests such as adding shopping cart merchandise, purchasing merchandise, etc. The system response information may include any one of the following: the request message accesses the successful prompt information and the error prompt information, wherein the error prompt information also comprises error codes and the like.
Step S22, embedding a proxy class in a service code of the request message, wherein the proxy class is used for collecting execution information of a calling relation chain in the service code;
specifically, the service code of the request message is a service code of the back-end service system for processing the request message, the agent is a probe in java (computer programming language) technology, the probe can be a java code, and the execution information of calling relation chains in the service code can be collected by injecting the java code into the service code of the back-end service system for processing the request message. The call relationship chain can describe a call relationship between a plurality of business logics in the back-end service, for example, method a calls method B, method B calls method C, and method C calls method D.
Step S23, obtaining execution information by using the proxy class;
the execution information may specifically include at least one of the following: the method belongs to class names, method names and parameter information.
Step S24, generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain;
and S25, performing domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating that the target micro-service is subjected to micro-service splitting.
Fig. 3 is a schematic diagram of a micro-service domain partitioning method according to an embodiment of the present disclosure, as shown in fig. 3, in order to assist a code development team in performing domain-driven code reconstruction of a currently developed project, in a typical back-end service system, method a calls method B, method B calls method C, method C calls method D, and bytecodes are injected into the system through probes, so as to finally generate a domain knowledge graph of the system, and guide micro-servitization and reconstruction of the large-scale system. According to the embodiment of the disclosure, a non-invasive splitting mode is adopted, automatic domain division is performed through agents and domain knowledge maps, and after division, a business team can perform continuous micro-servitization splitting on the existing results, namely splitting information such as service boundaries, limit contexts and the like.
According to the steps S21 to S25 of the present disclosure, by acquiring the request message for requesting access to the target micro service, and then embedding the proxy class in the service code of the request message, acquiring the execution information by using the proxy class, then generating the domain knowledge graph based on the execution information, and performing domain division according to the domain knowledge graph to obtain the division result, the purpose of rapidly performing domain division based on the request message is achieved, and the effect of effectively shortening the domain driving design period and the micro-serviced modification period of the software system is achieved, thereby solving the technical problem that the domain driving design period and the micro-serviced modification period of the software system are long due to the understanding capability of the developer on domain knowledge when the division of the domain model is performed in the related art.
Optionally, the method for partitioning the micro service domain in the embodiment of the present disclosure may be, but not limited to, used in a domain driving design scenario, specifically may be a continuous micro-servitization splitting scenario, that is, splitting information such as a service boundary, a constraint context, etc., which is not limited in particular.
The micro service domain division method of the above embodiment is further described below.
As an alternative embodiment, embedding the proxy class in the service code in step S22 includes:
step S221, determining the identification information of the target micro service based on the request message;
step S222, acquiring a calling relation chain through the identification information, wherein the calling relation chain is used for describing calling relations among methods of a plurality of classes in the service code;
in step S223, a proxy class is embedded in the calling relationship chain in a tangent plane manner, where the tangent plane manner is used to cut the calling relationship chain and embed the proxy class at the cutting position.
Specifically, the identification information of the target micro service may be a packet name prefix of the current application service, for example, the packet name prefix is com. Further, the calling relation chain is obtained according to the packet name prefix of the current application service, so that the proxy class is embedded in the calling relation chain in a tangent plane mode.
Based on the above-mentioned alternative embodiment, the identification information of the target micro-service is determined based on the request message, and then the calling relation chain is obtained through the identification information, and then the proxy class is embedded in the calling relation chain by adopting a tangent plane mode, wherein the tangent plane mode is used for cutting the calling relation chain and embedding the proxy class at the cutting position, so that the bytecode can be injected into the back-end service system by adopting a non-invasive mode through the probe, and the system is used for efficiently performing the domain model analysis of the system.
As an alternative embodiment, in step S222, acquiring the call relationship chain by the identification information includes:
step S2221, in response to the target micro-service being in a starting state, scanning all class files in a software system, wherein the software system is used for bearing the target micro-service;
step S2222, obtaining a plurality of classes from all class files based on the identification information, and obtaining a calling relation chain.
Specifically, a specified code package of code analysis is added into a software system starting command developed by using Java language through a preset starting command, and then a package name prefix of the current application service is configured in a process environment. Further, the code analysis tool automatically analyzes the project code structure at the class (class) matching the package name prefix and at compile time by the byte code enhancement technique. Code enhancement is carried out on the method of each class of the software system, and the method name and class name of the calling party of the method in the software system are recorded, namely, the cascade relation in the software system is recorded, so that a calling relation chain is obtained.
Based on the above-mentioned alternative embodiment, by responding to the target micro-service being in the start state, all class files in the software system are scanned, and then a plurality of classes are acquired from all class files based on the identification information, so that the calling relation chain can be efficiently acquired.
As an optional implementation manner, embedding the proxy class in the call relation chain in the slice manner in step S223 includes:
step S2231, determining a method for calling a plurality of classes contained in the relation chain;
in step S2232, the method of multiple classes is cut by using a tangent plane, and the proxy class is embedded before the method of multiple classes.
Specifically, the above-mentioned tangent plane mode is tangent plane-oriented programming (Aspect Oriented Programming, AOP), and unified maintenance of program functions can be realized through a precompilation mode and a run-time dynamic proxy, which is a derivative model of functional programming. The AOP is utilized to isolate each part of the business logic, so that the coupling degree among the parts of the business logic is reduced, the reusability of the program is improved, and the development efficiency is improved.
Based on the above-mentioned alternative embodiment, by determining the methods for calling the multiple classes included in the relationship chain, and then cutting the multiple classes by using a tangent plane mode, the agent class is embedded before the multiple classes, so that the development efficiency can be further improved, and the time consumption of domain driving design can be reduced.
As an optional implementation manner, the micro service domain division method of the embodiment of the present disclosure further includes:
step S231, generating proxy classes based on a plurality of classes, and verifying whether the collection mode of the proxy classes is in an available state;
in step S232, in response to the proxy class having been generated and the collection mode being in the available state, it is determined that the proxy class is started to be completed, so as to obtain the execution information.
Specifically, when a plurality of classes in all class files are scanned as classes under the name of a specified code package, generating a section proxy method based on the plurality of classes, verifying whether the collection mode of the proxy class is in an available state, and determining that the start of the proxy class is completed when the section proxy method is generated and the collection mode is in the available state. The universal character-based scanning is supported in the process of scanning all class files, so that constant information and abnormal processing information in a system can be accurately removed, and noise in the information collecting process is reduced. For example, the wildcards are generally "x", com.baidu. Xxx. the packet paths of all com.baidu. Xxx.{ any letters }, and the tool class belongs to the same packet in general, so the packet information of the tool class can be excluded by the wildcards, thereby improving the accuracy of the collected information.
FIG. 4 is a schematic diagram of a process for starting a proxy class according to an embodiment of the present disclosure, as shown in FIG. 4, after a target micro service is started, scanning all class files in a software system, acquiring a plurality of classes from all class files based on identification information, judging whether the plurality of classes are classes under a specified code package name, and if not, ignoring the processing; if the class under the code package name is specified, generating proxy class based on the classes, verifying whether the collection mode of the proxy class is in an available state, and specifically, verifying whether the collection mode can return an available state code from the target micro-service. And when the proxy class is generated and the acquisition mode is in an available state, determining that the start of the proxy class is completed.
Based on the above optional implementation manner, by generating the proxy class based on the multiple classes and verifying whether the collection mode of the proxy class is in the available state, further, in response to the fact that the proxy class is generated and the collection mode is in the available state, the completion of starting the proxy class is determined, so as to obtain the execution information, and therefore, the proxy class can be started quickly.
As an alternative embodiment, generating the domain knowledge graph based on the execution information includes:
Step S241, importing the execution information acquired by the agent class according to a preset information acquisition mode, wherein the preset information acquisition mode comprises one of the following steps: a file writing mode, a socket mode and a message queue mode;
and step S242, carrying out knowledge graph analysis on the execution information to generate a domain knowledge graph.
Specifically, the code analysis tool automatically writes the analysis result into a specified file, for example, a text type file, and after the system completes a full-function test, the file of the analysis result can be extracted to serve as a basis for the later field driving design, and at this time, the analysis tool can be removed from the production environment to prevent the influence on the operation performance of the system. In addition to the collection of execution information by the above-described file writing method, the execution information may be continuously acquired by a service insensitive to performance using a message queue or the like.
Fig. 5 is a schematic diagram of a process of generating a domain knowledge graph according to an embodiment of the disclosure, where, as shown in fig. 5, when an agent class acquires execution information, the agent class may acquire the execution information in any one of a file writing manner, a socket manner, and a message queue manner, and further perform knowledge graph analysis on the execution information to generate the domain knowledge graph.
In the file writing mode, the agent stores a calling relation chain which is embedded into a software system into a local file, and a user manually imports the file into a knowledge graph reading module so as to generate a domain knowledge graph; in the socket mode, the domain knowledge graph can be connected with the embedded service in the socket mode, and the agent can continuously send the acquired information out through the socket; in the message queue mode, a module for generating a domain knowledge graph is taken as a consumer through middleware such as a message queue (Kafka, rabbitMQ), so that an execution message generated by a probe part is consumed.
It is easy to understand that the information collection is performed by using a message queue mode or a socket mode, so that continuous update of data can be ensured, and the information of the nodes and the edges can be continuously updated by the domain knowledge graph.
Based on the above-mentioned alternative embodiment, the execution information obtained by the agent class is imported according to the preset information collection mode, and then the knowledge graph analysis is performed on the execution information, so that the domain knowledge graph can be rapidly generated, the domain knowledge graph can be continuously updated, and the accuracy of the domain knowledge graph is further improved.
As an optional implementation manner, in step S242, performing knowledge-graph analysis on the execution information, and generating a domain knowledge-graph includes:
step S2421, performing knowledge graph analysis on the execution information, determining a plurality of classes in the service code as a main node, determining class variables in the plurality of classes as auxiliary nodes, and determining method calls among the plurality of classes as edges;
step S2422, constructing a domain knowledge graph based on the primary node, the secondary node and the edge.
Specifically, the knowledge graph analysis is performed on the execution information by using a code analysis tool, so that an analysis result can be obtained, what method and what attribute of other classes are accessed by a method of a certain class in the software system are recorded in the analysis result, a system call chain identified in the analysis result is analyzed, a plurality of classes in a service code are used as main nodes, class variables in the plurality of classes are used as auxiliary nodes, and a method call among the plurality of classes is used as an edge, so that a domain knowledge graph of a minimum unit can be constructed.
Fig. 6 is a schematic diagram of a unit of a domain knowledge graph, as shown in fig. 6, in a unit of the domain knowledge graph, there are attribute a, attribute B and method B in class a, the method B calls a method in class B, and the execution logic of class B has a method a, where the execution logic of class a calls a certain attribute value or method in class a.
Based on the above-mentioned alternative embodiment, by performing knowledge graph analysis on the execution information, determining multiple classes in the service code as a master node, determining class variables in the multiple classes as slave nodes, and determining method calls between the multiple classes as edges, the domain knowledge graph can be quickly constructed based on the master node, the slave nodes and the edges.
As an optional implementation manner, in step S25, performing domain division according to the domain knowledge graph, and obtaining a division result includes:
step S251, determining the number of edges associated with the main node through a domain knowledge graph;
in step S252, domain division is performed based on the number of edges, and a division result is obtained.
The calling relation in the software system can be visually displayed by using the domain knowledge graph, the number of edges associated with a plurality of classes in the service code can be rapidly determined by using the domain knowledge graph, and domain division is performed based on the number of edges, so that a division result is obtained.
Based on the above optional implementation manner, the number of the edges associated with the main node is determined through the domain knowledge graph, and further domain division is performed based on the number of the edges, so that a division result can be rapidly obtained, and a micro-service splitting is performed on the target micro-service by using the division result indication, so that the period of the micro-service splitting is further shortened.
As an alternative embodiment, in step S252, the domain division is performed based on the number of edges, and the division result includes:
step S2521, determining a density threshold value through the number of edges, wherein the density threshold value is a separation basis of domain division;
step S2522, classifying the main nodes by adopting a density threshold value and/or a preset value to obtain a classification result;
step S2523, performing domain division based on the classification result to obtain a division result.
Specifically, when domain division is performed, the number of connection relations between each class and other classes can be used as a separating basis. Firstly, counting the number of edges of each class node in a software system, taking the median of the number of edges as a density threshold, and finally dividing the main nodes in the domain knowledge graph into four classes when classifying the main nodes by adopting the density threshold and/or a preset value: high density nodes, boundary nodes, protection nodes, and noise nodes.
Based on the above optional embodiments, the density threshold is determined by the number of edges, and then the classification processing is performed on the main node by adopting the density threshold and/or a preset value to obtain a classification result, and finally the domain classification can be performed based on the classification result, so that the classification result can be obtained rapidly.
As an optional implementation manner, in step S2522, the classification processing is performed on the master node using the density threshold and/or the preset value, so as to obtain a classification result, where the classification result includes:
step S31, classifying nodes with the number of edges larger than or equal to a density threshold value in the main nodes as first class nodes;
step S32, classifying nodes with the number of edges equal to a preset value in the main nodes into second class nodes;
step S33, classifying nodes with the number of edges larger than a preset value and smaller than a density threshold value in the main nodes into third class nodes;
step S34, classifying nodes which are not traversed in the main nodes into fourth category nodes;
step S35, determining a classification result based on the first class node, the second class node, the third class node and the fourth class node.
Specifically, the first class node is a high-density node, and the high-density node can be a high-latitude node, and the number of edges of the high-density node is greater than or equal to a density threshold value; the second class node is a protection node, and the protection node is a node which is connected with the high-density node and has the degree of 1; the third class node is a boundary node, the boundary node is a node which is connected with the high-density node and has a degree larger than 1, and the number of edges of the boundary node is smaller than a density threshold value; the fourth category node is a noise node, and the noise node is a node which is not traversed.
When the density threshold value and/or the preset value are adopted to classify the main node, all nodes in the domain knowledge graph need to be traversed firstly, if the non-visited high-latitude node is encountered, the non-visited high-latitude node is marked as visited (classified), a new cluster (cluster) is newly established, the high-latitude node is added into the cluster, then a breadth first search algorithm (Breadth First Search, BFS) is started by taking the high-latitude node as a starting point, if other high-latitude nodes nearby are found, the non-visited high-latitude node is marked as classified, and then the non-visited high-latitude node is added into the cluster.
Based on the above optional embodiment, the nodes with the number of edges greater than or equal to the density threshold in the main node are classified as the first class nodes, the nodes with the number of edges equal to the preset value in the main node are classified as the second class nodes, the nodes with the number of edges greater than the preset value and less than the density threshold in the main node are classified as the third class nodes, the nodes which are not traversed in the main node are classified as the fourth class nodes, and finally the classification result can be determined rapidly based on the first class nodes, the second class nodes, the third class nodes and the fourth class nodes, so that the field division is performed efficiently, and the period involved in the field driving is shortened effectively.
As an optional implementation manner, in step S2523, the domain division is performed based on the classification result, where the obtaining the division result includes: based on the classification result, the first class node is divided into target fields, and the second class node and the third class node are divided into target field objects, so that a division result is obtained.
Specifically, each edge in the domain knowledge graph is traversed, if the number of the edges of the node is greater than or equal to a median threshold, namely the node is a high-density node, the high-density node is divided into unified domains, and if one node is only related to another node, namely the node can be a protection node and a boundary node, the node is regarded as a unified domain object, and finally a division result can be obtained.
Fig. 7 is a schematic diagram of yet another micro-service domain partitioning method according to an embodiment of the present disclosure, as shown in fig. 7, the method further comprising:
step S701, acquiring a request message, wherein the request message is used for requesting access to a target micro-service;
step S702, determining identification information of a target micro-service based on a request message;
step S703, in response to the target micro-service being in a start state, scanning all class files in the software system, wherein the software system is used for bearing the target micro-service;
Step S704, acquiring a plurality of classes from all class files based on the identification information to obtain a calling relation chain;
step S705, determining a method for calling a plurality of classes contained in the relation chain;
step S706, cutting the methods of the classes by adopting a tangent plane mode, and embedding proxy classes before the methods of the classes;
step S707, obtaining execution information by using the proxy class;
step S708, importing the execution information acquired by the agent class according to a preset information acquisition mode;
step S709, carrying out knowledge graph analysis on the execution information to generate a domain knowledge graph;
and step S710, performing domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating that the target micro-service is subjected to micro-service splitting.
Based on the steps S701 to S710, the request message for requesting access to the target micro-service is obtained, and then the proxy class is embedded in the service code of the request message, the proxy class is used for obtaining the execution information, then the domain knowledge graph is generated based on the execution information, and the domain division is performed according to the domain knowledge graph, so as to obtain the division result, achieve the purpose of rapidly performing the domain division based on the request message, and achieve the effect of effectively shortening the domain driving design period and the micro-serviced transformation period of the software system, thereby solving the technical problem that the domain driving design period and the micro-serviced transformation period of the software system are longer because the understanding capability of the developer on the domain knowledge is relied on when the division of the domain model is performed in the related art.
FIG. 8 is a process schematic diagram of a domain division according to an embodiment of the disclosure, as shown in FIG. 8, the method further comprising:
step S801, determining the number of edges associated with a main node through a domain knowledge graph;
step S802, determining a density threshold value through the number of edges, wherein the density threshold value is a separation basis for domain division;
step S803, classifying nodes with the number of edges greater than or equal to a density threshold value in the main nodes as first class nodes;
step S804, classifying the nodes with the number of edges equal to the preset value in the main nodes as second class nodes;
step S805, classifying nodes with the number of edges greater than a preset value and less than a density threshold in the main nodes as third class nodes;
step S806, classifying nodes which are not traversed in the main node as fourth category nodes;
step S807, determining a classification result based on the first category node, the second category node, the third category node, and the fourth category node;
step S808, dividing the first category node into a target field based on the classification result, and dividing the second category node and the third category node into target field objects to obtain a division result.
Based on the steps S801 to S808, the domain division is performed based on the domain knowledge graph to obtain the division result, so that the micro-service splitting for the target micro-service can be realized, and the domain driving design period and the micro-service transformation period of the software system are effectively shortened.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user accord with the regulations of related laws and regulations, and the public order colloquial is not violated.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present disclosure may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the various embodiments of the present disclosure.
The present disclosure also provides a micro-service domain dividing device, which is used for implementing the foregoing embodiments and preferred embodiments, and will not be described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 9 is a block diagram of a micro service domain division apparatus according to an embodiment of the present disclosure, and as shown in fig. 9, a micro service domain division apparatus 900 includes:
a first obtaining module 901, configured to obtain a request message, where the request message is used to request access to a target micro service;
an embedding module 902, configured to embed a proxy class in a service code of the request message, where the proxy class is configured to collect execution information of a calling relation chain in the service code;
a second obtaining module 903, configured to obtain execution information by using an agent class;
a generating module 904, configured to generate a domain knowledge graph based on the execution information, where the domain knowledge graph is a knowledge graph of the micro-service domain;
the division module 905 is configured to perform domain division according to the domain knowledge graph to obtain a division result, where the division result is used to indicate that the target microservice is split.
Optionally, the embedding module 902 is further configured to: determining identification information of the target micro service based on the request message; acquiring a calling relation chain through the identification information, wherein the calling relation chain is used for describing calling relations among methods of a plurality of classes in the service code; and embedding the proxy class in the calling relation chain by adopting a cut-plane mode, wherein the cut-plane mode is used for cutting the calling relation chain and embedding the proxy class at the cutting position.
Optionally, the embedding module 902 is further configured to: scanning all class files in a software system in response to the target micro-service being in a starting state, wherein the software system is used for bearing the target micro-service; and acquiring a plurality of classes from all class files based on the identification information to obtain a calling relation chain.
Optionally, the embedding module 902 is further configured to: determining a method for calling a plurality of classes contained in the relation chain; cutting the methods of the classes by adopting a tangent plane mode, and embedding the proxy class before the methods of the classes.
Optionally, the micro service domain division apparatus 900 further includes: a processing module 906, configured to generate a proxy class based on the multiple classes, and verify whether a collection manner of the proxy class is in an available state; a determining module 907 is configured to determine that the proxy class is started to be completed in response to the proxy class having been generated and the collection manner being in an available state, so as to obtain execution information.
Optionally, the generating module 904 is further configured to: importing the execution information acquired by the proxy class according to a preset information acquisition mode, wherein the preset information acquisition mode comprises one of the following steps: a file writing mode, a socket mode and a message queue mode; and carrying out knowledge graph analysis on the execution information to generate a domain knowledge graph.
Optionally, the generating module 904 is further configured to: performing knowledge graph analysis on the execution information, determining a plurality of classes in the service code as a main node, determining class variables in the plurality of classes as auxiliary nodes, and determining method calls among the plurality of classes as edges; and constructing a domain knowledge graph based on the main node, the auxiliary node and the edges.
Optionally, the dividing module 905 is further configured to: determining the number of edges associated with the main node through the domain knowledge graph; and performing domain division based on the number of edges to obtain a division result.
Optionally, the dividing module 905 is further configured to: determining a density threshold value through the number of edges, wherein the density threshold value is a separation basis for domain division; classifying the main nodes by adopting a density threshold value and/or a preset numerical value to obtain a classification result; and performing domain division based on the classification result to obtain a division result.
Optionally, the dividing module 905 is further configured to: classifying nodes with the number of edges greater than or equal to a density threshold value in the main nodes as first class nodes; classifying nodes with the number of edges equal to a preset value in the main nodes into second class nodes; classifying nodes with the number of edges larger than a preset value and smaller than a density threshold value in the main nodes into third class nodes; classifying nodes which are not traversed in the main nodes into fourth category nodes; and determining a classification result based on the first class node, the second class node, the third class node and the fourth class node.
Optionally, the dividing module 905 is further configured to: based on the classification result, the first class node is divided into target fields, and the second class node and the third class node are divided into target field objects, so that a division result is obtained.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
According to an embodiment of the present disclosure, there is also provided an electronic device comprising a memory having stored therein computer instructions and at least one processor arranged to execute the computer instructions to perform the steps of the above-described method embodiments.
Optionally, the electronic device may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in the present disclosure, the above processor may be configured to perform the following steps by a computer program:
s1, acquiring a request message, wherein the request message is used for requesting access to a target micro-service;
S2, embedding a proxy class in a service code of the request message, wherein the proxy class is used for collecting execution information of a calling relation chain in the service code;
s3, acquiring execution information by using the proxy class;
s4, generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain;
and S5, performing domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating that the target micro-service is subjected to micro-service splitting.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments and optional implementations, and this embodiment is not described herein.
According to an embodiment of the present disclosure, the present disclosure also provides a non-transitory computer readable storage medium having stored therein computer instructions, wherein the computer instructions are arranged to perform the steps of the above-described method embodiments when run.
Alternatively, in the present embodiment, the above-described non-transitory computer-readable storage medium may be configured to store a computer program for performing the steps of:
s1, acquiring a request message, wherein the request message is used for requesting access to a target micro-service;
S2, embedding a proxy class in a service code of the request message, wherein the proxy class is used for collecting execution information of a calling relation chain in the service code;
s3, acquiring execution information by using the proxy class;
s4, generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain;
and S5, performing domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating that the target micro-service is subjected to micro-service splitting.
Alternatively, in the present embodiment, the non-transitory computer readable storage medium described above may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to an embodiment of the present disclosure, the present disclosure also provides a computer program product. Program code for carrying out embodiments of the disclosed methods may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the foregoing embodiments of the present disclosure, the descriptions of the various embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present disclosure, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a usb disk, a read-only memory (ROM), a random-access memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, etc., which can store program codes.
The foregoing is merely a preferred embodiment of the present disclosure, and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present disclosure, which are intended to be comprehended within the scope of the present disclosure.

Claims (25)

1. A micro-service domain partitioning method, comprising:
acquiring a request message, wherein the request message is used for requesting access to a target micro-service;
embedding a proxy class in a service code of the request message, wherein the proxy class is used for collecting execution information of a calling relation chain in the service code;
acquiring the execution information by using the proxy class;
generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain;
and performing domain division according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating the micro-service splitting of the target micro-service.
2. The micro-service domain partitioning method of claim 1, wherein embedding the proxy class in the service code comprises:
determining identification information of the target micro service based on the request message;
Acquiring the calling relation chain through the identification information, wherein the calling relation chain is used for describing calling relations among methods of a plurality of classes in the service code;
embedding the proxy class in the calling relation chain by adopting a tangent plane mode, wherein the tangent plane mode is used for cutting the calling relation chain and embedding the proxy class at a cutting position.
3. The micro-service domain partitioning method of claim 2, wherein obtaining the call relationship chain through the identification information comprises:
scanning all class files in a software system in response to the target micro-service being in a starting state, wherein the software system is used for bearing the target micro-service;
and acquiring the classes from all the class files based on the identification information to obtain the calling relation chain.
4. The micro-service domain partitioning method of claim 2, wherein embedding the proxy class in the call relation chain in the tangent manner comprises:
a method of determining the plurality of classes contained in the call relationship chain;
cutting the methods of the classes by adopting the cutting plane mode, and embedding the proxy class before the methods of the classes.
5. The micro service domain division method according to claim 2, wherein the micro service domain division method further comprises:
generating the proxy class based on the multiple classes, and verifying whether the collection mode of the proxy class is in an available state;
and in response to the proxy class having been generated and the acquisition mode being in the available state, determining that the proxy class is started to be completed so as to acquire the execution information.
6. The micro-service domain partitioning method of claim 1, wherein generating the domain knowledge graph based on the execution information comprises:
importing the execution information acquired by the proxy class according to a preset information acquisition mode, wherein the preset information acquisition mode comprises one of the following steps: a file writing mode, a socket mode and a message queue mode;
and carrying out knowledge graph analysis on the execution information to generate the domain knowledge graph.
7. The micro-service domain partitioning method of claim 6, wherein performing a knowledge-graph analysis on the execution information, generating the domain knowledge-graph comprises:
performing knowledge graph analysis on the execution information, determining a plurality of classes in the service code as a main node, determining class variables in the plurality of classes as auxiliary nodes, and determining method calls among the plurality of classes as edges;
The domain knowledge graph is constructed based on the primary node, the secondary node, and the edge.
8. The micro-service domain division method according to claim 7, wherein performing domain division according to the domain knowledge graph, obtaining the division result comprises:
determining the number of edges associated with the main node through the domain knowledge graph;
and performing domain division based on the number of the edges to obtain the division result.
9. The micro-service domain division method according to claim 8, wherein performing domain division based on the number of sides, obtaining the division result includes:
determining a density threshold according to the number of edges, wherein the density threshold is a separation basis for domain division;
classifying the main nodes by adopting the density threshold value and/or a preset value to obtain a classification result;
and performing domain division based on the classification result to obtain the division result.
10. The micro service domain division method according to claim 9, wherein the classification processing of the master node by using the density threshold and/or the preset value, to obtain the classification result includes:
classifying nodes in the main node, the number of which is greater than or equal to the density threshold value, as first class nodes;
Classifying nodes with the number of edges equal to the preset value in the main nodes into second class nodes;
classifying nodes, of which the number of edges is larger than the preset value and smaller than the density threshold, in the main nodes into third class nodes;
classifying nodes which are not traversed in the main node into fourth category nodes;
the classification result is determined based on the first class node, the second class node, the third class node, and the fourth class node.
11. The micro-service domain division method according to claim 10, wherein performing domain division based on the classification result, the division result comprising:
and dividing the first class node into a target domain based on the classification result, and dividing the second class node and the third class node into target domain objects to obtain the division result.
12. A micro-service domain partitioning apparatus, comprising:
the first acquisition module is used for acquiring a request message, wherein the request message is used for requesting to access the target micro-service;
the embedding module is used for embedding a proxy class in the service code of the request message, wherein the proxy class is used for collecting the execution information of a calling relation chain in the service code;
The second acquisition module is used for acquiring the execution information by using the proxy class;
the generation module is used for generating a domain knowledge graph based on the execution information, wherein the domain knowledge graph is a knowledge graph of the micro-service domain;
the division module is used for dividing the domain according to the domain knowledge graph to obtain a division result, wherein the division result is used for indicating the micro-service splitting of the target micro-service.
13. The micro-service domain partitioning apparatus of claim 12, wherein the embedding module is further to:
determining identification information of the target micro service based on the request message;
acquiring the calling relation chain through the identification information, wherein the calling relation chain is used for describing calling relations among methods of a plurality of classes in the service code;
embedding the proxy class in the calling relation chain by adopting a tangent plane mode, wherein the tangent plane mode is used for cutting the calling relation chain and embedding the proxy class at a cutting position.
14. The micro-service domain partitioning apparatus of claim 13, wherein the embedding module is further to:
scanning all class files in a software system in response to the target micro-service being in a starting state, wherein the software system is used for bearing the target micro-service;
And acquiring the classes from all the class files based on the identification information to obtain the calling relation chain.
15. The micro-service domain partitioning apparatus of claim 13, wherein the embedding module is further to:
a method of determining the plurality of classes contained in the call relationship chain;
cutting the methods of the classes by adopting the cutting plane mode, and embedding the proxy class before the methods of the classes.
16. The micro-service domain division apparatus according to claim 13, wherein the micro-service domain division apparatus further comprises:
the processing module is used for generating the proxy class based on the classes and verifying whether the collection mode of the proxy class is in an available state or not;
and the determining module is further used for determining that the proxy class is started to be completed so as to acquire the execution information in response to the proxy class being generated and the acquisition mode being in the available state.
17. The micro-service domain partitioning apparatus of claim 12, wherein the generation module is further configured to:
importing the execution information acquired by the proxy class according to a preset information acquisition mode, wherein the preset information acquisition mode comprises one of the following steps: a file writing mode, a socket mode and a message queue mode;
And carrying out knowledge graph analysis on the execution information to generate the domain knowledge graph.
18. The micro-service domain partitioning apparatus of claim 17, wherein the generation module is further configured to:
performing knowledge graph analysis on the execution information, determining a plurality of classes in the service code as a main node, determining class variables in the plurality of classes as auxiliary nodes, and determining method calls among the plurality of classes as edges;
the domain knowledge graph is constructed based on the primary node, the secondary node, and the edge.
19. The micro-service domain partitioning apparatus of claim 18, wherein the partitioning module is further to:
determining the number of edges associated with the main node through the domain knowledge graph;
and performing domain division based on the number of the edges to obtain the division result.
20. The micro-service domain partitioning apparatus of claim 19, wherein the partitioning module is further to:
determining a density threshold according to the number of edges, wherein the density threshold is a separation basis for domain division;
classifying the main nodes by adopting the density threshold value and/or a preset value to obtain a classification result;
And performing domain division based on the classification result to obtain the division result.
21. The micro-service domain partitioning apparatus of claim 20, wherein the partitioning module is further to:
classifying nodes in the main node, the number of which is greater than or equal to the density threshold value, as first class nodes;
classifying nodes with the number of edges equal to the preset value in the main nodes into second class nodes;
classifying nodes, of which the number of edges is larger than the preset value and smaller than the density threshold, in the main nodes into third class nodes;
classifying nodes which are not traversed in the main node into fourth category nodes;
the classification result is determined based on the first class node, the second class node, the third class node, and the fourth class node.
22. The micro-service domain partitioning apparatus of claim 21, wherein the partitioning module is further to:
and dividing the first class node into a target domain based on the classification result, and dividing the second class node and the third class node into target domain objects to obtain the division result.
23. An electronic device, comprising:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the micro-service domain partitioning method of any one of claims 1-11.
24. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the micro-service domain partitioning method according to any one of claims 1-11.
25. A computer program product comprising a computer program which, when executed by a processor, implements the micro-service domain partitioning method according to any one of claims 1-11.
CN202310274480.XA 2023-03-17 2023-03-17 Micro-service domain division method and device, electronic equipment and storage medium Pending CN116243910A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310274480.XA CN116243910A (en) 2023-03-17 2023-03-17 Micro-service domain division method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310274480.XA CN116243910A (en) 2023-03-17 2023-03-17 Micro-service domain division method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116243910A true CN116243910A (en) 2023-06-09

Family

ID=86624242

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310274480.XA Pending CN116243910A (en) 2023-03-17 2023-03-17 Micro-service domain division method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116243910A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116881027A (en) * 2023-09-08 2023-10-13 国网信息通信产业集团有限公司 Atomic service combination communication method, device, electronic equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116881027A (en) * 2023-09-08 2023-10-13 国网信息通信产业集团有限公司 Atomic service combination communication method, device, electronic equipment and medium
CN116881027B (en) * 2023-09-08 2024-01-16 国网信息通信产业集团有限公司 Atomic service combination communication method, device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
US20240070487A1 (en) Systems and methods for enriching modeling tools and infrastructure with semantics
US8719784B2 (en) Assigning runtime artifacts to software components
CN109242164B (en) Method and device for optimizing product path, computer storage medium and electronic equipment
US11256712B2 (en) Rapid design, development, and reuse of blockchain environment and smart contracts
CN107870845A (en) Towards the management method and system of micro services framework applications
CN111405030B (en) Message pushing method and device, electronic equipment and storage medium
CN101819551B (en) Method and system for recording service interaction data of enterprise message system
CN109298882A (en) Management method, computer readable storage medium and the terminal device of interface
CN110879776A (en) Test case generation method and device
CN116243910A (en) Micro-service domain division method and device, electronic equipment and storage medium
CN111767217A (en) JS unit test case generation method and device
Fraternali et al. Automating function point analysis with model driven development
CN112970011A (en) Recording pedigrees in query optimization
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN113343036B (en) Data blood relationship analysis method and system based on key topological structure analysis
CN115437940A (en) API (application programming interface) testing method suitable for financial cloud platform
CN111967806B (en) User risk updating method and device based on periodic retrace and electronic equipment
CN112130849B (en) Code automatic generation method and device
CN114004505A (en) BPM platform and method for recommending business process based on BPM platform
Bosch et al. Software logging for machine learning
US20080082471A1 (en) Resolve Trace Minimization
US20240152933A1 (en) Automatic mapping of a question or compliance controls associated with a compliance standard to compliance controls associated with another compliance standard
US11914993B1 (en) Example-based synthesis of rules for detecting violations of software coding practices
CN112948251B (en) Automatic software testing method and device
CN112528167B (en) Method and electronic device for mining user influence based on social media

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination