Function Compute provides various storage types, 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 supported by Function Compute.
Selection analysis
Item | NAS | OSS | Temporary hard disk | Layer |
Scenarios | 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, runtime environments, and function extensions |
Maximum capacity | Scalable | Scalable |
| 500 MB |
Durability | Persistent | Persistent | Temporary | Persistent |
Shareable among invocations | Yes | Yes | No | Yes |
Stored data writable | Yes | Yes | Yes | No |
Storage type | File system | Objects | File system | Archiving of code dependencies |
Event source integration | 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 in Billing overview. | 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.
Function Compute can seamlessly integrate with NAS. You can configure the NAS settings for a service in Function Compute. The settings include the information such as the region, mount target, and group. After you configure a NAS file system for a service, all functions in the service can access the files in the NAS file system in the same manner in which you access the on-premises file system.
- Temporary files can be stored 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 by using one 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 be seamlessly integrated with OSS. You can configure OSS mounting for a Function Compute service. After that, functions in the service can use OSS in the same way as using a local file system. 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 the 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 audios, 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 of OSS event triggers.
Temporary hard disks
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. 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 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.