Microservice merging method, device, equipment and storage medium
By merging microservices in the server and optimizing the number of microservices, the operation and maintenance challenges and resource consumption problems caused by the increase in the number of microservices are solved, and resource saving and operation and maintenance efficiency are improved.
Patent Information
- Application Number
- CN202411140014.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-08-20
AI Technical Summary
With the widespread application of microservice architecture, the number of microservices in servers has continued to increase, resulting in huge challenges in system operation and maintenance and increasing the consumption of server resources.
By determining the microservice merging indicators and merge objects, the microservices to be run are merged when the merge conditions meet the merge conditions, and the target microservices are generated, thereby optimizing the number of microservices in the server.
It reduces the number of microservices in the server, saves server operation resources, and improves server operation and maintenance efficiency.
Smart Images

Figure CN118656221B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of microservice technology, and in particular to a microservice merging method, device, equipment and storage medium. Background Art
[0002] With the widespread application of microservice architecture, the number of microservices in servers continues to increase, which brings huge challenges to system operation and maintenance. The increase in the number of microservices will lead to an increase in the consumption of server resources.
[0003] Therefore, there is an urgent need for a microservice merging method to reduce the number of microservices in the server, improve server operation and maintenance efficiency, and save server operating resources. Summary of the invention
[0004] The present invention provides a microservice merging method, device, equipment and storage medium to reduce the number of microservices in a server and improve the server operation and maintenance efficiency.
[0005] According to one aspect of the present invention, a microservice merging method is provided, comprising:
[0006] Based on the performance index of the target server and the number of microservices to be run in the target server, a microservice merging index is determined; wherein the microservice merging index is an index used to determine whether to merge microservices;
[0007] Based on the total amount of code of the microservices to be run, determine the microservice merging object; wherein the microservice merging object is used to characterize the microservices to be run that need to be merged;
[0008] When the microservice merging indicator meets the microservice merging condition, the microservices to be run are merged based on the microservice merging object to generate at least one target microservice; wherein the microservice merging condition is used to characterize the minimum running performance condition of a single microservice.
[0009] According to another aspect of the present invention, a microservice merging device is provided, comprising:
[0010] An indicator determination module, used to determine a microservice merging indicator based on a performance indicator of a target server and the number of microservices to be run in the target server; wherein the microservice merging indicator is an indicator used to determine whether to merge microservices;
[0011] An object determination module, used to determine a microservice merging object based on the total amount of code of the microservice to be run; wherein the microservice merging object is used to characterize the microservice to be run that needs to be merged;
[0012] A merging module is used to merge the microservices to be run based on the microservice merging object to generate at least one target microservice when the microservice merging indicator meets the microservice merging condition; wherein the microservice merging condition is used to characterize the minimum running performance condition of a single microservice.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice merging method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the microservice merging method described in any embodiment of the present invention when executed.
[0018] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. The computer program is used to enable a processor to implement the microservice merging method described in any embodiment of the present invention when executed.
[0019] The technical solution of the embodiment of the present invention determines a microservice merging indicator and a microservice merging object. When the microservice merging indicator meets the microservice merging condition, the running microservices are merged based on the microservice merging object, the number of microservices in the server is optimized, the number of microservices in the server is reduced, the server running resources are saved, and the server operation efficiency is improved.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 This is a flowchart of a microservice merging method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of a microservice merging method provided according to Embodiment 2 of the present invention;
[0024] Figure 3 This is a schematic diagram of the structure of a microservice merging device provided according to Embodiment 3 of the present invention;
[0025] Figure 4 It is a structural schematic diagram of an electronic device for implementing the microservice merging method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Embodiment 1
[0029] Figure 1 A flowchart of a microservice merging method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of merging microservices deployed in a server. The method can be executed by a microservice merging device. The microservice merging device can be implemented in the form of hardware and / or software. The microservice merging device can be configured in various general-purpose computing devices, such as general-purpose server devices. Figure 1 As shown, the method includes:
[0030] S110: Determine a microservice merging index based on the performance index of the target server and the number of microservices to be run in the target server.
[0031] Among them, the target server may refer to the server specified by the user for microservice merging; the performance index may be an index used to characterize the running performance of the server, which is an inherent attribute of the server; the microservice to be run may refer to the microservice set in the target server, for example, in an e-commerce server, microservices for different functions are set, such as login microservice, order microservice, return microservice, inventory update microservice, etc.; the microservice merging index may be an index used to determine whether to merge microservices. Optionally, the performance index may include the total number of CPU cores of the target server, the physical memory and running memory of the target server.
[0032] In the embodiment of the present invention, the microservice merging index of the target microservice may be determined according to the performance index of the target server and the number of microservices to be run deployed in the target server.
[0033] Optionally, based on the performance indicators of the target server and the number of microservices to be run in the target server, a microservice merging indicator is determined, including: determining the average CPU core allocation, physical memory allocation, and running memory allocation allocated to the microservices to be run at runtime according to the total number of CPU cores of the target server, the physical memory and running memory of the target server, and the number of microservices to be run in the target server; and using the CPU core allocation, physical memory allocation, and running memory allocation as the microservice merging indicator.
[0034] Exemplarily, in an embodiment of the present invention, if it is determined that the total number of CPU cores of the target server is Q1, the physical memory is Q2, and the running memory is Q3, and the number of microservices to be run in the target server is Q, then the average CPU core allocation amount allocated to the microservice to be run during runtime is Q1 / Q, the physical memory allocation amount is Q2 / Q, and the running memory allocation amount is Q3 / Q.
[0035] S120: Determine a microservice merging object based on the total amount of code of the microservice to be run.
[0036] The microservice merge object may be used to represent the microservices to be run that need to be merged.
[0037] In the embodiment of the present invention, the microservice merging object may be determined based on the total amount of code of the microservices to be run in the target server and the amount of code of each microservice to be run.
[0038] S130: When the microservice merging indicator meets the microservice merging condition, the running microservices are merged based on the microservice merging object to generate at least one target microservice.
[0039] Among them, the microservice merging condition can be used to characterize the minimum operating performance condition of a single microservice; the target microservice can refer to the merged microservice to be run; optionally, the total code volume of the target microservice is less than a preset maximum code volume threshold, and the maximum code volume threshold can be adaptively set according to technical personnel in this field.
[0040] Specifically, in an embodiment of the present invention, if the microservice merging index meets the microservice merging condition, for example, the average CPU core number allocation amount allocated to the microservice to be run during operation is greater than or equal to the core number allocation threshold, the physical memory allocation amount is greater than or equal to the physical memory allocation threshold, and the running memory allocation amount is greater than or equal to the running memory allocation threshold, then based on the microservice merging object, the microservices to be run in the target server are merged to generate at least one target microservice. Optionally, the core number allocation threshold, the physical memory allocation threshold, and the running memory allocation threshold can constitute factors of the microservice merging condition, and the microservice merging condition can be adaptively set according to those skilled in the art.
[0041] Optionally, based on the microservice merging object, the running microservices are merged, including: determining the running microservices that need to be merged according to the microservice merging object; copying the source code of each running microservice that needs to be merged as a sub-file to the code path of the target microservice, and packaging the target microservice and the running microservices that do not need to participate in the merging to generate an executable file.
[0042] In an embodiment of the present invention, when the microservice merging index meets the microservice merging condition, the code path of the target microservice can be set in the target server, and the target microservice can include at least two microservices to be run, and the source code of each microservice to be run can exist in the code path of the target microservice in the form of a subfile, and the number of subfiles can be the same as the number of microservices to be run that participate in generating the target microservice. Optionally, the code path of the target microservice can be located in the same server directory as the code path of the microservice to be run, and the code path of the target microservice can be adaptively set according to those skilled in the art.
[0043] Optionally, in an embodiment of the present invention, the process of generating the target microservice also includes: modifying the routing configuration file of the target server according to the substitute dependency relationship between the microservices to be run, and modifying the dependency configuration of the microservices to be run that need to be merged to depend on the target microservice; if the dependency configuration of the microservices to be run that do not need to participate in the merger is the microservices to be run that need to be merged, then modifying the dependency configuration of the microservices to be run that need to participate in the merger to depend on the target microservice. It should be noted that the microservices to be run in the same target microservice can realize self-calling.
[0044] The technical solution of the embodiment of the present invention determines a microservice merging indicator and a microservice merging object. When the microservice merging indicator meets the microservice merging condition, the running microservices are merged based on the microservice merging object, the number of microservices in the server is optimized, the number of microservices in the server is reduced, the server running resources are saved, and the server operation efficiency is improved.
[0045] Embodiment 2
[0046] Figure 2 This is a flowchart of a microservice merging method provided in the second embodiment of the present invention. This embodiment further refines the above embodiment and provides specific steps for determining the microservice merging object based on the total amount of code of the microservice to be run. It should be noted that for the parts not described in detail in the embodiment of the present invention, please refer to the relevant descriptions of other embodiments, and will not be repeated here. Figure 2 As shown, the method includes:
[0047] S210: Determine a microservice merging index based on the performance index of the target server and the number of microservices to be run in the target server.
[0048] S220: Obtain the amount of code for each microservice to be run, and determine the total amount of code for the microservices to be run in the target server.
[0049] S230: Determine the average code amount of the microservices to be run according to the total code amount and the number of microservices to be run.
[0050] S240: Determine a microservice merging object according to the average code size of the microservices to be run and the code size of each microservice to be run.
[0051] S250: When the microservice merging indicator meets the microservice merging condition, the running microservices are merged based on the microservice merging object to generate at least one target microservice.
[0052] Among them, the microservice merging objects include the microservices to be run whose code volume is less than the average code volume.
[0053] In an embodiment of the present invention, the microservice merging object can be determined based on the amount of code of each microservice to be run and the total amount of code of the microservice to be run in the target server. The amount of code of the microservice to be run can refer to the number of lines of code of the microservice to be run, and the total amount of code can refer to the total number of lines of code of all microservices to be run in the target server. Then, the average amount of code of a single microservice to be run can be determined based on the total amount of code of the microservice to be run in the target server and the number of microservices to be run in the target server. For example, if the total amount of code of the microservice to be run in the target server is X, and the number of microservices to be run in the target server is Q, then the average amount of code of the microservice to be run is X / Q, and then the microservice to be run with a code amount less than the average code amount can be used as a microservice merging object, and the microservice to be run with a code amount greater than or equal to the average code amount is not merged, as a microservice to be run that does not need to be merged. Further, if the amount of code of the microservice to be run that needs to be merged is greater than the maximum code amount threshold, a target microservice can be reset.
[0054] The technical solution of the embodiment of the present invention can merge microservices with smaller functional volumes while minimizing the impact on the original server microservice architecture to the greatest extent possible by merging the microservices to be run whose code volume is less than the average code volume, thereby improving the efficiency of microservice merging.
[0055] Embodiment 3
[0056] Figure 3 This is a schematic diagram of the structure of a microservice merging device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device comprises:
[0057] The indicator determination module 310 is used to determine the microservice merging indicator based on the performance indicator of the target server and the number of microservices to be run in the target server; wherein the microservice merging indicator is an indicator used to determine whether to merge the microservices;
[0058] The object determination module 320 is used to determine the microservice merging object based on the total amount of code of the microservice to be run; wherein the microservice merging object is used to represent the microservice to be run that needs to be merged;
[0059] The merging module 330 is used to merge the microservices to be run based on the microservice merging object to generate at least one target microservice when the microservice merging indicator meets the microservice merging condition; wherein the microservice merging condition is used to characterize the minimum running performance condition of a single microservice.
[0060] The technical solution of the embodiment of the present invention determines a microservice merging indicator and a microservice merging object. When the microservice merging indicator meets the microservice merging condition, the running microservices are merged based on the microservice merging object, the number of microservices in the server is optimized, the number of microservices in the server is reduced, the server running resources are saved, and the server operation efficiency is improved.
[0061] Optionally, the object determination module 320 can be specifically used to: obtain the amount of code of each microservice to be run, and determine the total amount of code of the microservices to be run in the target server; determine the average amount of code of the microservices to be run based on the total amount of code and the number of microservices to be run; determine the microservice merging object based on the average amount of code of the microservices to be run and the amount of code of each microservice to be run.
[0062] Optionally, the microservice merging objects include: microservices to be run whose code volume is smaller than the average code volume.
[0063] Optionally, the performance indicators include the total number of CPU cores of the target server, the physical memory and the running memory of the target server.
[0064] Optionally, the indicator determination module 310 can be specifically used to: determine the CPU core number allocation, physical memory allocation, and running memory allocation averagely allocated to the microservices to be run at runtime based on the total number of CPU cores of the target server, the physical memory and running memory of the target server, and the number of microservices to be run in the target server; and use the CPU core number allocation, physical memory allocation, and running memory allocation as microservice merging indicators.
[0065] Optionally, the merging module 330 can be specifically used to: determine the microservices to be run that need to be merged according to the microservice merging object; copy the source code of each microservice to be run that needs to be merged as a sub-file to the code path of the target microservice, and package the target microservice and the microservices to be run that do not need to participate in the merge to generate an executable file.
[0066] Optionally, the device further comprises:
[0067] The configuration dependency modification module is used to modify the routing configuration file of the target server, and modify the dependency configuration of the microservice to be run that needs to be merged to depend on the target microservice; if the dependency configuration of the microservice to be run that does not need to participate in the merger is the microservice to be run that needs to be merged, the dependency configuration of the microservice to be run that needs to participate in the merger is modified to depend on the target microservice.
[0068] The microservice merging device provided in the embodiment of the present invention can execute the microservice merging method provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.
[0069] Embodiment 4
[0070] Figure 4 A schematic diagram of the structure of an electronic device 410 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0071] like Figure 4 As shown, the electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411 in communication, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 to the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.
[0072] Multiple components in the electronic device 410 are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a disk, an optical disk, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0073] The processor 411 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 411 executes the various methods and processes described above, such as the microservice merging method.
[0074] In some embodiments, the microservice merging method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the microservice merging method described above may be performed. Alternatively, in other embodiments, the processor 141 may be configured to perform the microservice merging method in any other appropriate manner (e.g., by means of firmware).
[0075] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0076] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0077] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0078] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0079] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0080] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0081] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0082] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A microservice merging method, characterized in that: include: Based on the performance index of the target server and the number of microservices to be run in the target server, a microservice merging index is determined; wherein the microservice merging index is an index used to determine whether to merge microservices; Based on the total amount of code of the microservices to be run, determine the microservice merging object; wherein the microservice merging object is used to characterize the microservices to be run that need to be merged; the total amount of code refers to the total number of lines of code of all microservices to be run in the target server; When the microservice merging indicator meets the microservice merging condition, the microservices to be run are merged based on the microservice merging object to generate at least one target microservice; wherein the microservice merging condition is used to characterize the minimum running performance condition of a single microservice; Among them, based on the total amount of code of the microservice to be run, the microservice merging object is determined, including: Obtain the amount of code for each microservice to be run, and determine the total amount of code for the microservices to be run in the target server; Determine the average code amount of the microservices to be run according to the total code amount and the number of microservices to be run; Determine the microservice merging object according to the average code size of the microservices to be run and the code size of each microservice to be run; Wherein, based on the microservice merging object, merging the microservices to be run includes: According to the microservice merging object, determine the running microservices that need to be merged; The source code of each microservice to be run that needs to be merged is copied as a sub-file to the code path of the target microservice, and the target microservice and the microservices to be run that do not need to be merged are packaged to generate an executable file.
2. The microservice merging method according to claim 1, characterized in that: The microservice merging objects include: microservices to be run whose code volume is smaller than the average code volume.
3. The microservice merging method according to claim 1, characterized in that: The performance indicators include the total number of CPU cores of the target server, the physical memory and the running memory of the target server; accordingly, based on the performance indicators of the target server and the number of microservices to be run in the target server, the microservice merging indicators are determined, including: According to the total number of CPU cores of the target server, the physical memory and running memory of the target server, and the number of microservices to be run in the target server, determine the average CPU core allocation, physical memory allocation, and running memory allocation allocated to the microservices to be run during runtime; and use the CPU core allocation, physical memory allocation, and running memory allocation as microservice merging indicators.
4. The microservice merging method according to claim 1, characterized in that: Also includes: Modify the routing configuration file of the target server and change the dependency configuration of the microservice to be merged to the dependency of the target microservice; If the dependency configuration of the to-be-run microservice that does not need to participate in the merger is the to-be-run microservice that needs to be merged, the dependency configuration of the to-be-run microservice that needs to participate in the merger is modified to depend on the target microservice.
5. A microservice merging device, characterized in that: include: An indicator determination module, used to determine a microservice merging indicator based on a performance indicator of a target server and the number of microservices to be run in the target server; wherein the microservice merging indicator is an indicator used to determine whether to merge microservices; An object determination module is used to determine a microservice merging object based on the total amount of code of the microservices to be run; wherein the microservice merging object is used to characterize the microservices to be run that need to be merged, and the total amount of code refers to the total number of lines of code of all microservices to be run in the target server; A merging module, configured to merge the microservices to be run based on the microservice merging object to generate at least one target microservice when the microservice merging indicator meets the microservice merging condition; wherein the microservice merging condition is used to characterize the minimum running performance condition of a single microservice; The object determination module is specifically used to: obtain the code amount of each microservice to be run, and determine the total code amount of the microservices to be run in the target server; determine the average code amount of the microservices to be run according to the total code amount and the number of microservices to be run; determine the microservice merging object according to the average code amount of the microservices to be run and the code amount of each microservice to be run; Among them, the merging module is specifically used to: determine the microservices to be run that need to be merged according to the microservice merging object; copy the source code of each microservice to be run that needs to be merged as a sub-file to the code path of the target microservice, and package the target microservice and the microservices to be run that do not need to participate in the merge to generate an executable file.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice merging method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the microservice merging method according to any one of claims 1 to 4 when executed.
8. A computer program product, characterized in that The invention comprises a computer program, which implements the microservice merging method according to any one of claims 1 to 4 when executed by a processor.
Citation Information
Patent Citations
Micro-service configuration method and device, electronic equipment and medium
CN113434218A
Micro-service determination method and device, equipment, storage medium and product
CN118349373A