Home ci 07. pricing: Manage and optimize usage for Edge Functions

07. pricing: Manage and optimize usage for Edge Functions

Last updated on Aug 05, 2025

Manage and Optimize Usage for Edge Functions

Overview

Edge Functions are a powerful tool for delivering fast and efficient applications. However, understanding their usage and optimizing them effectively is crucial for both performance and cost management.

Table of Contents

  1. Plan Usage
  2. Managing Function Invocations
  3. Optimizing Function Invocations
  4. Managing Execution Units
  5. Optimizing Execution Units
  6. Managing CPU Time
  7. Optimizing CPU Time

Plan Usage

Your Edge Functions usage is tied to the plan you choose, whether it's Hobby or Pro. Here's a breakdown:

  • Hobby: Includes 500,000 execution units per month.
  • Pro: Includes 1,000,000 execution units per month.

Additional charges apply for usage beyond these limits.

Managing Function Invocations

Function invocations are tracked and billed based on the number of times your functions are called. This includes both successful and failed attempts but excludes cache hits. Key points:

  • Billing: Calculated per invocation, regardless of response status.
  • Grouping: You can group invocations by count to analyze team-wide usage.

Optimizing Function Invocations

To reduce the number of invocations:

  • Caching: Use Edge Caching and Cache-Control headers to store responses and avoid redundant calls.
  • Projects Overview: Track invocation counts per project to identify high-usage areas for optimization.

Managing Execution Units

Execution units are based on CPU time consumed by your functions. Each unit represents 50ms of CPU usage. Key points:

  • Calculation: Total CPU time used per invocation divided by 50ms.
  • Billing: Charges apply for usage exceeding the plan limits.

Optimizing Execution Units

To minimize execution units:

  • Caching: Reduce redundant invocations through caching.
  • Efficient Code: Optimize your code to use fewer resources per invocation.

Managing CPU Time

CPU time is the actual processing time your functions take. It doesn't include waiting for external data fetches. Key points:

  • No Time Limits: There's no cap on CPU time, but excessive usage can lead to higher costs.
  • Observability: Use metrics to monitor average CPU time across projects.

Optimizing CPU Time

To optimize CPU time:

  • Code Performance: Ensure your code is as efficient as possible.
  • Avoid Heavy Operations: Minimize CPU-intensive tasks that could delay responses.

Conclusion

By understanding and optimizing Edge Functions usage, you can enhance performance while managing costs effectively. Regularly review your metrics and adjust strategies to ensure optimal resource utilization.