# US 10,120,665 B1 · Latency-aware host-agnostic runtime

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

- Number: US 10,120,665 B1
- Document ID: US10120665B1
- Status: Granted
- Kind: B1
- Application number: 15/280,813
- Filed: 2016-09-29
- Granted: 2018-11-06
- Earliest claimed: 2016-09-29
- Assignees: Amazon Technologies, Inc.
- Applicants: Amazon Technologies, Inc.
- Inventors: Ronald Widharta Sunarno
- Web page: https://patentgrep.com/patent/US10120665B1

## CPC

- G06F 8/4441: {Reducing the execution time required by the program code}
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 8/60: Software deployment
- G06F 11/34: Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation {; Recording or statistical evaluation of user activity, e.g. usability assessment}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Application source code that includes notation indicating a latency level between methods is evaluated. Based in part on the latency level, scores for method dependencies are calculated. A set of packages is generated for the methods in accordance with a clustering strategy that is based at least in part on the scores. The set of packages is then deployed to at least one host in accordance with an affinity threshold.

## Claims

### Claim 1

A computer-implemented method, comprising:
under the control of one or more computer systems configured with executable instructions,
obtaining application source code for a software application to be deployed in a computing environment;
identifying a method caller and a called method within the application source code, the method caller being a method from which the called method is called;
determining, from the application source code, that the called method, as a result of a call from the method caller, is to execute in accordance with latency criteria;
determining an affinity value for the called method based at least in part on the latency criteria;
calculating, based at least in part on the affinity value, an affinity score between the method caller and the called method, the affinity score indicating a target proximity between packages deployed in the computing environment;
outputting a first package for the method caller and a second package for the called method, the first package including the affinity score between the method caller and the called method; and
deploying the first package and the second package in accordance with the affinity score.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein deploying the first package and the second package includes:
deploying the first package to a first host;
determining, as a result of the affinity score being at a value relative to an affinity threshold, that the host that meets the latency criteria is a second host different from the first host; and
deploying the second package to the second host.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein deploying the first package and the second package includes:
deploying the first package to a first host;
determining, as a result of the affinity score being at a value relative to an affinity threshold, that the host that meets the latency criteria is the first host with the first package; and
deploying the second package to the first host.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein determination that called method is to execute in accordance with the latency criteria is made based at least in part on identifying a notation, within the application source code, that indicates the latency criteria of the called method.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein:
the latency criteria is first latency criteria;
the computer-implemented method further comprises:
identifying a second instance of the called method within the method caller;
determining, from the application source code, that the second instance of the called method is to execute in accordance with second latency criteria different from the first latency criteria; and
computing a second affinity value for the second instance of the called method based at least in part on the second latency criteria; and
the affinity score is further based at least in part on the second affinity value.

### Claim 6

A system, comprising at least one computing device having one or more processors and memory including instructions that implement one or more services, wherein the one or more services:
obtain, from application source code, a first method and a second method; as a result of a determination that the second method is dependent on the first method,
determine, from latency notation present in the application source code, an affinity level between the first method and the second method;
calculate, based at least in part on the affinity level, an affinity score that indicates a target proximity between the first method and the second method;
output a first package including the first method and a second package including the second method;
record the affinity score between the first method and the second method as a score between the first package and the second package;
allocate one or more hosts to receive the first and second packages; and
deploy the first package and the second package to the one or more hosts, in accordance with an affinity threshold.

### Claim 7 (depends on 6)

The system of claim 6, wherein the one or more services that calculate the affinity score increase, based at least in part on a determination that the second method is called within a loop, the affinity score between the first method and the second method by an additional amount.

### Claim 8 (depends on 6)

The system of claim 6, wherein the one or more services further comprise an executor, wherein the executor:
detects an occurrence of a specified event; and
deploys, the first package and the second package as a result of detecting the occurrence of the specified event.

### Claim 9 (depends on 6)

The system of claim 6, wherein the one or more services further comprise an executor, wherein the executor:
deploys the first package to a first host; and
deploys the second package to a second host, the first host and the second host being:
different thread pools,
different virtual computer systems, or
different physical computer systems.

### Claim 10 (depends on 6)

The system of claim 6, wherein the one or more services further comprise an executor, wherein the executor:
obtains the first package and the second package; and
causes, in accordance with the affinity threshold, one or more hosts to be instantiated to host the first package and the second package.

### Claim 11 (depends on 6)

The system of claim 6, wherein the affinity threshold is a member of a plurality of affinity thresholds, the plurality of affinity thresholds including different thresholds for determining whether to deploy the first package and the second package to separate threads, separate virtual hosts, or separate physical servers.

### Claim 12 (depends on 6)

The system of claim 6, wherein the affinity threshold is dynamically determined based at least in part on availability of computing resources.

### Claim 13 (depends on 6)

The system of claim 6, wherein the one or more services further comprise an executor, wherein the executor:
begins execution of the first package;
upon an occurrence of an invocation of the second package, determines whether the second package is located on the host; and
on a condition that the second package is not located on the host:
submits a request to the executor to resolve the second package, the request including execution context information; and
receives an execution result from the executor, the executor having obtained the execution result from execution of the second package.

### Claim 14

A set of one or more non-transitory computer-readable storage media having stored thereon executable instructions that, as a result of being executed by one or more processors of a computer system, cause the computer system to:
evaluate application source code that includes notation that indicates a latency level between methods;
compute, based at least in part on the latency level, affinity scores for method dependencies in the application source code;
generate, in accordance with a clustering strategy that is based at least in part on the affinity scores, a set of packages, wherein the affinity score indicates a target proximity between methods in the set of packages; and
deploy, via an executor, in accordance with an affinity threshold, the set of packages to at least one host.

### Claim 15 (depends on 14)

The non-transitory computer-readable storage media of claim 14, wherein the executable instructions further comprise executable instructions that cause the computer system to dynamically establish the affinity threshold.

### Claim 16 (depends on 14)

The non-transitory computer-readable storage media of claim 14, wherein the executable instructions that cause the computer system to allocate the at least one host further comprise executable instructions that cause the computer system to instantiate, in accordance with the affinity threshold, one or more virtual hosts to receive the set of packages.

### Claim 17 (depends on 14)

The non-transitory computer-readable storage media of claim 14, wherein the executable instructions further comprise instructions that cause the computer system to enlist, in accordance with the affinity threshold, one or more physical servers to receive the set of packages.

### Claim 18 (depends on 14)

The non-transitory computer-readable storage media of claim 14, wherein the executable instructions that cause the computer system to allocate the at least one host further comprise instructions that, as a result of being executed by the one or more processors, cause the computer system to instantiate, in accordance with the affinity threshold, one or more thread pools to receive the set of packages.

### Claim 19 (depends on 14)

The non-transitory computer-readable storage media of claim 14, wherein the executable instructions further comprise instructions that cause the computer system to distribute the set of packages based on a number and capacity of available hosts.

### Claim 20 (depends on 14)

The non-transitory computer-readable storage media of claim 14, wherein the executable instructions further comprise instructions that cause the computer system to distribute to at least one host that is a mobile device.
