If you need to process large files in the memory, consider the following options:
- Make sure that your instance has enough memory. Flexible instances can have up to 3 GB of memory. For functions that require a larger memory size, use performance instances. For more information about the two instance types, see Instance specifications and usage modes.
- Process data in streaming mode to reduce memory consumption. Assume that a function normally consumes 1 GB of memory and its execution duration is 3 minutes. If you use stream processing, the function consumes only 256 MB of memory and the execution duration is reduced to 10 seconds.
If you need to temporarily store files on a disk, consider the following options:
- By default, Function Compute provides each function with 512 MB of temporary storage in the /tmp directory.
- Mount an Apsara File Storage NAS file system to Function Compute and store files in the NAS file system. For more information, see Configure NAS. The mounted NAS file system provides the same user experience as an on-premises disk.