Function Compute provides various storage types, such as File Storage NAS, Object Storage Service (OSS), temporary disks, and layers, to store and access files. This topic describes the use cases for and differences between the storage types that Function Compute supports.
Selection analysis
Item | Apsara File Storage NAS | OSS | Temporary disk | Layer |
Scenarios | Log and business file storage | Log and business file storage | Temporary business files | Publish and deploy resources such as common dependency libraries, runtime environments, and function extensions |
Maximum capacity | Elasticity | Elasticity |
| 500 MB |
Durability | Persistent | Persistent | Temporary | Persistent |
Shareable among invocations | Yes | Yes | No | Yes |
Stored content | Writable | Writable | Writable | Read-only |
Storage type | File system | Object | File system | Code dependency archive |
Event source integration | No | Yes | No | No |
Function access speed | Fast | Faster | Fastest | Faster |
Billing | Disk size ≤ 512 MB: Free. For more information, see Billing overview. | Free of charge |
Storage types
Apsara File Storage NAS
File Storage NAS is a distributed file system that provides secure, high-performance, and reliable file storage for applications and services such as ECS, High Performance Computing (HPC), Docker, and BatchCompute.
Alibaba Cloud Function Compute integrates seamlessly with Apsara File Storage NAS. You can configure NAS for a Function Compute service by specifying details such as the NAS region, mount target, and group. After you configure NAS, functions in the service can access the specified NAS file system as if it were a local file system.
Using NAS as a mount target for Function Compute provides the following benefits.
Store temporary files in NAS. The size of these files is not limited by the instance's local disk space.
Share files among multiple functions using the same NAS file system.
For more information, see Configure a NAS file system.
Object Storage Service (OSS)
Object Storage Service (OSS) is a secure, cost-effective, and reliable cloud storage service. You can use OSS to store large amounts of data, such as images, audio, videos, and logs.
Function Compute integrates seamlessly with OSS. You can configure an OSS file system for a Function Compute service. After the configuration is complete, functions in the service can access the OSS file system as if it were a local file system. For more information, see Configure an OSS file system.
Function Compute and OSS can be seamlessly integrated using OSS triggers. You can write functions to process OSS events. When an event of a specified type occurs in OSS, the corresponding function is triggered. After Function Compute is integrated with OSS, you can invoke functions to process data, such as images and audio, and then write the results to other storage services. This lets you focus only on writing your function logic because Function Compute can process large amounts of data in real time and in parallel. For more information, see Overview of OSS event triggers.
Temporary disks
Function Compute provides two temporary disk sizes: 512 MB and 10 GB. All directories on the temporary disk are writable and share the disk space.
Temporary disk space is released at the end of the lifecycle of the underlying container that executes functions. While your function is sending requests, the container and temporary data on the disk are not deleted. If your function has not sent a request for a long period of time, the container is reclaimed by the system and the data on the disk is deleted.
Layers
Layers allow you to publish and deploy resources such as common dependency libraries, runtime environments, and function extensions. You can extract common libraries that your functions depend on into layers, or use the public layers provided by Function Compute. This reduces the size of your code package when you deploy or update functions.
For more information about layer operations and limits, see Create a custom layer and Layer limits.