Program dividing device and program dividing method

The program division device addresses data inconsistency and maintainability issues in microservices by dividing programs into unit programs with transaction analysis and splitting logic, ensuring consistent data processing and performance.

JP2024140348AActive Publication Date: 2024-10-10HITACHI LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2023051447
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-28
Publication Date
2024-10-10
Estimated Expiration
2043-03-28

AI Technical Summary

Technical Problem

Existing methods for converting monolithic systems to microservices can lead to inconsistent data consistency and hinder maintainability due to transactions not corresponding to business units or duplication of logic, and modifying code for distributed transactions may cause performance degradation.

Method used

A program division device that divides a program into unit programs based on transaction analysis, identifying start positions, data access, and call relationships, and adds transaction splitting logic to maintain data consistency and prevent performance issues.

Benefits of technology

The solution allows for consistent data processing and minimizes performance degradation during program division by strategically splitting transactions and adding necessary logic to ensure data integrity across microservices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024140348000001_ABST
    Figure 2024140348000001_ABST
Patent Text Reader

Abstract

To provide a program dividing device and a program dividing method for maintaining consistency in data processing for dividing a program and for dividing a program while suppressing a decrease in performance after the division.SOLUTION: In a program dividing system, a program dividing device 3 for dividing a division object program correlated with transaction into multiple unit programs and creating a new program specifies a call relationship among multiple unit programs and information showing a start position of transaction in the division object program on the basis of the division object program, specifies contents of data access performed by the division object program, and creates a new program by adding information for division to a unit program when determining division of transaction in accordance with the unit program on the basis of a start position on the basis of the call relationship, information showing the start position, and contents of data access.SELECTED DRAWING: Figure 4
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a program partitioning device and a program partitioning method. [Background technology]

[0002] In recent years, the so-called microservices trend has been attracting attention due to the trend of cloud-native thinking and agile development. It is one of the techniques for migrating a program to a system consisting of a collection of multiple small service programs (microservices), which contributes to improving maintainability.

[0003] However, when implementing microservices, transactions (a series of processes) that were completed in a monolithic system may be divided into microservices, resulting in a risk of data inconsistency between microservices.

[0004] Therefore, for example, Patent Document 1 discloses that in order to ensure data consistency between microservices, transactions in the current system are analyzed using program dependencies, and microservice units are generated so that transactions are not disrupted. [Prior art documents] [Patent documents]

[0005] [Patent Document 1] Patent No. 7057571 Summary of the Invention [Problem to be solved by the invention]

[0006] However, creating microservices on a transaction basis as in Patent Document 1 may hinder the maintainability of the microservices, as transactions may not correspond to business units or duplication of logic may occur.

[0007] Furthermore, in Patent Document 1, microservices cannot be divided so that a transaction spans across microservices. In this case, it is possible to configure a transaction by constructing it from multiple divided (delimited) transactions (distributed transactions).

[0008] However, distributed transactions require more than just splitting the code; code modifications may be required to maintain data integrity. On the other hand, code modifications may cause performance degradation, so it is preferable to have fewer code splits.

[0009] The present invention has been made in consideration of the above circumstances, and its purpose is to provide a program partitioning device and a program partitioning method that are capable of partitioning a program while maintaining the consistency of data processing and suppressing performance degradation after partitioning. [Means for solving the problem]

[0010] One aspect of the present invention for solving the above problem is a program division device for dividing a division target program corresponding to a predetermined transaction into a plurality of unit programs to create a new program, the program division device including a storage device for storing the division target program, and a program division device for dividing the division target program into a plurality of unit programs based on the division target .... a shared resource analysis process that identifies the content of data access performed by the program to be divided; a transaction division point analysis process that determines whether or not to divide the transaction based on the identified start position in correspondence with the division of the unit programs, based on the identified calling relationship, the information indicating the identified start position, and the content of the identified data access; and a transaction division process that creates the new program by adding information for dividing the transaction in correspondence with the multiple unit programs to the unit programs if it is determined that the transaction should be divided. Effect of the Invention

[0011] According to the present invention, a program can be divided while maintaining the consistency of data processing and suppressing a decrease in performance after the division. Configurations and effects other than those described above will become apparent from the following description of the embodiments. [Brief description of the drawings]

[0012] [Figure 1] 1 is a diagram illustrating an example of a configuration of a program division system according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a diagram for explaining a configuration of a program to be divided, for explaining the present embodiment. [Diagram 3] FIG. 11 is a sequence diagram illustrating a transaction in a program to be divided. [Figure 4] 2 is a diagram illustrating an example of functions provided in the program division system and information managed by the program division system 1. FIG. [Diagram 5] FIG. 1 is a diagram illustrating an example of a current system source code. [Figure 6] FIG. 11 is a diagram showing an example of current system DB information. [Figure 7] FIG. 13 is a diagram illustrating an example of microservice design information. [Figure 8] FIG. 2 is a diagram illustrating an example of a hardware configuration of each information processing device in the program partitioning system. [Figure 9] FIG. 11 is a flow diagram illustrating an example of a program division process. [Figure 10] FIG. 13 illustrates an example of a method relationship information management table; [Figure 11] FIG. 13 illustrates an example of a transaction information management table. [Figure 12] FIG. 13 illustrates an example of a CRUD information management table. [Figure 13] FIG. 13 is a diagram illustrating an example of a transaction list. [Figure 14] FIG. 13 illustrates an example of a distributed transaction list. [Figure 15] FIG. 13 is a diagram illustrating another example of a distributed transaction list. [Figure 16] FIG. 13 is a diagram illustrating an example of a transaction division point list. [Figure 17] FIG. 11 is a flow diagram illustrating details of a transaction division point analysis process. [Figure 18] FIG. 11 is a flow diagram illustrating details of a transaction division point analysis process. [Figure 19] FIG. 13 is a diagram illustrating an example of a source code for a microservice in which a handler and a request are set. [Figure 20] FIG. 1 is a diagram illustrating an example of a microservice source code. [Figure 21] FIG. 11 is a diagram illustrating an example of the configuration of each microservice generated in association with the microservice creation by the program division process of this embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0013] Hereinafter, an embodiment of the present invention will be described. 1 is a diagram showing an example of the configuration of a program division system 1 according to this embodiment. The program division system 1 includes a current system management device 2 and a program division device 3. The current system management device 2 and the program division device 3 are connected to each other via, for example, the Internet, a LAN (Local Area Network), a WAN (Wide Area Network), or a dedicated line. They may be connected via a wired or wireless communication network 5 such as those mentioned above, or may be connected directly via a communication line.

[0014] The current system management device 2 stores a predetermined program. This program is, for example, an application for providing a predetermined service.

[0015] The program division device 3 divides the above-mentioned services into multiple parts and reconstructs them, thereby supporting so-called microservices.

[0016] Specifically, the program division device 3 supports the process of dividing the above program (hereinafter referred to as the program to be divided) into multiple unit programs (hereinafter referred to as microservices in this embodiment) in units of transactions, which are a series of processing groups, to create a new program.

[0017] (Class composition of the program to be divided) FIG. 2 is a diagram for explaining the configuration of a division target program 20 for explaining this embodiment. The division target program 20 is composed of classes, which are groups of processes. That is, the division target program 20 is made up of class AA (21), class BB (22), class CC (23), class DD (24), and class EE (25). In the division target program 20, there are calling relationships in which class AA (21) calls class BB (22) and class EE (25), class BB (22) calls class CC (23), and class CC (23) calls class DD (24).

[0018] (Transactions of programs to be split) 3 is a sequence diagram for explaining transactions in the program 20 to be divided. As will be described later, each class is made up of methods, which are predetermined processing units. Class AA (21) has a method AA.aaa (211). Class BB (22) has a method BB.bbb (221). Class CC (23) has a method CC.ccc (231). Class DD (24) has a method DD.ddd (241). Class EE (25) has a method EE.eee (251). Note that the combinations of classes given above as processing groups and the methods that constitute the groups as processing are just examples, and other types of combinations may be used.

[0019] The program 20 to be divided is composed of transaction A (31) and transaction B (32). Transaction A (31) is composed of method AA.aaa (211), method BB.bbb (221), and method EE.eee (251). Transaction B (32) is composed of method CC.ccc (231) and method DD.ddd (241). The program 20 to be divided starts from method AA.aaa (211) of transaction A (31).

[0020] In transaction A (31), method AA.aaa (211), which is the first method started in that transaction (start method), calls method BB.bbb (221) and method EE.eee (251). In transaction B (32), method CC.ccc (231), which is the start method, calls method DD.ddd (241).

[0021] Furthermore, the method BB.bbb (221) of the transaction AA (31) invokes the method CC.ccc (231) of the transaction B (32), which is a different transaction from the transaction A (31).

[0022] Next, FIG. 4 is a diagram for explaining an example of functions provided in the program division system 1 and information managed by the program division system 1. In FIG.

[0023] The current system management device 2 stores current system source code 200, which is the source code of the program 20 to be divided, current system DB information 100, which is a file storing the configuration of a shared resource (a database in this embodiment) accessed by a method of the program 20 to be divided, and microservice design information 300, which is information regarding the configuration of a microservice obtained by dividing the program 20 to be divided. Note that these pieces of information may be stored by the program division device 3, or may be acquired by the program division device 3 from another information processing system.

[0024] (Current system source code) 5 is a diagram showing an example of a current system source code 200 (however, the portion relating to access to a database is omitted). As described above, in the current system source code 200 (the program 20 to be divided), class AA has a method AA.aaa (201). Class BB has a method BB.bbb (202). Class CC has a method CC.ccc (203). Class DD has a method DD.ddd (204). Class EE has a method EE.eee (205).

[0025] Method AA.aaa (201) has calling sections 206 and 207 that call other methods (method BB.bbb (202) and method EE.eee (205)).

[0026] Furthermore, since the method AA.aaa (201) is a start method, it has information (hereinafter referred to as a start annotation) that indicates the start position of a transaction. Specifically, the method AA.aaa (201) has a first start annotation 208 (@Transactional) that indicates that the method AA.aaa (201) is a method for starting a new transaction when no transaction currently exists (is not being executed) (however, if another transaction is being executed, a new transaction will not be started).

[0027] Next, method BB.bbb (202) has a calling section 209 that calls another method (method CC.ccc (203)). Method CC.ccc (203) has a calling section 210 that calls another class (method DD.ddd (204)).

[0028] Also, method CC.ccc (203) is a start method and therefore has a start annotation. However, this start method is different from that of method AA.aaa (201). Specifically, method CC.ccc (203) has a second start annotation 211 (@Transactional(propagation=Propagation.REQUIRES_NEW)) indicating that it is a method for starting a new transaction (however, it starts a new transaction whether or not another transaction exists).

[0029] (Current system DB information) 6 is a diagram showing an example of current system DB information 100. In addition, the figure also shows an example of current system source code 200 that describes a method for accessing a database shown in the current system DB information 100.

[0030] The current system DB information 100 stores, for each database, the contents or type of data processing (access) performed by the database. In the example shown in the figure, a definition 101 (select) of a process for selecting (reading) data in the database and a definition 102 (update) of a process for updating (writing) data in the database are stored. The data processing is an example, and there may be a new data addition processing or a deletion processing, for example. The current system DB information 100 also stores the processing contents 103, 104 for the above-mentioned processing definitions 101, 102.

[0031] When such current system DB information 100 is set, the method of the current system source code 200 has, for example, database access units 105, 106 that access the database defined in the current system DB information 100 as defined in the current system DB information 100.

[0032] (Microservices Design Information) Next, Fig. 7 is a diagram showing an example of microservice design information 300. Microservice design information 300 is information that stores the configuration of each microservice to be generated by microservice creation. Specifically, microservice design information 300 has data items including microservice name 301 in which the name of each microservice is set, and method name 302 in which the name of each method constituting the microservice is set. The contents of microservice design information 300 may be set by a user, or may be automatically created by a predetermined program.

[0033] Here, in this embodiment, as shown in Figure 7, of the methods of the current system, AA.aaa and BB.bbb will be left as microservice A, and CC.ccc, DD.ddd, and EE.eee will be separated and divided into microservices as a new microservice B.

[0034] Next, as shown in FIG. 4, the program division device 3 has the following functional units: a method analysis unit 311 (program analysis unit), a source code generation unit for microservices 312, a CRUD analysis unit 313 (shared resource analysis unit), a transaction division point analysis unit 314, and a transaction division unit 315.

[0035] Based on the program 20 to be divided, the method analysis unit 311 identifies information on the call relationship between methods of multiple unit programs (i.e., microservices) (hereinafter referred to as method relationship information) and information indicating the position of the method (start method) that starts a transaction in the program 20 to be divided (start annotation; specifically, the first start annotation or the second start annotation).

[0036] The method analysis unit 311 stores the method relationship information in a method relationship information management table 400, and stores information on a transaction indicated by a start annotation (hereinafter referred to as transaction information) in a transaction information management table 500. Details of these databases will be described later.

[0037] The CRUD analysis unit 313 identifies the contents of data access performed by each method of the division target program 20. The CRUD analysis unit 313 stores information on the identified contents of data access (hereinafter, referred to as CRUD information) in the CRUD information management table 600. The CRUD information management table 600 will be described in detail later.

[0038] The transaction division point analysis unit 314 determines whether or not to divide a transaction based on the start annotation (position of the start method) in correspondence with a microservice, based on the call relationship (method relationship information) identified by the method analysis unit 311, the start annotation, and the contents of data access identified by the CRUD analysis unit 313.

[0039] The transaction division point analysis unit 314 also analyzes the transaction division points. The transaction division point analyzer 314 stores the information about the division point in a transaction division point list 700. The transaction division point analyzer 314 also generates a distributed transaction list 800, which is information about a list of transactions (distributed transactions) that are divided by the division point. The transaction division point list 700 will be described in detail later.

[0040] The microservice source code generation unit 312 acquires microservice design information 300 that stores each method that constitutes a microservice. Then, the microservice source code generation unit 312 creates a microservice source code 900 in which call information for calling one microservice from another microservice is added to the one microservice. Note that this call information is expressed as a REST It is assumed to be the API code. Details will be explained later.

[0041] When the transaction division point analysis unit 314 determines that a transaction should be divided, the transaction division unit 315 adds information (division logic) for dividing the transaction to correspond to multiple microservices to the microservice (source code for microservice 900), thereby creating microservice-ized source code 1000, which is a program in which the program to be divided 20 (current system source code 200) has been made into a microservice.

[0042] Specifically, when the transaction division unit 315 determines to divide a transaction, it creates the microservice source code 1000 by adding information (division logic) for dividing the transaction to correspond to multiple microservices to one of the unit programs to which the above-mentioned invocation information has been added.

[0043] Next, Fig. 8 is a diagram showing an example of a hardware configuration of each information processing device (current system management device 2, program division device 3) in the program division system 1. Each information processing device includes a control device 91 such as a CPU (Central Processing Unit), a main memory device 92 such as a RAM (Random Access Memory) or a ROM (Read Only Memory), an auxiliary memory device 93 such as an HDD (Hard Disk Drive) or an SSD (Solid State Drive), a keyboard, The input device 94 is a keyboard, a mouse, a touch panel, or the like; the output device 95 is a display or a touch panel, or the like; and the communication device 95 is a NIC (Network Interface Card), a wireless communication module, a USB (Universal Serial Interface) module, a serial communication module, or the like. and a receiving device 96.

[0044] The functions of the functional units of each information processing device in the program division system 1 described above are realized by the control device 91 reading out a program from the main storage device 92 or the auxiliary storage device 93. Each program can be recorded on a portable or fixed recording medium and distributed, for example. Note that all or a part of these programs may be realized using virtual information processing resources provided using a virtualization technique or a process space separation technique, such as a virtual server provided by a cloud system. Also, all or a part of these programs may be realized by a service provided by a cloud system via an API (Application Programming Interface), for example. Next, the processing performed by the program partitioning system 1 will be described.

[0045] <Program division processing> 9 is a flow diagram illustrating an example of processing (program partitioning processing) performed by the program partitioning system 1. The program partitioning processing is started, for example, when the program partitioning device 3 acquires the current system source code 200.

[0046] First, the method analysis unit 311 of the program partitioning device 3 analyzes the current system source code 200, and creates the method relation information management table 400 and the transaction information management table 500 (s11).

[0047] Specifically, for example, the method analysis unit 311 creates the method relationship information management table 400 by identifying the calling part of each method in the current system source code 200 and the called part identified by the calling part.

[0048] In addition, the method analysis unit 311 creates a transaction information management table 500 by identifying the first start annotation and the second start annotation from each method of the current system source code 200.

[0049] (Method related information management table) 10 is a diagram showing an example of the method relationship information management table 400. The method relationship information management table 400 has data items including a caller method 401 in which the name of the method that is the caller is set, and a callee method 402 in which the name of the method that is the callee is set.

[0050] (Transaction information management table) 11 is a diagram showing an example of the transaction information management table 500. The transaction information management table 500 has data items including a method name 501 in which the name of each method of the current system source code 200 is set, a first start method 502 in which information (hereinafter referred to as a first flag) indicating whether or not the method is a start method (hereinafter referred to as a first start method) in a transaction that is newly started when no transaction exists (o, x), and a second start method 503 in which information (hereinafter referred to as a second flag) indicating whether or not the method is a start method (hereinafter referred to as a second start method) in a transaction that is newly started even when a transaction already exists (o, x). That is, the first flag is set for a method in which the first start annotation or the second start annotation exists. The second flag is set for a method in which the second start annotation exists.

[0051] Next, as shown in FIG. 9, the CRUD analysis unit 313 of the program division device 3 acquires the current system DB information 100, and based on the acquired current system DB information 100 and the current system source code 200, identifies the databases accessed by each method of the current system source code 200 and the content of the access, and creates a CRUD information management table 600 (s13).

[0052] For example, the CRUD analysis unit 313 identifies the database access units 105, 106 that are calling the database among the methods of the current system source code 200, and obtains the name of the database and the content (type) of data access indicated by the identified database access units 105, 106 from the DB information 100.

[0053] (CRUD information management table) 12 is a diagram showing an example of a CRUD information management table 600. The CRUD information management table 600 has data items including a method 601 in which the name of each method is set, a DB table 602 in which the name of the database accessed by the method is set, and a CRUD 603 in which the content or type of data access to the database is set. Note that CRUD 603 may contain, for example, information ("C") indicating that the data access is writing (newly adding) data, information ("R") indicating that the data access is reading (selecting) data, information ("R") indicating that the data access is writing (updating) data, and so on. Information indicating that the data access is a data write (delete) operation ("U"), information indicating that the data access is a data write (delete) operation ("D"), etc. are set.

[0054] Next, as shown in FIG. 9, the transaction splitting point analysis unit 314 of the program division device 3 determines whether or not to split the transaction related to the start annotation based on the method relationship information management table 400 and the transaction information management table 500 created in s11 and the CRUD information management table 600 created in s13, and executes a transaction splitting point analysis process s15 to analyze the splitting point.

[0055] Specifically, the transaction division point analysis unit 314 creates a transaction list 1300 that stores a list of the calling relationships of each method belonging to each transaction and the access contents of the database accessed by each method, and a distributed transaction list 800 that is data in which information about microservices is added to the transaction list 1300.

[0056] The transaction division point analysis unit 314 then identifies the division point in each transaction based on the distributed transaction list 800. The transaction division point analysis unit 314 then creates a transaction division point list 700 that stores information about the division points.

[0057] (Transaction List) 13 is a diagram showing an example of a transaction list 1300. The transaction list 1300 has data items including transaction ID 1301 in which a transaction identifier is set, method 1302 in which a method belonging to the transaction is set, caller 1303 in which a method that calls the method (caller method) is set, DB table 1304 in which a database accessed by the method is set, and CRUD 1305 in which the content or type of the access is set.

[0058] (Distributed Transaction List) 14 is a diagram showing an example of a distributed transaction list 800. This distributed transaction list 800 has data items including a transaction ID 801 in which a transaction identifier is set, a microservice name 802 in which a microservice corresponding to the transaction is set, a method 803 in which a method belonging to the transaction is set, a caller 804 in which a method that calls the method (caller method) is set, a DB table 805 in which a database that the method accesses is set, and a CRUD 806 in which the content or type of the access is set.

[0059] In this example, in each microservice corresponding to transaction A (microservice A that is turned into a microservice from the current system, and microservice B that is separated and divided from the current system (microservice A)), both different microservices, the current system that is turned into a microservice and microservice B, write or update data to the database. In other words, multiple microservices are performing the process of writing data to the database.

[0060] (Distributed Transaction List) 15 is a diagram showing another example of a distributed transaction list 800. In the distributed transaction list 800, in each microservice (a microservice (microservice A) to be microserviceized from the current system and a microservice B to be separated and divided from the current system) corresponding to transaction A, The current system to be integrated (microservice A) reads data from the database, while microservice B writes or updates data to the database. In other words, a single microservice handles writing data to the database.

[0061] (List of transaction split points) 16 is a diagram showing an example of a transaction division point list 700. The transaction division point list 700 has data items including a number 701 in which a serial number of a division point in a transaction is set, a microservice name 702 in which a name of a microservice corresponding to a transaction in which the division point exists is set, a transaction start method name 703 in which a start method of a transaction due to division at the division point is set, a caller microservice name 704 in which a microservice on the side (caller) calling a method in a method call between transactions after the division is set, a split caller method name 705 in which a method making a call in that microservice is set, a callee microservice name 706 in which a microservice on the side (callee) whose method is called in a method call between transactions after the division is set, and a split callee method name 707 in which a method called in that microservice is set.

[0062] <Transaction split point analysis processing> 17 and 18 are flow diagrams for explaining the details of the transaction division point analysis process s15 (divided into two diagrams due to space limitations).

[0063] First, as shown in FIG. 17, the transaction division portion analysis unit 314 selects one of the methods in the current system source code 200 by retrieving one record in the transaction information management table 500 (s151).

[0064] The transaction division point analysis unit 314 determines whether the selected method (hereinafter, referred to as the selected method) is the first start method (s152). Specifically, the transaction division point analysis unit 314 determines whether the first start method 502 of the record acquired in s151 indicates the first start method (◯).

[0065] If the selected method is the first start method (s152: Yes), the transaction division point analysis unit 314 executes the process of s153. If the selected method is not the first start method (s152: No), the transaction division point analysis unit 314 executes the process of s155.

[0066] In s153, the transaction division point analysis unit 314 sets information indicating that the selected method will be the start method of the distributed transaction. Specifically, the transaction division point analysis unit 314 creates a record of the transaction related to the selected method in the transaction list 1300, sets the selected method in the method 1302 of the created record, and sets "-" (no caller) in the caller 1303.

[0067] Furthermore, the transaction division point analysis unit 314 sets information on the database accessed by the selected method and the access content (s154). Specifically, the transaction division point analysis unit 314 acquires a record related to the selected method from the CRUD information management table 600, sets the contents of DB table 602 of the acquired record in DB table 1304 of the record in the created transaction list 1300, and sets the contents of CRUD 603 of the acquired record in CRUD 1305 of the record in the created transaction list 1300. After that, the process of s155 is performed.

[0068] In s155, the transaction division point analysis unit 314 checks whether there is an unselected method in the current system source code 200, and if there is an unselected method, repeats the process of s151 to select that method. If there is no unselected method, the transaction division point analysis unit 314 executes the process of s156.

[0069] In s156, the transaction division point analysis unit 314 acquires one of the transactions of the current system source code 200 by acquiring one record of the transaction list 1300 created above.

[0070] The transaction division point analysis unit 314 sets status information indicating that there may be other methods in the transaction selected in s156 (hereinafter referred to as the selected transaction) (s157). Here, it is assumed that the transaction division point analysis unit 314 sets the variable "newMethod" to "true".

[0071] The transaction division point analysis unit 314 sets the variable "newMethod" to "true". It is checked whether the variable "newMethod" is set to "true" (s158). If this is the case (s158: Yes), the transaction division point analysis unit 314 executes the process of s159, and if the variable "newMethod" is set to "false" (s158: No), the transaction division point analysis unit 314 executes the process of s160.

[0072] In s160, the transaction division point analysis unit 314 checks whether there is an unselected transaction in the current system source code 200, and if there is an unselected transaction, repeats the process of s156 to select its method. If there is no unselected transaction, the transaction division point analysis unit 314 executes the process of s169 described later.

[0073] In s159, the transaction division point analysis unit 314 sets status information indicating that there are no other methods. Here, the transaction division point analysis unit 314 sets the variable "newMethod" to "false". After that, the process of s161 is performed.

[0074] In s161, the transaction division point analysis unit 314 selects one of the methods in the selected transaction by obtaining one of the records related to the selected transaction from the transaction list 1300.

[0075] In addition, in s162, the transaction division point analysis unit 314 selects one of the methods that has not been set with information indicating that it will be a method of the transaction and that has been called from the method selected in s161 (hereinafter referred to as the first selected method) by retrieving one record from the transaction information management table 500.

[0076] Then, the transaction division point analysis unit 314 determines whether the method selected in s162 (hereinafter referred to as the second selected method) is the second start method (s163). Specifically, the transaction division point analysis unit 314 determines whether the second start method 503 of the record acquired in s162 indicates the second start method (◯).

[0077] If the second selected method is the second start method (s163: Yes), the transaction division point analysis unit 314 executes the processing of s167. If the second selected method is not the second start method (s163: No), the transaction division point analysis unit 314 executes the processing of s164.

[0078] In s164, transaction division point analysis unit 314 sets information indicating that the second selected method will be the method of the transaction. Specifically, transaction division point analysis unit 314 creates a record of the transaction related to the second selected method in transaction list 1300, sets the second selected method in method 1302 of the created record, and sets the method calling the second selected method (for example, the second start method) in caller 1303.

[0079] Furthermore, the transaction division point analysis unit 314 sets information on the database accessed by the second selected method and the access content (s165). Specifically, the transaction division point analysis unit 314 acquires a record related to the second selected method from the CRUD information management table 600, sets the contents of DB table 602 of the acquired record to DB table 1304 of the record in the created transaction list 1300, and sets the contents of CRUD 603 of the acquired record to CRUD 1305 of the record in the created transaction list 1300. Then, the transaction division point analysis unit 314 sets the variable "newMethod" to indicate that there is another method in the selected transaction. The value is set to "true" to indicate that there is a possibility that the request may be processed (s166). After that, the process of s167 is carried out.

[0080] In s167, the transaction division point analysis unit 314 checks whether there is another method that has not been set as a method of the transaction and that is called from the first selected method, and if there is such a method, repeats the process of s162 to select that method. If there is no other method that has not been set as a method of the distributed transaction and that is called from the first selected method, the transaction division point analysis unit 314 executes the process of s168.

[0081] In s168, the transaction division point analysis unit 314 checks whether there is an unselected method in the selected transaction, and if there is such a method, repeats the process of s161. If there is no unselected method in the selected transaction, repeats the processes from s158 onwards.

[0082] Next, as shown in FIG. 18, the transaction division point analysis unit 314 creates a distributed transaction list 800 by adding information about the microservice to the transaction list 1300 created above (s169, s170).

[0083] Specifically, the transaction division point analysis unit 314 creates a distributed transaction list 800, which is a new database, by adding the data item of the microservice name 802 and its null information to the transaction list 1300. Then, the transaction division point analysis unit 314 acquires the method 803 of each record of the transaction list 1300, and sets the content of the microservice name 301 of the record of the microservice design information 300 in which the method indicated by the acquired method 803 is set in the method name 302, to the microservice name 802 of each record of the distributed transaction list 800.

[0084] Then, the transaction division point analysis unit 314 selects one of the distributed transactions by acquiring the contents of each record related to the certain transaction from the distributed transaction list 800 (s171).

[0085] The transaction division point analysis unit 314 analyzes the distributed transaction selected in s171. In step S172, it is determined whether multiple microservices are performing processing to write data to a database.

[0086] Specifically, the transaction division point analysis unit 314 refers to the CRUD 806 of each record acquired in s171, and determines whether data related to writing or updating is set in the CRUD 806 of multiple records.

[0087] If multiple microservices are writing data to the database (s172: Yes), the transaction division point analysis unit 314 executes s173. If multiple microservices are not writing data to the database (s172: No), the transaction division point analysis unit 314 executes s174.

[0088] In s173, the transaction division point analysis unit 314 adds information about the microservice and its method that wrote or updated data in the database, identified in s172, to the transaction division point list 700. For example, the transaction division point analysis unit 314 obtains the contents of each record referenced in s172, and adds the obtained contents to a new record in the transaction division point list 700. After that, the processing of s174 is performed.

[0089] In s174, the transaction division point analysis unit 314 checks whether there is an unselected distributed transaction, and if there is an unselected distributed transaction, repeats the process of s171 to select the unselected distributed transaction. If there is no unselected distributed transaction, the transaction division point analysis process s15 ends.

[0090] On the other hand, as shown in FIG. 9, the microservice source code generation unit 312 creates a microservice source code 900 by applying predetermined call information (code) for calling one microservice from another microservice to the current system source code 200 based on the method relationship information management table 400 and the transaction information management table 500 created in s11 (s19).

[0091] For example, first, the microservice source code generation unit 312 identifies each method of a microservice to be divided from the current system based on the microservice design information 300 and the method relationship information management table 400. Then, the microservice source code generation unit 312 identifies a handler for each identified method that indicates that the method accepts calls from other microservices, and creates microservice source code 900 in which the identified code is set in the portion of each method.

[0092] Furthermore, the microservice source code generation unit 312 identifies a method for calling each of the identified methods based on the microservice design information 300 and the method relationship information management table 400. The microservice source code generation unit 312 then identifies a request for calling another microservice corresponding to each of the handlers set above, and creates microservice source code 900 in which the identified code is set in the part of the method that calls each of the identified methods. The codes of the handler and the request are registered in advance in a predetermined database, for example.

[0093] (Source code for microservices) 19 is a diagram showing an example of a microservice source code 900 in which a handler and a request are set. First, in a microservice B (1920) divided from a current system 1910 that has been converted into a microservice, CC.ccc (1901), DD.ddd (1902), and EE.eee (1903), which are methods called from methods of the current system, are The handlers CCHandler (1904), DDHandler (1905), and EEHandler (1906) corresponding to the Handler object (1903) are set.

[0094] Furthermore, of the methods of microservice B (1920), CC.ccc (1901), DD.ddd (1902), and EE.eee (1903), the current system 1910 calls CC.ccc (1901) and EE.eee (1903). Therefore, in the current system 1910, requests httpRequest (1907) and (1908) corresponding to the calling methods AA.aaa and BB.bbb corresponding to CC.ccc (1901) and EE.eee (1903), respectively, are set.

[0095] In the example shown in FIG. 1, the request and handler are implemented using a REST API (API call), but this is not intended to be limiting.

[0096] Next, as shown in FIG. 9, the transaction splitting unit 315 creates a microservice source code 1000 based on the microservice source code 900 created in s19, in which distributed transactions are created by splitting transactions at the split points indicated in the transaction split point list 700 created in s15.

[0097] For example, the transaction division unit 315 creates a microservice source code 1000 in which a code indicating that it is a distributed transaction start method is added before the start method of the microservice source code 900 indicated by the transaction start method name 703 of each record in the transaction division point list 700.

[0098] 20 is a diagram for explaining an example of microservice-implemented source code 1000 (for reference, an example of transaction division location list 700 is also shown). As shown in the figure, in the case where the current system (microservice A) is set as the microservice name 702 in the transaction division location list 700, the method AA.aaa is set as the transaction start method name 703, the current system is set as the caller microservice name 704, the method AA.aaa is set as the division caller method name 705, microservice B is set as the callee microservice name 706, and the method EE.eee is set as the division callee method name 707, a first annotation 2002 (@MsaTransactional) which is a first division logic for dividing a transaction in correspondence with a microservice is inserted immediately before class AA.aaa (2001), which is the start method of the current system (microservice A) in the microservice-implemented source code 1000. Also, a second annotation 2003 (@MsaBranch) which is a second partitioning logic for partitioning the transaction in correspondence with the microservice is added to the hand EEHandler (2004) which corresponds to the method EE.eee of the microservice of the called distributed transaction after partitioning in the microservice-ized source code 1000.

[0099] In this example, the case where annotations are added has been described, but other logic that the distributed transaction should realize (for example, rollback logic) may be added (for example, Saga pattern, Two Phase Commit).

[0100] FIG. 21 is a diagram illustrating an example of the configuration of each microservice generated in association with the microservice creation by the program division processing of this embodiment.

[0101] First, with the shift to microservices, the microservice to which methods AA.aaa and BB.bbb belong (microservice A) and the microservice to which method EE.eee belongs are The service (Microservice B) is separated from the other service (Microservice B).

[0102] Here, class AA (method AA.aaa) of microservice A based on the current system calls class EE (method EE.eee) of another microservice (microservice B), so a handler 2101 is set in class EE, and a request for REST communication 2102 is set in class AA. Similarly, class BB (method BB.bbb) of microservice A based on the current system calls class CC (method CC.ccc) of another microservice (microservice B), so a handler 2103 is set in class CC, and a request for REST communication 2104 is set in class BB.

[0103] Furthermore, by using microservices, the invocation of EE.eee (handler 2101) from AA.aaa spans microservices. Therefore, decoupling logic 2105 and 2106 are set when invoking EE.eee (handler 2101) from AA.aaa. Similarly, by using microservices, the invocation of CC.ccc (handler 2103) from BB.bbb spans microservices. Therefore, decoupling logic 2107 and 2108 are set when invoking CC.ccc (handler 2103) from BB.bbb.

[0104] As described above, the program division device 3 of this embodiment determines whether to divide a transaction corresponding to a microservice based on the calling relationship between microservices, the start annotation, and the content of data access performed by the program 20 to be divided.If it is determined that the transaction should be divided based on the start annotation, the program division device 3 creates a microservice-based program by adding division logic to the microservice.

[0105] In this way, the program division device 3 determines whether to split a transaction based on the start annotation in correspondence with a microservice, depending on the calling relationship between microservices and the content of the data access. Therefore, it is possible to split a transaction only where necessary (by adopting a distributed transaction technique) so that no problems occur in data access by the transaction (for example, so that data consistency can be guaranteed in the transaction).

[0106] As described above, according to the program partitioning device 3 of this embodiment, a program can be partitioned while maintaining the consistency of data processing and suppressing performance degradation after partitioning.

[0107] In addition, the program division device 3 of this embodiment identifies whether or not the data access performed by each of two or more microservices in the program 20 to be divided involves writing data to a database, and if it is determined that the data access involves writing data to a database, it determines to divide the transaction according to the microservice.

[0108] This prevents data inconsistencies that may occur when different microservices write data to the database (e.g., by using logic such as rollbacks).

[0109] In addition, the program division device 3 of this embodiment adds invocation information (e.g., code for performing REST communication) for invoking one microservice from another microservice to the one microservice, and creates a microservice-based program by adding decoupling logic to the microservice to which this invocation information has been added.

[0110] This allows microservice-based programs to operate correctly even when there are calls across microservices.

[0111] In addition, the program division device 3 of this embodiment determines whether to divide a transaction based on the position of the start method in correspondence with the microservice, based on the calling relationship between the methods of the microservice, the start method, and the content of data access performed by each method of the program 20 to be divided, and if it is determined that the transaction should be divided, creates a microservice-based program by adding division logic to the position of the start method.

[0112] In this way, by identifying and dividing the division points of a transaction based on the method, consistent data processing can be ensured.

[0113] The present invention is not limited to the above-described embodiment, and can be implemented using any components without departing from the scope of the present invention. The above-described embodiments and modifications are merely examples, and the present invention is not limited to these contents as long as the features of the invention are not impaired. In addition, although various embodiments and modifications have been described above, the present invention is not limited to these contents. Other aspects conceivable within the scope of the technical idea of ​​the present invention are also included in the scope of the present invention.

[0114] For example, part of the hardware included in each device of this embodiment may be provided in another device.

[0115] Furthermore, each program of each device may be provided in another device, a program may consist of multiple programs, or multiple programs may be integrated into one program. [Explanation of symbols]

[0116] 3 Program division device, 20 Program to be divided, 311 Method analysis section, 312 Microservice source code generation unit, 313 analysis unit, 314 transaction split location analysis unit, 315 transaction split unit

Claims

1. A program division device that divides a division target program corresponding to a predetermined transaction into a plurality of unit programs to create a new program, a storage device that stores the program to be divided; and a program analysis process for identifying a calling relationship between the plurality of unit programs and information indicating a start position of the transaction in the program to be divided, based on the program to be divided; a shared resource analysis process for identifying the contents of data accesses made by the program to be divided; a transaction division point analysis process for determining whether or not to divide the transaction based on the specified start position in correspondence with division of the unit programs, based on the specified calling relationship, information indicating the specified start position, and the content of the specified data access; a control device that executes a transaction division process that creates the new program by adding information for dividing the transaction in association with the plurality of unit programs to the unit programs when it is determined that the transaction should be divided. A program division device comprising:

2. The control device includes: In the shared resource analysis process, it is determined whether or not a data access made by each of two or more unit programs in the program to be divided writes data to a shared resource; when it is determined in the transaction division portion analysis process that the data access involves writing data to a shared resource, it is determined that the transaction is to be divided based on the specified start position in correspondence with the division of the two or more unit programs; 2. The program dividing device according to claim 1.

3. The control device includes: A microservice source code generation process is executed to add call information for calling one of the unit programs from the other of the unit programs to the one of the unit programs; when it is determined in the transaction division processing that the transaction is to be divided, information for dividing the transaction in correspondence with the plurality of unit programs is added to one of the unit programs to which the call information has been added, thereby creating the new program.

2. The program dividing device according to claim 1.

4. the storage device stores a division target program configured with a method that is a unit of processing, The control device includes: In the program analysis process, a call relationship between methods of the plurality of unit programs and information indicating a position of a method that starts the transaction in the division target program are identified based on the division target program; In the shared resource analysis process, contents of data accesses made by each method of the program to be divided are identified; in the transaction division point analysis process, determining whether or not to divide the transaction based on the position of the identified method in correspondence with division of the unit program, based on the identified calling relationship, the position of the identified method, and the content of the identified data access; when it is determined in the transaction division processing that the transaction is to be divided, creating the new program by adding information for dividing the transaction in correspondence with the plurality of unit programs to the position of the specified method of the divided unit program.

2. The program dividing device according to claim 1.

5. 1. A program division method for dividing a division target program corresponding to a predetermined transaction into a plurality of unit programs to create a new program, comprising the steps of: An information processing device, storing the program to be divided; a program analysis process for identifying a calling relationship between the plurality of unit programs and information indicating a start position of the transaction in the program to be divided, based on the program to be divided; a shared resource analysis process for identifying the contents of data accesses made by the program to be divided; a transaction division point analysis process for determining whether or not to divide the transaction based on the specified start position in correspondence with division of the unit programs, based on the specified calling relationship, information indicating the specified start position, and the content of the specified data access; and executing a transaction division process for creating the new program by adding information for dividing the transaction in association with the plurality of unit programs to the unit programs when it is determined that the transaction should be divided. Program division method.

6. The information processing device, In the shared resource analysis process, it is determined whether or not a data access made by each of two or more unit programs in the program to be divided writes data to a shared resource; when it is determined in the transaction division portion analysis process that the data access involves writing data to a shared resource, it is determined that the transaction is to be divided based on the specified start position in correspondence with the division of the two or more unit programs; 6. The program dividing method according to claim 5.

7. The information processing device, A microservice source code generation process is executed to add call information for calling one of the unit programs from the other of the unit programs to the one of the unit programs; when it is determined in the transaction division processing that the transaction is to be divided, information for dividing the transaction in correspondence with the plurality of unit programs is added to one of the unit programs to which the call information has been added, thereby creating the new program.

6. The program dividing method according to claim 5.

8. the information processing device stores a division target program configured with methods that are units of processing, The information processing device, In the program analysis process, a call relationship between methods of the plurality of unit programs and information indicating a position of a method that starts the transaction in the division target program are identified based on the division target program; In the shared resource analysis process, contents of data accesses made by each method of the program to be divided are identified; in the transaction division point analysis process, determining whether or not to divide the transaction based on the position of the identified method in correspondence with division of the unit program, based on the identified calling relationship, the position of the identified method, and the content of the identified data access; when it is determined in the transaction division processing that the transaction is to be divided, creating the new program by adding information for dividing the transaction in correspondence with the plurality of unit programs to the position of the specified method of the divided unit program.

6. The program dividing method according to claim 5.

Citation Information

Patent Citations

  • Information processing device, information processing system, information processing method, and program

    JP2020160922A

  • Computer implemented method, computer program product, and system (constraints-based refactoring of monolith applications through attributed graph embeddings)

    JP2023038909A

  • Containerized deployment of microservices based on monolithic legacy applications

    JP7057571B2