Post

Week 5 Update: Fleshing Out Functionality

Week 5 Update: Fleshing Out Functionality

Overview

This week, our focus shifted to implementing the core functionalities of function registration and invocation within the Serverless Compute Service. With the framework in place, we now integrate actual operations, ensuring that functions are both stored and executed as intended.

Function Registration

  • Data Structure:
    Registered functions are stored in a map where:
    • Key: Function name.
    • Value: A data structure that encapsulates the function and its resource limits (time, disk, RAM, ingress/egress).
  • Registration Process:
    • When a registration call is received, the Serverless Compute Service processes it and attempts to add the function to the map.
    • Error Handling:
      • If a function with the same name is already registered, an error is thrown to avoid duplicates.

Function Invocation

  • Invocation Workflow:
    • An invocation call is placed, and the Serverless Compute Service checks the map for the registered function.
    • Instead of blocking the execution controller while waiting for the function to complete, the system immediately returns a handler for the function invocation or an error if the function is not invokable (e.g., not registered).
  • Asynchronous Execution:
    • Once a valid invocation message is received:
      • The system schedules the function execution.
      • A placeholder implementation simulates the function running by sleeping for 1 second.
      • After the simulated delay, a message is sent back to the Function Manager indicating the function has completed.

Key Enhancements

  • Seamless User Experience:
    The execution controller can continue processing without waiting for the function’s completion, thanks to the asynchronous handling.

  • Robust Error Handling:
    The system now properly detects duplicate registrations and invalid invocations, ensuring reliability and clarity in usage.

Next Steps

  • Refinement and Testing:
    • Extend the simulation to include more complex function behaviors.
    • Introduce more comprehensive error handling for various edge cases.
  • Performance Optimization:
    • Investigate improvements for the message passing and scheduling mechanisms.
  • User Documentation:
    • Update our API documentation to include the new registration and invocation details, along with error scenarios.

This week’s progress has significantly enhanced our serverless infrastructure, bridging the gap between registration and execution. The introduction of asynchronous invocation handling marks an important step toward a scalable and efficient system.

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