Post

Week 6 Update: Invocations Yay!

Week 6 Update: Invocations Yay!

Overview

This week marks a major milestone—we’ve completed the workflow for registering and invoking functions! Our focus shifted to simulating the full function invocation process and handling completed invocations efficiently. These enhancements are pivotal for ensuring our serverless environment operates seamlessly and asynchronously.

Simulating Function Invocation

Our simulation of invoking a function covers multiple stages:

  • Image Management:
    • Downloading on the Head Host: The system downloads the required image only once, preventing duplicate downloads.
    • Scheduling on a Compute Host: Once the image is ready, the compute host is chosen based on available slots and resource limits.
  • Resource Checks and Transfers:
    • Limit Verification: Before invocation, the system checks if the function meets predefined limits (disk space, RAM, etc.).
    • Copying Code & Image: The necessary code and image are transferred to the selected compute host.
  • Executing the Lambda:
    • After setting up, the lambda function is executed. This simulation includes a brief pause (e.g., sleeping for 1 second) to mimic actual function execution.

Handling Completed Invocations

To maintain a non-blocking execution environment, we’ve introduced a robust mechanism for tracking and retrieving function results:

  • Asynchronous Communication:
    • Once a function finishes executing, the Serverless Compute Service sends a message to the Function Manager.
    • The Function Manager keeps track of these completed invocations without interrupting the ongoing operations of the execution controller.
  • Wait Functions:
    • wait_one: Waits for a specific invocation to complete.
    • wait_all: Waits for a list of invocations to finish.
    • These functions allow the execution controller to check on the status of functions at its convenience, ensuring that it can continue processing other tasks without delay.

Next Steps

  • Refinement:
    • Further refine the simulation process to handle more complex scenarios and edge cases.
    • Enhance error handling for scenarios where functions fail to invoke due to resource limitations or registration errors.
  • Optimization:
    • Optimize the wait mechanism to ensure minimal overhead while tracking function completions.
    • Improve the messaging and scheduling algorithms based on performance tests and user feedback.

This week’s advancements bring us closer to a fully operational serverless environment, where function invocation is efficient, and completed tasks are seamlessly integrated back into the execution flow.

This post is licensed under CC BY 4.0 by the author.