# US 11,119,826 B2 · Serverless call distribution to implement spillover while avoiding cold starts

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

- Number: US 11,119,826 B2
- Document ID: US11119826B2
- Status: Granted
- Kind: B2
- Application number: 16/698,845
- Filed: 2019-11-27
- Published: 2021-05-27
- Granted: 2021-09-14
- Earliest claimed: 2019-11-27
- Assignees: Amazon Technologies, Inc.
- Applicants: Amazon Technologies, Inc.
- Inventors: David Yanacek; Sean Tyler Myers; Yogesh Aggarwal; Naveen Dasa Subramanyam; Amit Raghunath Kulkarni; Aritra Bandyopadhyay; Jianwei Cui
- Web page: https://patentgrep.com/patent/US11119826B2

## CPC

- G06F 9/505: {considering the load}
- G06F 9/5077: {Logical partitioning of resources; Management or configuration of virtualized resources (specific details on emulation or internal functioning of virtual machines G06F9/455)}
- G06F 2209/5011: Pool
- G06F 2209/5014: Reservation
- G06F 2209/5022: Workload threshold
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems and methods are described for reducing cold starts code within a serverless code execution system by providing a set of environments reserved for the code. A frontend distribute calls for execution among a set of manager devices that manage environments in the system, distributed in a manner that groups calls together and attempts to distribute calls of the same group to a stable subset of the manager devices. In the case that a user reduces or eliminates the number of environments reserved for the code, a frontend continues to distribute calls for execution of the code to those environments while they continue to be used. This reduces cold starts that might otherwise occur during reduction or elimination of reserved environments.

## Claims

### Claim 1

An on-demand code execution system comprising:
one or more computing devices implementing a pool of execution environments for the on-demand code execution system, the pool comprising a set of execution environments reserved for execution of a task on the on-demand code execution system, the task corresponding to code executable to implement desired functionality on the on-demand code execution system, wherein each environment within the set is provisioned with software required to execute the code of the task, and wherein a number of environments within the set is maintained in accordance with a reservation limit of the task;
a frontend computing device configured to:
obtain a call to execute the task;
detect that a number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task;
detect that a proportion of the set of execution environments that are currently executing the task relative to the number of environments within the set falls below a threshold proportion; and
in response to detecting both that the number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task and that the proportion falls below the threshold proportion:
transmit a request to the one or more computing devices to identify an execution environment from the set in which to initiate an additional execution of the task;
obtain information identifying the execution environment; and
initiate the additional execution in the identified execution environment, wherein the additional execution executes on the on-demand code execution system in addition to the concurrent executions of the task on the on-demand code execution system.

### Claim 2 (depends on 1)

The system of claim 1, wherein the frontend computing device is a first frontend computing device, and wherein the system further comprises a plurality of additional frontend computing devices matching a configuration of the first frontend computing device.

### Claim 3 (depends on 1)

The system of claim 1, wherein the one or more computing devices comprises a first subset of computing devices configured to manage a first subset of environments within the set of execution environments that have been recently used to support execution of the task, and a second subset of computing devices configured to manage a second subset of environments within the set of execution environments that have not been recently used to support execution of the task.

### Claim 4 (depends on 3)

The system of claim 3, wherein the request is transmitted to a computing device within the first subset of computing devices and indicates that the computing devices should identify the execution environment without moving an environment from the first subset of environments to the second subset.

### Claim 5 (depends on 1)

The system of claim 1, wherein the frontend computing device is further configured to:
implement a consistent hash ring facilitating distribution of calls among the one or more computing devices; and
identify a first arc of the consistent hash ring comprising a first subset of computing devices from the one or more computing devices identified according to a hash value corresponding to the task and the reservation limit of the task; and
wherein the request is transmitted to a computing device selected from the first subset.

### Claim 6

A method implementing by a frontend computing device of an on-demand code execution system, the method comprising:
obtaining a call to execute a task associated with reserved capacity on the on-demand code execution system, the reserved capacity representing a set of execution environments reserved for execution of the task and provisioned with software required to execute code of the task, wherein a number of environments within the set is maintained in accordance with a reservation limit of the task;
detecting that a number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task;
detecting that a proportion of the set of execution environments that are currently executing the task relative to the number of environments within the set falls below a threshold proportion; and
in response to detecting both that the number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task and that the proportion falls below the threshold proportion:
transmitting a request to one or more computing devices managing the set of execution environments to identify an execution environment from the set in which to initiate an additional execution of the task;
obtaining information identifying the execution environment; and
initiating the additional execution in the identified execution environment, wherein the additional execution executes on the on-demand code execution system in addition to the concurrent executions of the task on the on-demand code execution system.

### Claim 7 (depends on 6)

The method of claim 6 further comprising:
obtaining a request to reduce the reservation limit of the task; and
for each period of a set of periods, removing from the set of execution environments any environments that have not been utilized to support execution of the task during a past period.

### Claim 8 (depends on 6)

The method of claim 6, wherein the request to reduce the reservation limit of the task reduces the reservation limit to zero.

### Claim 9 (depends on 6)

The method of claim 6, wherein transmitting the request to the set of computing devices to identify an execution environment comprises:
selecting an individual computing device from the set of computing devices; and
transmitting the request to the individual computing device.

### Claim 10 (depends on 9)

The method of claim 9, wherein selecting the individual computing device from the set of computing devices comprises selecting the individual computing device based at least partly on a hash value associated with the task and organization of the set of computing devices into a consistent hash ring.

### Claim 11 (depends on 10)

The method of claim 10, wherein selecting the individual computing device based at least partly on the hash value associated with the task and organization of the set of computing devices into a consistent hash ring comprises:
identifying an arc of the consistent hash ring associated with the task, the arc comprising an initial computing device of the consistent hash ring selected based at least partly on the hash value and one or more additional computing devices subsequent to the initial computing device on the consistent hash ring, wherein a number of computing devices within the arc is set in accordance with the reservation limit of the task; and
selecting the individual computing device from the computing devices of the arc.

### Claim 12 (depends on 10)

The method of claim 10, wherein the method is implemented by a first frontend computing device of a plurality of frontend computing devices on the on-demand code execution system, and wherein detecting that the number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task comprises:
subsequent to obtaining the call, transmitting an instruction to a counting service of the on-demand code execution system to increment the number of concurrent executions of the task on the on-demand code execution system; and
obtaining, from the counting service, the number of concurrent executions of the task on the on-demand code execution system, wherein the number of concurrent executions is determined by the counting service based on instructions from the plurality of frontend computing devices.

### Claim 13 (depends on 6)

The method of claim 6, wherein transmitting the request to the set of computing devices to identify an execution environment from the set in which to initiate an additional execution of the task comprises:
transmitting the request to a first computing device selected from the one or more computing devices;
obtaining a response from the computing device indicating that the computing device cannot provide the execution environment; and
transmitting the request to a second computing device selected from the one or more computing devices.

### Claim 14

Non-transitory computer-readable media comprising computer executable instructions that, when executed by a frontend device of an on-demand code execution system, cause the frontend device to:
obtain a call to execute a task associated with reserved capacity on the on-demand code execution system, the reserved capacity representing a set of execution environments reserved for execution of the task and provisioned with software required to execute code of the task, wherein a number of environments within the set is maintained in accordance with a reservation limit of the task;
detect that a number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task;
detect that a proportion of the set of execution environments that are currently executing the task relative to the number of environments within the set falls below a threshold proportion; and
in response to detecting both that the number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task and that the proportion falls below the threshold proportion, initiate an additional execution in an execution environment identified from the set reserved for execution of the task, wherein the additional execution executes on the on-demand code execution system in addition to the concurrent executions of the task on the on-demand code execution system.

### Claim 15 (depends on 14)

The non-transitory computer-readable media of claim 14, wherein the set of execution environments is managed by one or more worker manager devices, and wherein the instructions further cause the frontend device to transmit a request for the execution environment to a worker manager device selected from the one or more worker manager devices.

### Claim 16 (depends on 15)

The non-transitory computer-readable media of claim 15, wherein the request transmitted to the worker manager device indicates that the worker manager device should identify the execution environment without expanding the set of execution environments.

### Claim 17 (depends on 15)

The non-transitory computer-readable media of claim 15, wherein the instructions further cause the frontend device to:
implement a consistent hash ring facilitating distribution of calls among the one or more working manager devices;
identify a first arc of the consistent hash ring comprising a first subset of working manager devices, from the one or more working manager devices, identified according to a hash value of the task and the reservation limit of the task; and
select the working manager device from the first subset.

### Claim 18 (depends on 17)

The non-transitory computer-readable media of claim 17, wherein the instructions further cause the frontend device to select the working manager device from the first subset using round robin selection.

### Claim 19 (depends on 17)

The non-transitory computer-readable media of claim 17, wherein the instructions further cause the frontend device to:
obtaining an indication that the reservation limit of the task has been reduced;
for each period of a set of periods:
determine whether the proportion of the set of execution environments that are currently executing the task relative to the number of environments within the set falls below a second threshold proportion; and
if the proportion falls below the second threshold proportion, reduce a number of working manager devices within the first subset.

### Claim 20 (depends on 14)

The non-transitory computer-readable media of claim 14, wherein the frontend device is included in a plurality of frontend devices on the on-demand code execution system, and wherein the instructions cause the frontend device to detect that the number of concurrent executions of the task on the on-demand code execution system exceeds the reservation limit of the task at least partly by:
subsequent to obtaining the call, transmitting an instruction to a counting service of the on-demand code execution system to increment the number of concurrent executions of the task on the on-demand code execution system; and
obtaining, from the counting service, the number of concurrent executions of the task on the on-demand code execution system, wherein the number of concurrent executions is determined by the counting service based on instructions from the plurality of frontend computing devices.
