Managing communication between microservices
By monitoring and relocating the communication traffic of microservices, the communication overhead between microservices in the cloud environment is reduced, efficiency and performance are improved, and the problems of resource consumption and low efficiency in traditional communication methods are solved.
Patent Information
- Application Number
- CN202180048198.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-08-05
- Filing Date
- 2021-07-27
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-07-27
AI Technical Summary
In a cloud environment, there is excessive processing overhead and resource consumption during the communication process between microservices, especially due to frequent marshalling, unmarshalling, and encryption and decryption operations, which leads to an increase in network traffic and affects system efficiency and performance.
By monitoring the traffic properties between microservices, dynamically relocate microservices from their source resources to shared resources to reduce communication distance and complexity, and use inter-process communication or direct function calls to replace network communication, reducing encryption and decryption. process.
It effectively reduces the communication processing overhead between microservices, improves communication efficiency and system performance, reduces physical equipment and energy consumption, and improves hardware utilization and application compatibility.
Smart Images

Figure CN115777192B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates generally to communication between microservices, and more particularly to managing communication between multiple microservices. Background Art
[0002] Traditional microservices are software development techniques, specifically a variation of the service-oriented architecture (SOA) structural style, which arranges applications as a collection of services. Thus, microservices (or microservice architecture) use a cloud-native architecture approach in which a single application consists of many loosely coupled and independently deployable smaller components or services. These services typically have their own stacks including databases and data models, and communicate with each other through a combination of a representative state transfer application programming interface (REST API), event streams, and message brokers. Services are also typically organized by service capabilities, where the lines that separate services are typically called bounded contexts.
[0003] Microservices deployed in cloud environments typically communicate with each other using cloud APIs. These APIs are typically implemented through REST calls, such as Hypertext Transfer Protocol (HTTP) REST calls. For a simple REST function, most of the processing required to service the function includes marshalling, transmitting, and unmarshalling requests for making API calls. Marshalling refers to the process of converting a memory representation of an object into a data format suitable for storage or transmission, and is typically used when data must be moved between different parts of a computer program / service or from one program / service to another. Unmarshalling refers to unpacking a data format by converting it back to a memory representation.
[0004] Serving the function may also include encrypting and decrypting the API call as it is made over the network. As a result, most of the processing performed to make the HTTP REST function call is performed using excessive and / or indirect computing time, memory, bandwidth, or other resources required to perform the task (i.e., computing overhead), rather than using application logic.
[0005] Cloud applications can use node (i.e., worker machines in a cloud environment) affinity to minimize network traffic by constraining which nodes a pod (i.e., an object representing a set of running containers in a cluster) is eligible to be scheduled on based on labels associated with the nodes. However, the overhead of marshaling and unmarshaling data to and from HTTP messages still exists. In addition, an organization's security requirements may require that HTTP traffic traveling through the network be encrypted as Hypertext Transfer Protocol Secure (HTTPS), further increasing the required processing overhead. Summary of the invention
[0006] The present invention seeks to provide a computer-implemented method for managing communications between a plurality of microservices.
[0007] The present invention further seeks to provide a computer program product comprising computer program code for implementing the proposed method when executed by a processing unit.
[0008] The present invention also seeks to provide a processing system adapted to execute this computer program code.
[0009] The present invention also seeks to provide a system for managing communications between multiple microservices.
[0010] According to one aspect of the present invention, a computer-implemented method is provided. The method includes monitoring traffic between a plurality of microservices to determine properties of the traffic. Then, the method includes relocating each of the plurality of microservices from its corresponding source resource to a shared resource based on the determined properties of the monitored traffic.
[0011] According to another aspect of the present invention, a computer system is provided. The system includes a monitoring unit for monitoring traffic between multiple microservices to determine attributes of the traffic. The system also includes a relocation unit configured to relocate each of the multiple microservices from its corresponding source resource to a shared resource based on the determined attributes of the monitored traffic.
[0012] According to another aspect of the present invention, a computer program product is provided, which includes a computer-readable storage medium having program instructions embodied therein, and the program instructions can be executed by a processing unit to enable the processing unit to perform the method according to the proposed embodiment.
[0013] According to another aspect of the present invention, there is provided a processing system comprising at least one processor and a computer program product according to an embodiment. The at least one processor is adapted to execute computer program code of the computer program product. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Preferred embodiments of the present invention will now be described, by way of example only, with reference to the following drawings, in which:
[0015] Figure 1 shows a graphical representation of an example distributed system according to an embodiment of the present invention;
[0016] Figure 2 is a block diagram of an example system in which aspects of the example embodiments may be implemented according to an embodiment of the present invention;
[0017] Figure 3is a flow chart of a computer-implemented method for managing communications between multiple microservices according to an embodiment of the present invention;
[0018] Figure 4 is a simplified block diagram of an exemplary embodiment of a system for managing communications between multiple microservices according to an embodiment of the present invention;
[0019] Figures 5A-5E is a simplified block diagram of an example of communication between multiple microservices according to an embodiment of the present invention; and
[0020] Figure 6 is a block diagram of an example system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] It should be understood that these figures are schematic only and are not drawn to scale. It should also be understood that the same reference numerals are used throughout the Figures to indicate the same or similar components.
[0022] In the context of the present application, when an embodiment of the present invention constitutes a method, it should be understood that such a method may be a process for being executed by a computer, i.e., a computer-implementable method. Therefore, the various steps of the method may reflect various parts of a computer program, for example. Various parts of one or more algorithms.
[0023] Moreover, in the context of the present application, a system may be a single device or a collection of distributed devices adapted to perform one or more embodiments of the method of the present invention. For example, a system may be a personal computer (PC), a server, or a collection of PCs and / or servers connected via a network such as a local area network, the Internet, etc., to collaboratively perform at least one embodiment of the method of the present invention.
[0024] Concepts for managing communication between multiple microservices are proposed. Such concepts can optimize microservices by manipulating autonomous load-sensitive transport and topology. Thus, embodiments can facilitate dynamic reduction of processing overhead for communication between multiple microservices based on actual performance of the application rather than requiring application changes. Embodiments can further facilitate automatic migration of microservices around a cluster.
[0025] Such concepts may involve the concept of "taking a microservice down" and "up" (i.e., shutting down and restarting the microservice) while reconfiguring the microservice. The microservices may use a public API for communicating between them that may be reconfigured based on the network traffic traveling between the microservices. By reconfiguring the microservices, communications may be exchanged between communications by way of Hypertext Transfer Protocol Secure (HTTPS), Hypertext Transfer Protocol (HTTP), inter-process communications, and direct function calls.
[0026] Embodiments can be implemented in combination with an API layer for abstracting function calls between services, a monitoring service (i.e., a monitoring unit) that monitors traffic through a generated API, and a combined service (i.e., a relocation unit) that turns services "off" and "on" while reconfiguring the service communication mode. The API layer can be generated by a document including an interface specification in another high-level specification language. The generated API layer can include multiple APIs and can be used to call between services. The generated API can automatically report usage (i.e., traffic) to the monitoring service.
[0027] The embodiments may further be implemented in conjunction with the concept of generating REST calls through an API layer and analyzing the resulting traffic between services in a distributed microservices environment running within a cloud environment. If a large amount of traffic traveling between services is identified, the microservices may be reconfigured by shutting down and starting up (or scaling down and up) microservices that are closer to each other.
[0028] The proposed embodiments may employ the concept of adapting services to use a specifically generated API layer instead of direct REST calls. As a result, the generated API layer may change how API calls are made. Relocating services to the same machine may remove the process of encryption and decryption from the communication. Relocating services to the same container may change the communication to an inter-process call. Relocating services to the same process may change the communication to a simple function call. In each case, the services may be treated as "black boxes" such that the requirement for specific information about each service is reduced.
[0029] Embodiments of the present invention recognize that information from messages sent between microservices can be obtained, and then used to redistribute each microservice (e.g., by reducing the distance required for communication between them). Therefore, embodiments of the present invention can bring these microservices closer together by moving them from their original resources (i.e., source resources) to resources shared by the microservices (i.e., shared resources). By sharing resources, embodiments of the present invention can reduce the complexity of communication between microservices based on information obtained from the communication. In this way, by bringing microservices closer together, information that does not require complex methods of communication between microservices can be sent through simpler distribution techniques.
[0030] The proposed embodiments may further adopt the concept of moving two or more containers into a shared Pod and / or moving two or more microservices into a shared container so as to use inter-process communication instead of using a network when two or more microservices frequently interact.
[0031] In the proposed embodiment, relocating each of the plurality of microservices may include: for each of the plurality of microservices, restarting the microservice at the shared resource and shutting down the microservice at its source resource. In this way, the plurality of microservices may be brought closer to each other, so that resources used by each of the plurality of microservices may be shared across all of the plurality of microservices. Therefore, this may reduce the processing overhead required for communication between the plurality of microservices, which may improve the efficiency of communication.
[0032] In some embodiments, relocating each of the plurality of microservices may include reconfiguring communications between the plurality of microservices by collecting the plurality of microservices from each of their respective source resources to a shared resource. In this way, communications may be reconfigured to reduce processing overhead associated with a microservice that invokes functionality of another of the plurality of microservices.
[0033] In the proposed embodiment, the attributes of the monitored traffic may include at least one of the following: the amount of data moved between the plurality of microservices, the type of data moved between the plurality of microservices, and the traffic volume of the data moved between the plurality of microservices. In this way, the range of various attributes of the monitored traffic that can be used to determine whether to relocate each of the plurality of microservices can be increased. As a result, the effectiveness and reliability of relocating each of the plurality of microservices based on the determined attributes of the monitored traffic can be improved because the information related to the monitored traffic used as the basis for relocating each of the plurality of microservices can be enhanced.
[0034] In some embodiments, at least one of the source resource and the shared resource may include a virtual resource. In this way, the microservice can be located in a cloud environment, which can improve the availability and ease of recovery in the event of a software failure. This can further enable improved centralization of microservice management and improved compatibility between applications. In addition, this can reduce personnel costs, power and cooling by using less physical equipment, and improve hardware utilization by reducing hardware sharing of idle equipment by virtual machines.
[0035] In some embodiments, the virtual resource may include one of the following: a node, a Pod of a node, a container, a container of a Pod, a process, and a process of a container. In this way, the communication between multiple microservices can be reconfigured by relocating multiple microservices closer together. The diversity of virtual resources used by each of the multiple microservices can represent a series of abstractions with reduced latency as the multiple microservices move closer together. By relocating multiple microservices from separate source resources to shared virtual resources, the amount of processing overhead required for communication between microservices can be reduced.
[0036] In some embodiments, relocating each of the plurality of microservices may include determining whether the attributes of the monitored traffic meet predetermined requirements. The steps may also include: in response to the attributes of the monitored traffic meeting the predetermined requirements, relocating each of the plurality of microservices from its corresponding source resource to a shared resource. In this way, the ease of control over relocating each of the plurality of microservices may be improved. As a result, the efficiency and reliability of relocating each of the plurality of microservices from its corresponding source resource to a shared resource may be improved.
[0037] In some embodiments, the predetermined requirement may include at least one of the following: the amount of data is greater than or equal to a predetermined threshold, the data type is a predetermined type, and the data flow rate is greater than or equal to a predetermined threshold. In this way, the range of various predetermined requirements for determining whether to relocate each of the plurality of microservices can be increased. Therefore, the effectiveness and reliability of relocating each of the plurality of microservices based on the determined attributes of the monitored traffic can be improved.
[0038] In the proposed embodiment, monitoring the traffic between the multiple microservices may include receiving a request for communication between the multiple microservices, and then monitoring the traffic associated with the received request. In this way, the traffic between the multiple microservices can be monitored based on the received request for communication between the multiple microservices. This enables the information required to monitor the traffic to be collected directly from the source of the traffic (i.e., the request for communication between the multiple microservices). Thereby improving the reliability and efficiency of monitoring the traffic.
[0039] In some embodiments, relocating each of the plurality of microservices may include: for each of the plurality of microservices, maintaining a first instance of the microservice at its source resource, restarting a second instance of the microservice at the shared resource, and shutting down the second instance of the microservice at its source resource. In this way, each of the plurality of microservices may be temporarily relocated, rather than being permanently relocated or requiring further relocation to return the microservice to its source resource. In addition, each of the plurality of microservices may be relocated relative to interaction (i.e., communication) with the first microservice without affecting interaction with the second microservice. Therefore, this may reduce the time and processing required to relocate each of the plurality of microservices, thereby improving the efficiency of relocating each of the plurality of microservices.
[0040] Figure 1A graphical representation of an exemplary distributed system in which aspects of the illustrative embodiments may be implemented is depicted. Distributed system 100 may include a network of computers in which aspects of the illustrative embodiments may be implemented. Distributed system 100 contains at least one network 102, which is a medium for providing communication links between different devices and computers connected together within distributed data processing system 100. Network 102 may include connections such as wired, wireless communication links, or fiber optic cables.
[0041] In the depicted example, first server 104 and second server 106 are connected to network 102 along with storage unit 108. In addition, clients 110, 112, and 114 are also connected to network 102. Clients 110, 112, and 114 may be, for example, personal computers, network computers, etc. In the depicted example, first server 104 provides data such as boot files, operating system images, and applications to clients 110, 112, and 114. In the depicted example, clients 110, 112, and 114 are clients to first server 104. Distributed processing system 100 may include additional servers, clients, and other devices not shown.
[0042] In the depicted example, distributed system 100 is the Internet, where network 102 represents a global collection of networks and gateways that use the Transmission Control Protocol / Internet Protocol (TCP / IP) suite of protocols to communicate with each other. At its core, the Internet is a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational, and other computer systems that route data and messages. Of course, distributed system 100 may also be implemented to include multiple different types of networks, such as, for example, an intranet, a local area network (LAN), a wide area network (WAN), etc. As described above, Figure 1 are intended as examples, not as architectural limitations to various embodiments of the present invention, and therefore, Figure 1 The specific components shown in the drawings should not be construed as limiting the environments in which illustrative embodiments of the invention may be implemented.
[0043] Figure 2 2 is a block diagram of an example system 200 in which aspects of the illustrative embodiments may be implemented. System 200 is a computer (such as Figure 1 100) in which the computer usable code or instructions implementing the processing of the illustrative embodiments of the present invention can be located. For example, the system 200 can be configured to implement the monitoring unit and the relocation unit according to the embodiment.
[0044] In the depicted example, system 200 employs a hub architecture that includes a north bridge and memory controller hub (NB / MCH) 202 and a south bridge and input / output (I / O) controller hub (SB / ICH) 204. Processing unit 206, main memory 208, and graphics processor 210 are connected to NB / MCH 202. Graphics processor 210 may be connected to NB / MCH 202 via an accelerated graphics port (AGP).
[0045] In the depicted example, a local area network (LAN) adapter 212 is connected to the SB / ICH 204. An audio adapter 216, a keyboard and mouse adapter 220, a modem 222, a read-only memory (ROM) 224, a hard disk drive (HDD) 226, a CD-ROM drive 230, a universal serial bus (USB) port and other communication ports 232, and a PCI / PCIe device 234 are connected to the SB / ICH 204 via a first bus 238 and a second bus 240. PCI / PCIe devices may include, for example, Ethernet adapters, plug-in cards, and PC cards for notebook computers. PCI uses a card bus controller, while PCIe does not. ROM 224 may be, for example, a flash basic input / output system (BIOS).
[0046] HDD 226 and CD-ROM drive 230 are connected to SB / ICH 204 via second bus 240. HDD 226 and CD-ROM drive 230 may use, for example, an integrated drive electronics (IDE) or serial advanced technology attachment (SATA) interface. Super I / O (SIO) device 236 may be connected to SB / ICH 204.
[0047] An operating system runs on processing unit 206. The operating system coordinates and provides Figure 2 The control of each component in the system 200 in the client can be a commercially available operating system. Object-oriented programming system (such as Java TM programming system) can run in conjunction with the operating system and provide Java programs executed on the system 200 TM A call made by a program or application to the operating system.
[0048] As a server, system 200 may be, for example, a server running an advanced interactive execution Operating system or Operating System eServer TM Computer System. System 200 may be a symmetric multiprocessor (SMP) system including multiple processors in processing unit 206. Alternatively, a single processor system may be employed.
[0049] Instructions for the operating system, programming system, and application programs or programs are located on storage devices such as HDD 226 and may be loaded into main memory 208 for execution by processing unit 206. Similarly, one or more message handling programs according to embodiments may be suitable for storage by storage devices and / or main memory 208.
[0050] The processes for the illustrative embodiments of the present invention may be performed by processing unit 206 using computer usable program code, which may be located in a memory, such as, for example, main memory 208 , ROM 224 , or one or more peripheral devices 226 and 230 .
[0051] Bus systems (such as Figure 2 The first bus 238 or the second bus 240 shown in FIG. 1 may include one or more buses. Of course, the bus system may be implemented using any type of communication structure or architecture that provides data transfer between different components or devices attached to the structure or architecture. Communication units (such as Figure 2 The modem 222 or network adapter 212 may include one or more devices for sending and receiving data. The memory may be, for example, the main memory 208, ROM 224 or a memory such as a memory card. Figure 2 The cache found in NB / MCH202.
[0052] Those of ordinary skill in the art will recognize that Figure 1 and Figure 2 The hardware in may vary depending on the implementation. In addition to or instead of Figure 1 and 2 In addition to the hardware depicted in the drawings, other internal hardware or peripheral devices may be used, such as flash memory, equivalent non-volatile memory, or optical disk drives, etc. In addition, the processes of the exemplary embodiments may be applied to multi-processor data processing systems other than the aforementioned systems without departing from the spirit and scope of the invention.
[0053] Furthermore, system 200 may take the form of any of a number of different data processing systems, including a client computing device, a server computing device, a tablet computer, a laptop computer, a phone or other communication device, a personal digital assistant (PDA), etc. In some illustrative examples, system 200 may be a portable computing device configured with flash memory to provide non-volatile memory for storing operating system files and / or user-generated data. Thus, system 200 may be essentially any known or later developed data processing system, without architectural limitation.
[0054] See now Figure 3, depicts a flow diagram of a computer-implemented method for managing communications between multiple microservices.
[0055] Step 310 includes monitoring traffic between the plurality of microservices to determine properties of the traffic.
[0056] Here, step 310 includes steps 312 and 314. Step 312 includes receiving a request for communication between multiple microservices. Step 314 includes monitoring traffic associated with the received request.
[0057] Specifically, the attributes of the monitored traffic include at least one of the following: the amount of data moved between the multiple microservices, the type of data moved between the multiple microservices, and the flow rate of data moved between the multiple microservices.
[0058] Step 320 includes relocating each of the plurality of microservices from its respective source resource to a shared resource based on the determined attributes of the monitored traffic.
[0059] In this embodiment, step 320 includes steps 322 and 324. Step 322 includes determining whether the attributes of the monitored traffic meet the predetermined requirements. Step 324 includes relocating each of the plurality of microservices from their respective source resources to the shared resources in response to the attributes of the monitored services meeting the predetermined requirements.
[0060] For example, the predetermined requirement includes at least one of the following items: the data volume is greater than or equal to a predetermined threshold, the data type is a predetermined type, and the data flow rate is greater than or equal to a predetermined threshold.
[0061] Step 320 includes: for each of the plurality of microservices, restarting the microservice at the shared resource and shutting down the microservice at its source resource.
[0062] In this embodiment, step 320 further includes reconfiguring communication between the plurality of microservices by collecting the plurality of microservices from each of their corresponding source resources to a shared resource.
[0063] In this embodiment, step 320 includes: for each of the multiple microservices, maintaining the first instance of the microservice at its source resource, restarting the second instance of the microservice at the shared resource, and shutting down the second instance of the microservice at its source resource. For example, multiple instances of multiple microservices run in different modes. Relocate the instance of each of the multiple microservices from its corresponding source resource to the shared resource. In the example, the first instance of the first microservice and the instance of the second microservice are in the same process, however, the second instance of the first microservice remains independent in a separate node to share the load of service requests from the third microservice. In another example, the interaction between services is represented by routing. Route AB includes a route from microservice A to microservice B, and route CB includes a route from microservice C to microservice B. In this example, route AB is used extensively (i.e., contains a high level of traffic), and route CB is not used extensively (i.e., contains a low level of service). In this scenario, the second instance of microservice B is restarted at a resource shared with microservice A and shut down at its source resource. The first instance of microservice B (ie, source instance) is left (ie, maintained) at its source resource so that routing CB is not affected.
[0064] Here, at least one of the source resource and the shared resource includes a virtual resource.
[0065] As an example, the virtual resource includes one of a node, a Pod of a node, a container, a container of a Pod, a process, and a process of a container. For example, two microservices on two independent nodes are shut down and restarted on a shared node. In another example, two microservices on the same node can be shut down and pulled up in a shared Pod. In another example, two microservices in the same Pod can be shut down and put into a shared container as two processes. In another example, two microservices in two separate processes can be shut down and brought inside a shared process.
[0066] For example, the virtual resource list disclosed above represents a series of abstractions that have reduced latency as resources are located closer to each other. In an example, communication between two microservices located on two separate nodes includes network services between separate servers. In an example, communication between two microservices located on two independent containers includes network traffic on a shared server. In an example, communication between two microservices located in two independent processes includes inter-process calls. In an example, communication between two microservices located in a shared process includes direct calls. The extent to which a microservice can be relocated depends on the infrastructure of the cloud environment and the microservice runtime (i.e., whether the microservice includes a managed, dynamic, or compiled runtime).
[0067] In another embodiment, the corresponding source resource of each of the plurality of microservices includes a shared source resource of the plurality of microservices. In this example, the plurality of microservices were previously crashed and have now been deployed by relocating each of the plurality of microservices from its corresponding source resource (i.e., the shared source resource of the plurality of microservices that previously crashed). The shared source resource of the plurality of microservices that previously crashed) to a shared resource (i.e., a shared destination resource). For example, the shared resource includes the source resource of the plurality of microservices. As such, the plurality of microservices are distributed from the source resource shared by the plurality of microservices to the shared resource on which at least one of the plurality of microservices was previously located.
[0068] See now Figure 4 , depicts a simplified block diagram of an exemplary embodiment of a system for managing communications between multiple microservices.
[0069] The system includes a monitoring unit 410 configured to monitor traffic between multiple microservices to determine properties of the traffic. The system also includes a relocation unit 420 configured to relocate each of the multiple microservices from its corresponding source resource to a shared resource based on the determined properties of the monitored services.
[0070] Here, the monitoring unit 410 includes a receiving unit 412 configured to receive a request for communication between microservices. The monitoring unit 410 is also configured to monitor the communication volume associated with the received request.
[0071] As an example, the characteristic of the monitored traffic includes at least one of the following: an amount of data moved between the plurality of microservices, a type of the data moved between the plurality of microservices, and a flow rate of the data moved between the plurality of microservices.
[0072] Here, the relocation unit 420 includes a restart unit 422, and the restart unit 422 is configured to restart each microservice in the plurality of microservices on the shared resource and shut down the microservice on the source resource.
[0073] The relocation unit 420 includes a reconfiguration unit 424 configured to reconfigure communication between the plurality of microservices by collecting the plurality of microservices from each of their respective source resources to a shared resource.
[0074] In this embodiment, the relocation unit 420 is further configured to determine whether the attributes of the monitored traffic meet predetermined requirements, and in response to the attributes of the monitored traffic meeting the predetermined requirements, relocate each of the multiple microservices from its corresponding source resource to the shared resource.
[0075] For example, the predetermined requirement includes at least one of the following items: the data volume is greater than or equal to a predetermined threshold, the data type is a predetermined type, and the data flow rate is greater than or equal to a predetermined threshold.
[0076] In this embodiment, the restart unit 422 is further configured to maintain a first instance of the microservice at the source resource for each of the plurality of microservices, restart a second instance of the microservice at the shared resource, and shut down the second instance of the microservice at its source resource.
[0077] Specifically, at least one of the source resource and the shared resource includes a virtual resource.
[0078] As an example, the virtual resource includes one of a node, a Pod of a node, a container, a container of a Pod, a process, and a process of a container.
[0079] See now Figures 5A-5E , a simplified block diagram depicting an example of communication between multiple microservices.
[0080] In the example, service A 520 and service B 522 provide two different microservices in a distributed application in a container orchestration system. Service A 520 frequently calls service B 522 through a published application programming interface (API) (e.g., OpenAPI). Both service A 520 and service B 522 are implemented as applications in an open source, cross-platform runtime environment. On a standard-based operating system (OS) image (i.e., OS image), the application is built into a file including multiple layers for executing code in a container, i.e., a file containing an operating system, an executable file, and any data files that may be related to a program on the operating system (e.g., a system image, a disk image, or a process image). Once built, the application is then deployed as a container in a Pod in a container orchestration system.
[0081] During development, service A 520 is developed (i.e., generated) using an application programming interface generated from an application programming interface definition (OpenAPI definition) published by service B 522. In an embodiment, this is generated by a client-side scaffolding tool for web applications to create a package manager that can then be included in service A 520 as a normal dependency. The code of the generated service A 520 handles calls from service A 520 to service B 522. The generated code determines the appropriate transmission based on at least one of a build time configuration parameter, a deployment time configuration parameter, and a runtime configuration parameter. For example, at build time, both service A 520 and service B 522 are packaged into the same container. For example, at deployment time, an instance of a container is started with a configuration parameter (e.g., an environment variable) that identifies which services in service A 520 and service B 522 will be started by the instance. For example, at runtime, instances of both service A 520 and service B 522 report their loads to the monitoring unit 410.
[0082] Figure 5A Depicted is an inter-node communication between service A 520 and service B 522. Service A 520 is in a first node 510 and service B 522 is in a second node 510, such that the services communicate between the nodes 510. The Hypertext Transfer Protocol (HTTP) includes marshaling, encrypting, networking, decrypting, and then unmarshaling messages between service A 520 and service B 522. Figure 5B Depicted is inter-Pod communication (i.e., intra-node communication) between service A 520 and service B 522. Service A 520 is in a first Pod 512 and service B 522 is in a second Pod 512, such that the services communicate between the Pods 512. Both Pods are within the same node 510. The Hypertext Transfer Protocol (HTTP) includes marshaling, encrypting, decrypting, and then unmarshaling messages between service A 520 and service B 522. Figure 5C Depicted is inter-container communication (i.e., intra-Pod communication) between service A 520 and service B 522. Service A 520 is in a first container 514 and service B 522 is in a second container 514, such that the services communicate between the containers 514. Both containers 514 are within the same Pod 512. The Hypertext Transfer Protocol (HTTP) includes marshaling and then unmarshaling messages between service A 520 and service B 522. Figure 5D Depicted is inter-process communication (i.e., intra-container communication) between service A 520 and service B 522. Service A 520 is in a first process and service B 522 is in a second process, such that the services communicate between processes. Both processes are within the same container 514. Inter-process communication does not involve the Hypertext Transfer Protocol. Figure 5EAn intra-process function call is depicted between service A 520 and service B 522. Service A 520 and service B 522 are in a shared process, allowing the services to communicate within the shared process. Inter-process communication does not involve the Hypertext Transfer Protocol.
[0083] As the load on the entire container orchestration system changes, the way Service A 520 and Service B communicate changes (i.e., by relocating Unit 420). For example, the communication changes from inter-Pod communication using Transport Layer Security (TLS) to Figure 5B ) to intra-Pod communication between containers without TLS ( Figure 5C ). As a result, the overhead required to encrypt and decrypt messages is no longer required and is therefore saved.
[0084] In another example, a separate container is booted to start and stop instances of service A 520 and service B 522 within its process. Service A 520 and service B 522 are packaged together within a shared container, so a running instance of service A 520 can start its own instance of service B 522, causing the API layer to change from making HTTP REST calls to real function calls ( Figure 5E ).
[0085] In an example, the monitoring unit counts API calls and / or uses high-level known metrics such as profiling or other measurements to report the processing overhead associated with the communication (i.e., monitoring traffic between multiple microservices to determine the properties of the traffic). The relocation unit decides how to organize services using heuristic techniques. For example, the relocation unit has rules about how many independent instances must be maintained for redundancy, whether to prioritize total response time or to minimize the number of containers in use in order to reduce billable storage costs. These techniques can be defined as different profiles, such as defining a development profile that scales the number of containers in use to a minimum to run on a software developer's local system.
[0086] As a further example, Figure 6 As shown in , embodiments may include a computer system 70, which may form part of a networked system 7. For example, a relocation unit may be implemented by the computer system 70. Components of the computer system / server 70 may include, but are not limited to, one or more processing arrangements, such as a processor or processing unit 71, a system memory 74, and a bus 90 coupling various system components (including the system memory 74) to the processing unit 71.
[0087] The system memory 74 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 75 and / or cache memory 76. The computer system / server 70 may also include other removable / non-removable, volatile / non-volatile computer system storage media. In such a case, each may be connected to the bus 90 via one or more data medium interfaces. The memory 74 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the proposed embodiment. For example, the memory 74 may include a computer program product having a program executable by the processing unit 71 to cause the system to perform a method for managing communications between multiple microservices.
[0088] A program / utility 78 having a set of (at least) program modules 79 may be stored in the memory 74. The program modules 79 generally perform the functions and / or methods of the proposed embodiments for managing communications between multiple microservices.
[0089] The computer system / server 70 may also communicate with one or more external devices 80 (e.g., keyboards, pointing devices, displays 85, etc.), and / or any device that enables the computer system / server 70 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may occur via input / output (I / O) interface 72. In addition, the computer system / server 70 may communicate with one or more networks such as a local area network (LAN), a general wide area network (WAN), and / or a public network (e.g., the Internet) via a network adapter 73 (e.g., to transmit reconstructed content to the system or user).
[0090] In the context of this application, when an embodiment of the present invention constitutes a method, it should be understood that such a method is a process for being executed by a computer, that is, a computer-implemented method. Therefore, the various steps of the method reflect various parts of a computer program, for example. Various parts of one or more algorithms.
[0091] The present invention may be a system, method, and / or computer program product. The computer program product may include a computer-readable storage medium (or multiple media) having computer-readable program instructions thereon for causing a processor to perform various aspects of the present invention.
[0092] A computer-readable storage medium may be a tangible device capable of retaining and storing instructions used by an instruction execution device. A computer-readable storage medium may be, for example but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. A non-exhaustive list of more specific examples of computer-readable storage media includes the following: 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), a storage class memory (SCM), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device with a protruding structure such as a punch card or a groove having instructions recorded thereon, and any suitable combination thereof. As used herein, a computer-readable storage medium should not be interpreted as a temporary signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (e.g., a light pulse passing through a fiber optic cable), or an electrical signal emitted by a wire.
[0093] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to a corresponding computing / processing device or to an external computer or external storage device via a network (e.g., the Internet, a local area network, a wide area network, and / or a wireless network). The network can include copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in a computer-readable storage medium in the corresponding computing / processing device.
[0094] The computer-readable program instructions for performing the operation of the present invention can be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages (such as Smalltalk, C++, etc.) and conventional procedural programming languages (such as "C" programming languages or similar programming languages). The computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the latter case, the remote computer can be connected to the user's computer through any type of network (including local area network (LAN) or wide area network (WAN)), or can be connected to an external computer (for example, using an Internet service provider through the Internet). In certain embodiments, the electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) can be personalized to perform computer-readable program instructions by utilizing the state information of the computer-readable program instructions to perform the electronic circuit so as to perform various aspects of the present invention.
[0095] This article describes various aspects of the present invention with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each box of the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0096] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device create a device for implementing the functions / actions specified in one or more boxes of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, which causes the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable storage medium in which the instructions are stored includes a manufactured product containing instructions for implementing aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0097] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so as to cause a series of operating steps to be performed on the computer, other programmable apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable apparatus, or other device to implement the functions / actions specified in the flowchart and / or block diagram or multiple boxes.
[0098] The flow charts and block diagrams in the accompanying drawings show the architecture, functions and operations of the possible implementations of the systems, methods and computer program products according to different embodiments of the present invention. To this end, each box in the flow chart or block diagram may represent a module, segment or part of an instruction, which includes one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the box may not occur in the order marked in the figure. For example, depending on the functions involved, the two blocks shown in succession can actually be executed substantially simultaneously, or these blocks can sometimes be executed in reverse order. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action or performs a combination of dedicated hardware and computer instructions.
[0099] The description of various embodiments of the present invention has been presented for the purpose of illustration, but is not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications or technical improvements over technologies found in the marketplace, or to enable those of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A computer-implemented method comprising: In response to receiving a request to communicate between a plurality of microservices, determining a property of the traffic by monitoring the traffic between the plurality of microservices; as well as temporarily relocating each of the plurality of microservices from its corresponding source resource to a shared resource based on the determined attribute of the monitored traffic, Wherein, relocating each of the plurality of microservices comprises: for each of the plurality of microservices: Maintaining a first instance of the microservice at its source resource; Restarting a second instance of the microservice at the shared resource; and shutting down the second instance of the microservice at its corresponding source resource, The multiple instances of the multiple microservices run in different modes, a first instance of a first microservice among the multiple microservices and an instance of a second microservice among the multiple microservices are in the same process, and the second instance of the first microservice remains independent in a separate node to share the load of a service request from a third microservice among the multiple microservices.
2. The computer-implemented method of claim 1 , wherein: Relocating each of the plurality of microservices includes: For each of the plurality of microservices, the microservice is restarted at the shared resource and shut down at its source resource.
3. The computer-implemented method of claim 1 , wherein: Relocating each of the plurality of microservices includes: Communications between the plurality of microservices are reconfigured by collecting the plurality of microservices from each of their respective source resources to the shared resource.
4. The computer-implemented method of claim 1 , wherein: The attributes of the monitored traffic include at least one of the following: The amount of data moved between the plurality of microservices; The type of data moved between the plurality of microservices; and The flow rate of data moving between the multiple microservices.
5. The computer-implemented method of claim 1 , wherein: At least one of the source resource and the shared resource comprises a virtual resource.
6. The computer-implemented method of claim 5, wherein: The virtual resource includes one of the following: node; Pods of nodes; container; The container of the Pod; Process; and The container's process.
7. The computer-implemented method of claim 1 , wherein: Relocating each of the plurality of microservices includes: determining whether the attribute of the monitored traffic meets predetermined requirements; and In response to the property of the monitored traffic satisfying the predetermined requirement, each of the plurality of microservices is relocated from its corresponding source resource to the shared resource.
8. The computer-implemented method of claim 7, wherein: The predetermined requirement includes at least one of the following: The amount of data is greater than or equal to a predetermined threshold; The type of the data is a predetermined type; and The flow rate of the data is greater than or equal to a predetermined threshold.
9. The computer-implemented method of claim 1 , wherein: Monitoring the traffic between the multiple microservices includes: receiving a request for communication between the plurality of microservices; and Traffic associated with the received request is monitored.
10. A computer program product comprising: One or more computer-readable storage media and program instructions stored on the one or more computer-readable storage media, the program instructions comprising: program instructions for determining properties of traffic by monitoring traffic between the plurality of microservices in response to receiving a request to communicate between the plurality of microservices; and program instructions for temporarily relocating each of the plurality of microservices from its respective source resource to a shared resource based on the determined attributes of the monitored traffic, Wherein, relocating each of the plurality of microservices comprises: for each of the plurality of microservices: Maintaining a first instance of the microservice at its source resource; Restarting a second instance of the microservice at the shared resource; and shutting down the second instance of the microservice at its corresponding source resource, The multiple instances of the multiple microservices run in different modes, a first instance of a first microservice among the multiple microservices and an instance of a second microservice among the multiple microservices are in the same process, and the second instance of the first microservice remains independent in a separate node to share the load of a service request from a third microservice among the multiple microservices.
11. The computer program product according to claim 10, wherein: The program instructions for relocating each of the plurality of microservices include: For each of the plurality of microservices, program instructions are provided for restarting the microservice at the shared resource and shutting down the microservice at its source resource.
12. The computer program product of claim 10, wherein: The program instructions for relocating each of the plurality of microservices include: Program instructions for reconfiguring communications between the plurality of microservices by collecting the plurality of microservices from each of their respective source resources to the shared resource.
13. The computer program product of claim 10, wherein: The program instructions for relocating each of the plurality of microservices include: program instructions for determining whether said attributes of said monitored traffic meet predetermined requirements; and Program instructions for relocating each of the plurality of microservices from its respective source resource to the shared resource in response to a property of the monitored traffic satisfying the predetermined requirement.
14. The computer program product of claim 10, wherein: The program instructions for monitoring traffic between the plurality of microservices include: program instructions for receiving a request to communicate between the plurality of microservices; and Program instructions for monitoring traffic associated with the received request.
15. A computer system comprising: one or more computer processors; one or more computer-readable storage media; as well as program instructions stored on the one or more computer-readable storage media for execution by at least one of the one or more computer processors, the program instructions comprising: program instructions for determining properties of traffic by monitoring traffic between the plurality of microservices in response to receiving a request to communicate between the plurality of microservices; and program instructions for temporarily relocating each of the plurality of microservices from its respective source resource to a shared resource based on the determined attributes of the monitored traffic, Wherein, relocating each of the plurality of microservices comprises: for each of the plurality of microservices: Maintaining a first instance of the microservice at its source resource; Restarting a second instance of the microservice at the shared resource; and shutting down the second instance of the microservice at its corresponding source resource, The multiple instances of the multiple microservices run in different modes, a first instance of a first microservice among the multiple microservices and an instance of a second microservice among the multiple microservices are in the same process, and the second instance of the first microservice remains independent in a separate node to share the load of a service request from a third microservice among the multiple microservices.
16. The computer system of claim 15, wherein: The program instructions for relocating each of the plurality of microservices include: For each of the plurality of microservices, program instructions are provided for restarting the microservice at the shared resource and shutting down the microservice at its source resource.
17. The computer system according to claim 15, wherein: The program instructions for relocating each of the plurality of microservices include: Program instructions for reconfiguring communications between the plurality of microservices by collecting the plurality of microservices from each of their respective source resources to the shared resource.
18. The computer system according to claim 15, wherein: The program instructions for relocating each of the plurality of microservices include: program instructions for determining whether said attributes of said monitored traffic meet predetermined requirements; and Program instructions for relocating each of the plurality of microservices from its respective source resource to the shared resource in response to a property of the monitored traffic satisfying the predetermined requirement.
