Updated on 2025-08-19 GMT+08:00

Dynamic Memory

This section describes how to configure dynamic memory for functions on the FunctionGraph console to reduce costs.

Scenarios

By default, a function is bound with only one resource specification. Dynamic memory allows you to set the resource specifications of the processing function instance when processing a specified request. If no resource specification is specified, the function uses the default.

Take video transcoding as an example. The size of a video file ranges from MB to GB. Different encoding formats and resolutions require different computing resources. To ensure performance, you usually need to configure a large resource specification, which however will result in a waste during low-resolution video (such as short video) processing. To solve this problem, implement the transcoding service with two functions: metadata obtaining and transcoding. Configure a specification for the transcoding function according to the metadata information to minimize the resources and cost.

Notes and Constraints

  • The value of dynamic memory must be 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584, 4096, 8192 or 10240, in MB.
  • If dynamic memory is not enabled, the memory size set in Configuring Basic Settings is used when the API is called to execute the function.
  • If dynamic memory is enabled but the memory size is not set, the memory size set in Configuring Basic Settings is used when the API for executing a function asynchronously or synchronously is called.
  • If dynamic memory is enabled but the memory size is not within the specified range. When the API is called, error code FSS.0406 is returned.

Configuring Dynamic Memory

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of a function.
  3. Choose Configuration > Advanced Settings.
  4. Enable Dynamic Memory and click Save.

    For details about how to call an API for executing a function synchronously or asynchronously, see Executing a Function Synchronously and Executing a Function Asynchronously.