# US 12,217,035 B2 · Microservice termination while maintaining high availability

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,217,035 B2
- Document ID: US12217035B2
- Status: Granted
- Kind: B2
- Application number: 18/611,041
- Filed: 2024-03-20
- Published: 2024-07-11
- Granted: 2025-02-04
- Earliest claimed: 2022-09-14
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Ali Kanso; Karthik Maharajan Sankara Subramanian
- Web page: https://patentgrep.com/patent/US12217035B2

## CPC

- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 9/5022: {Mechanisms to release resources}
- G06F 8/65: Updates (security arrangements therefor G06F21/57)
- G06F 9/485: {Task life-cycle, e.g. stopping, restarting, resuming execution (G06F9/4881 takes precedence)}
- G06F 9/547: {Remote procedure calls [RPC]; Web services}
- G06F 2209/508: Monitor
- G06F 2209/548: Queue
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The techniques disclosed herein enable systems to reduce the time required to terminate a set of microservices for an application while ensuring high availability and preventing request failures. This is accomplished through a termination manager which retrieves request queues for the microservices to analyze outstanding requests that require processing prior to termination. Based on the outstanding requests, the termination manager constructs call graphs for each request. The call graphs capture the operational flow of the associated request by defining a sequence of microservices whose functionality is invoked by the request. From an initial analysis, the termination manager can determine that some of the microservices do not appear in the call graphs, indicating that the microservices are not needed to process the outstanding requests. Accordingly, the unneeded microservices are terminated. As requests are processed by the remaining microservices, the termination manager gradually terminates the remaining microservices based on the call graphs.

## Claims

### Claim 1

A method for terminating a plurality of microservices to ensure maximal availability comprising:
retrieving a plurality of request queues from the plurality of microservices, wherein a request queue of the plurality request queues contains one or more outstanding requests for one or more microservices;
constructing a plurality of call graphs based on the one or more outstanding requests contained in each request queue of the plurality of request queues;
updating the plurality of call graphs by monitoring the plurality of request queues in response to a completion of an outstanding request, wherein the completion of the outstanding request causes a removal of the outstanding request from a corresponding request queue;
determining that a microservice of the plurality of microservices does not appear in any of the updated plurality of call graphs following the completion of the outstanding request; and
terminating the microservice in response to determining that the microservice of the plurality of microservices does not appear in any of the updated plurality of call graphs.

### Claim 2 (depends on 1)

The method of claim 1, wherein the plurality of call graphs is updated until all microservices of the plurality of microservices are terminated.

### Claim 3 (depends on 1)

The method of claim 1, wherein:
an application comprises the plurality of microservices; and
the plurality of microservices is terminated in response to a deployment of an updated version of the application.

### Claim 4 (depends on 1)

The method of claim 1, wherein the outstanding request comprises a call stack defining a plurality of operations, an individual operation invoking a functionality of a set of microservices from the plurality of microservices.

### Claim 5 (depends on 1)

The method of claim 1, wherein an individual call graph comprises a plurality of nodes, each node representing an associated microservice invoked by an individual outstanding request.

### Claim 6 (depends on 5)

The method of claim 5, wherein a node of the plurality of nodes is removed from the individual call graph in response to the completion of the outstanding request, the removal of the node from all of the plurality of call graphs causing a termination of the associated microservice represented by the node.

### Claim 7 (depends on 6)

The method of claim 6, wherein the plurality of nodes is sequentially removed from each call graph of the plurality of call graphs to terminate the plurality of microservices.

### Claim 8

A system for reducing a time required for terminating a plurality of microservices while preventing request processing failures comprising:
one or more processing units;
a computer readable medium having encoded thereon, computer-readable instructions that when executed by the one or more processing units causes the system to perform operations comprising:
retrieving a plurality of request queues from the plurality of microservices, wherein a request queue of the plurality request queues contains one or more outstanding requests for one or more microservices;
constructing a plurality of call graphs based on the one or more outstanding requests contained in each request queue of the plurality of request queues;
updating the plurality of call graphs by monitoring the plurality of request queues in response to a completion of an outstanding request, wherein the completion of the outstanding request causes a removal of the outstanding request from a corresponding request queue;
determining that a microservice of the plurality of microservices does not appear in any of the updated plurality of call graphs following the completion of the outstanding request; and
terminating the microservice in response to determining that the microservice of the plurality of microservices does not appear in any of the updated plurality of call graphs.

### Claim 9 (depends on 8)

The system of claim 8, wherein the plurality of call graphs is updated until all microservices of the plurality of microservices are terminated.

### Claim 10 (depends on 8)

The system of claim 8, wherein:
an application comprises the plurality of microservices; and
the plurality of microservices is terminated in response to a deployment of an updated version of the application.

### Claim 11 (depends on 8)

The system of claim 8, wherein the outstanding request comprises a call stack defining a plurality of operations, an individual operation invoking a functionality of a set of microservices from the plurality of microservices.

### Claim 12 (depends on 8)

The system of claim 8, wherein an individual call graph comprises a plurality of nodes, each node representing an associated microservice invoked by an individual outstanding request.

### Claim 13 (depends on 12)

The system of claim 12, wherein a node of the plurality of nodes is removed from the individual call graph in response to the completion of the outstanding request, the removal of the node from all of the plurality of call graphs causing a termination of the associated microservice represented by the node.

### Claim 14 (depends on 13)

The system of claim 13, wherein the plurality of nodes is sequentially removed from each call graph of the plurality of call graphs to terminate the plurality of microservices.

### Claim 15

A computer readable storage medium having encoded thereon, computer-readable instructions that when executed by a system causes the system to perform operations comprising:
retrieving a plurality of request queues from a plurality of microservices, wherein a request queue of the plurality request queues contains one or more outstanding requests for one or more microservices;
constructing a plurality of call graphs based on the one or more outstanding requests contained in each request queue of the plurality of request queues;
updating the plurality of call graphs by monitoring the plurality of request queues in response to a completion of an outstanding request, wherein the completion of the outstanding request causes a removal of the outstanding request from a corresponding request queue;
determining that a microservice of the plurality of microservices does not appear in any of the updated plurality of call graphs following the completion of the outstanding request; and
terminating the microservice in response to determining that the microservice of the plurality of microservices does not appear in any of the updated plurality of call graphs.

### Claim 16 (depends on 15)

The computer-readable storage media of claim 15, wherein:
an application comprises the plurality of microservices; and
the plurality of microservices is terminated in response to a deployment of an updated version of the application.

### Claim 17 (depends on 15)

The computer-readable storage media of claim 15, wherein the outstanding request comprises a call stack defining a plurality of operations, an individual operation invoking a functionality of a set of microservices from the plurality of microservices.

### Claim 18 (depends on 15)

The computer-readable storage media of claim 15, wherein an individual call graph comprises a plurality of nodes, each node representing an associated microservice invoked by an individual outstanding request.

### Claim 19 (depends on 18)

The computer-readable storage media of claim 18, wherein a node of the plurality of nodes is removed from the individual call graph in response to the completion of the outstanding request, the removal of the node from all of the plurality of call graphs causing a termination of the associated microservice represented by the node.

### Claim 20 (depends on 19)

The computer-readable storage media of claim 19, wherein the plurality of nodes is sequentially removed from each call graph of the plurality of call graphs to terminate the plurality of microservices.
