Function Compute provides various types of storage, including File Storage NAS (NAS), Object Storage Service (OSS), temporary hard disks, and layers, to store and access files. This topic describes the scenarios and differences of the storage types available in Function Compute.
Selection analysis
Comparison item | NAS | OSS | Temporary hard disk | Layer |
Scenario | Storage of logs and business files | Storage of logs and business files | Storage of temporary files generated by business | Publishing and deployment of resources such as common dependencies, runtimes, and function extensions |
Maximum capacity | Scalable | Scalable |
| 500 MB |
Persistence | Yes | Yes | No (temporary storage) | Yes |
Whether data shareable among invocations | Yes | Yes | No | Yes |
Whether stored data writable | Yes | Yes | Yes | No |
Storage type | File system | Object | File system | Archived code |
Whether to integrate with event sources | No | Yes | No | No |
Function access speed | Faster | Fast | Fastest | Fast |
Billing | Hard disk size ≤ 512 MB: free of charge. For more information, see the "Unit prices" section of the Billing overview topic. | Free of charge. |
Storage types
NAS
File Storage NAS is a distributed network file storage system that provides secure, high-performance, high-reliability, and easy-to-use file storage services for Elastic Compute Service (ECS), Elastic High Performance Computing (E-HPC), Docker, and Batch Compute.
Alibaba Cloud Function Compute can seamlessly integrate with NAS. You can configure NAS settings, such as the region, mount target, and group for functions. After you configure a NAS file system for functions, the functions can access files in the NAS file system in a way you access the on-premises file system.
NAS has the following benefits:
You can store temporary files in a NAS file system. The size of temporary files is not limited by the capacity of on-premises disks.
Multiple functions can share files that are stored in the same NAS file system.
For more information, see Configure a NAS file system.
OSS
Object Storage Service (OSS) is a secure, cost-effective, and highly reliable cloud storage service. OSS allows you to store large amounts of data in the cloud. You can use OSS to store large amounts of data, such as images, audios, videos, and logs.
Function Compute can seamlessly integrate with OSS. You can configure OSS mounting for functions. After you configure OSS mount targets for functions, the functions can use the OSS in a way you use on-premises file storage systems. For more information, see Configure an OSS file system.
Function Compute can be seamlessly integrated with OSS by using OSS triggers. You can write functions to process OSS events. When OSS captures events of specified types, the OSS events trigger the corresponding functions. After Function Compute is integrated with OSS, you can invoke various functions to process images and audio files, and then write the results back to various storage services. In the entire process, you need to focus only on writing the function logic. Function Compute can process large amounts of data in real time and in parallel. For more information, see Overview.
Temporary hard disk
Function Compute provides two temporary hard disk sizes: 512 MB and 10 GB. All directories in the temporary hard disk are writable and share the space of the temporary hard disk.
Temporary disk space is released at the end of the lifecycle of the underlying container that executes functions. When your function keeps 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.
Layer
Layers allow you to publish and deploy custom resources such as common dependencies, runtimes, and function extensions. You can abstract the public libraries that are depended on by functions into layers or use common layers of Function Compute to reduce the sizes of the code packages when you deploy or update functions.
For more information about the operations and limits on layers, see Create a custom layer and Limits.