IP Library › Granted Patent US 10,528,390
Granted Patent B2
US 10,528,390 · App. 16/113,887 · Granted Jan 7, 2020

Idempotent task execution in on-demand network code execution systems

Inventors: Marc John Brooker (Seattle, WA); Timothy Allen Wagner (Seattle, WA); Ajay Nair (Seattle, WA)
Assignee: Amazon Technologies, Inc.
G06F9/5005G06F9/445
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,528,390
App. No.
16/113,887
Filed
Aug 27, 2018
Granted
Jan 7, 2020
Kind
B2
Examiner
KIM, DONG U
Art Unit
2196
USPC
718/104
Abstract

Systems and methods are described for handling requests to execute idempotent code in an on-demand code execution system or other distributed code execution environment. Idempotent code can generally include code that produces the same outcome even when executed multiple times, so long as dependencies for the code are in the same state as during a prior execution. Due to this feature, multiple executions of idempotent code may inefficiently use computing resources, particularly in on-demand code execution system (which may require, for example, generation and provisioning of an appropriate execution environment for the code). Aspects of the present disclosure enable the on-demand code execution system to process requests to execute code by verifying whether dependency states associated with the code have changed since a prior execution. If dependency states have not changed, no execution need occur, and the overall computing resource us of the on-demand code execution system is decreased.

Claims (54)

1. A computer-implemented method comprising:

obtaining a first request to cause execution of a task, wherein the task is associated with code executable by an on-demand code execution system to implement functionality corresponding to the task, and wherein execution of the task is dependent on a set of resources;

generating an execution environment for the task on the on-demand code execution system at least partly by provisioning the execution environment with the code;

initiating a first execution of the task at least partly by executing the code within the execution environment;

determining states of respective resources, within the set of resources, at a time of the first execution of the task;

obtaining a second request to cause execution of the task;

for individual resources of the set of resources, comparing updated current states of the individual resources and the states of the respective resources at the time of the first execution of the task to determine that the current states of the individual resources match the states of the respective resources at the time of the first execution of the task; and

declining to initiate a second execution of the task in response to the second request.

2. The computer-implemented method of claim 1 further comprising:

obtaining a third request to cause execution of the task;

for individual resources of the set of resources, comparing current states of the individual resources at a time of the third request and the states of the respective resources at the time of the first execution of the task to determine that a current state of at least one resource, from the set of resources, does not match the state of the at least one resource at the time of the first execution; and

executing the code to implement functionality corresponding to the task.

3. The computer-implemented method of claim 2 , wherein the third request occurs prior to the second request.

4. The computer-implemented method of claim 1 further comprising:

obtaining a result of the first execution of the task; and

returning the result as a result of the request to cause the second execution of the task.

5. The computer-implemented method of claim 1 , wherein the set of resources include at least one of the code associated with the task, a resource referenced by a parameter passed within the request, or a resource referenced by the code associated with the task.

6. The computer-implemented method of claim 1 further comprising generating an execution record for the task indicating the states of the respect resources within the set of resources at the time of the first execution, wherein determining the states of the respective resources at the time of the first execution comprises obtaining the states of the respective resources from the execution record.

7. The computer-implemented method of claim 6 , wherein the execution record for the task indicates the states of the respective resources at each of a set of prior executions of the task, and wherein the computer-implemented method further comprises identifying the first execution from the set of prior executions.

8. A system comprising:

a data store including computer-executable instructions; and

a physical processor configured to execute the computer-executable instructions, wherein execution of the computer-executable instructions causes the system to:

obtain a first request to cause execution of a task, wherein the task is associated with code executable by an on-demand code execution system to implement functionality corresponding to the task, and wherein execution of the task is dependent on at least one resource;

generate an execution environment for the task on the on-demand code execution system at least partly by provisioning the execution environment with the code;

initiate a first execution of the task at least partly by executing the code within the execution environment;

determine a state of the at least one resource at a time of the first execution of the task;

obtain a second request to cause execution of the task; determine that a current state of the at least one resource matches the state of the at least one resource at the time of the first execution; and

end processing of the second request to cause execution of the task without initiating a second execution of the task.

9. The system of claim 8 , wherein the at least one resource corresponds to a plurality of resources, and wherein determining that the current state of the at least one resource matches the state of the at least one resource at the time of the first execution comprises determining that the current state of every individual resource within the plurality of resources matches a state of the respective individual resource at the time of the first execution.

10. The system of claim 8 , wherein execution of the computer-executable instructions further causes the system to:

obtain a third request to cause execution of the task;

determine that the current state of the at least one resource does not match the state of the at least one resource at the time of the first execution; and

execute the code to implement functionality corresponding to the task.

11. The system of claim 8 , wherein the at least one resource corresponds to a plurality of resources, and wherein determining that the current state of the at least one resource does not match the state of the at least one resource at the time of the first execution comprises determining that any individual resource within the plurality of resources does not match a state of the individual resource at the time of the first execution.

12. The system of claim 8 , wherein execution of the computer-executable instructions further causes the system to return an indication that the second request to execute the task is satisfied without execution of the code.

13. The system of claim 8 , wherein execution of the computer-executable instructions further causes the system to identify the at least one resource based at least partly on at least one of static or dynamic analysis of the code associated with the task.

14. The system of claim 8 , wherein execution of the computer-executable instructions further causes the system to generate an execution record for the task indicating a state of the at least one resource at the time of the first execution, and wherein determining the state of the at least one resource at the time of the first execution comprises obtaining the state of the at least one resource from the execution record.

15. The system of claim 8 , wherein the execution record for the task indicates the states of the at least one resource at each of a set of prior executions of the task, and wherein execution of the computer-executable instructions further causes the system to identify the first execution from the set of prior executions.

16. Non-transitory computer-readable media comprising computer-executable instructions that, when executed, cause a system to:

obtain a first request to cause execution of a task, wherein the task is associated with code executable by an on-demand code execution system to implement functionality corresponding to the task, and wherein execution of the task is dependent on at least one resource;

generate an execution environment for the task on the on-demand code execution system at least partly by provisioning the execution environment with the code;

initiate a first execution of the task at least partly by executing the code within the execution environment;

determine a state of the at least one resource at a time of the first execution of the task;

obtain a second request to cause execution of the task;

determine that a current state of the at least one resource matches the state of the at least one resource at the time of the first execution; and

end processing of the second request to cause execution of the task without initiating a second execution of the task.

17. The non-transitory computer-readable media of claim 16 , wherein the first execution is a most recent execution of the task prior to the second request.

18. The non-transitory computer-readable media of claim 16 , wherein the computer-executable instructions, when executed, further cause a system to:

obtain a third request to cause execution of the task;

determine that the current state of the at least one resource does not match the state of the at least one resource at the time of the first execution; and

initiate a second execution of the code to implement functionality corresponding to the task.

19. The non-transitory computer-readable media of claim 16 , wherein the second request occurs subsequent to the second execution.

20. The non-transitory computer-readable media of claim 16 , wherein the at least one resource corresponds to a plurality of resources, and wherein, to determine that the current state of the at least one resource matches the state of the at least one resource at the time of the first execution, execution of the computer-executable instructions further causes the system to determine that the current state of every individual resource within the plurality of resources matches a state of the respective individual resource at the time of the first execution.

21. The non-transitory computer-readable media of claim 16 , wherein the at least one resource corresponds to a plurality of resources, and wherein, to determine that the current state of the at least one resource does not match the state of the at least one resource at the time of the first execution, execution of the computer-executable instructions further causes the system to determine that any individual resource within the plurality of resources does not match a state of the individual resource at the time of the first execution.

Continuity (2)
Continuation 15275228 · Sep 23, 2016
Related Publication 20190205171A1 · Jul 4, 2019
Cited By (8)
US 12,314,752 US 12,321,766 US 12,327,133 US 12,381,878 US 12,476,978 US 12,671,671 US 12,724,647 US 12,726,444