Function Compute provides various storage types, such as Apsara File Storage NAS (NAS), Object Storage Service (OSS), temporary disks, and layers, that you can use to store and access files. This topic describes the use cases and differences between the storage types supported by Function Compute to help you choose the best option for your needs.
Selection analysis
Comparison item | Apsara File Storage NAS | Object Storage Service (OSS) | Temporary disk | Layer |
Scenarios | Log and business file storage | Log and business file storage | Temporary files from business operations | Publishing and deployment of public dependency libraries, runtime environments, and function extensions |
Maximum space | Elastic | Elastic |
| 500 MB |
Persistence | Persistent | Persistent | Temporary storage | Persistent |
Shared between 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 | Faster | Fast | Fastest | Fast |
Billing | Disk space ≤ 10 GB: Free. For more information, see Billing overview. | Free |
Storage types
Apsara File Storage NAS
File Storage NAS is a distributed file storage system. It provides secure, high-performance, and highly reliable file storage for services such as ECS, HPC, Docker, and BatchCompute.
Function Compute seamlessly integrates with NAS. You can configure NAS information for a function, including the NAS region, mount target, and group. After the configuration is complete, the function 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.
You can store temporary files in NAS. The size of temporary files is not limited by the local disk space of the instance.
You can share files among multiple functions that use 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 highly reliable cloud storage service. You can use OSS to store large amounts of data, such as images, audio, videos, and logs.
Function Compute seamlessly integrates with OSS. You can configure an OSS mount for a function. After the configuration is complete, the function can use the OSS storage service as if it were a local file system. For more information, see Configure OSS object storage.
Function Compute and OSS can also be seamlessly integrated using OSS triggers. You can write functions to process OSS events. When OSS detects an event of a specified type, it triggers the corresponding function. After you integrate Function Compute with OSS, you can invoke various functions to process data such as images or audio and write the results to different storage services. In this architecture, you need to focus only on writing the function logic. The system processes large amounts of data in real time with high reliability and parallelism. For more information, see OSS trigger overview.
Temporary disk
Function Compute provides two temporary disk specifications: 512 MB and 10 GB. All directories on the temporary disk are writable and share the disk space.
The lifecycle of the temporary disk space is tied to the lifecycle of the container that runs the function. If requests are sent continuously, the container and the data on the disk persist. However, if the function is not invoked for an extended period, the system reclaims the container, and the data on the disk is deleted.
Layers
Layers allow you to publish and deploy resources such as public dependencies, runtime environments, and function extensions. You can extract the public dependencies of your function into a layer, or use official public layers from Function Compute. This reduces the size of your code package when you deploy or update a function.
For more information about operations and limits related to layers, see Create a custom layer and Layer limits.