Function Deployment Selection

Last updated: 2023-09-27 14:25:42

To meet the needs of users in different usage scenarios, SCF offers two deployment methods: code deployment and image deployment. This document introduces the differences and applicable scenarios of these deployment methods for developers to reference when making their selection.

Analysis of Deployment Method Selection

The following compares the characteristics of the two different SCF deployment methods from various perspectives:
Entry
Code Deployment
Image Deployment
Description
Upload the code files to SCF to serve as the function's operational code, which runs on the base image provided by SCF.
Designate a user-created image as the operational environment for the function.
Size Limit
The combined size of the function code and associated layer version code is less than or equal to 500MB (before compression).
1GB (before decompression)
Format/Image Repository Support
zip , jar(java)
Running environment
Python 3.7
Python 3.6
Python 2.7
Node.js 16.13
Node.js 14.18
Node.js 12.16
PHP 8.0
PHP 7.4
PHP 7.2
PHP 5.6
Java11
Java8
Golang 1
CustomRuntime
No limit
Custom Startup File
Not supported
Supported
Setting the Listening Port
Not required
Fixed port 9000 must be set to listen.
Scenario
The basic runtime environment can accommodate scenarios where custom startup commands are not required.
The basic runtime environment does not currently support scenarios such as rapidly migrating original image-based operations to cloud functions.

Deployment mode

Code deployment

SCF offers three methods for code deployment:


Upload a zip package online, supporting only code packages under 50 MB.
Upload a folder online, supporting only folders under 250 MB.
Upload a ZIP pack via COS
Explanation
The aforementioned three code deployment methods are all subject to the restriction that the total size of the code package and associated layer versions must be less than or equal to 500MB (before compression). If it exceeds 500MB, it is recommended to streamline the code package size, or upload some dependent files to Object Storage COS or File System CFS, and reference them in the function code. If dependent files need to be referenced during the code initialization stage, it is recommended to use CFS.

Image deployment

The image deployment capability of SCF is supported by Tencent Cloud Container Registry. Tencent Cloud Container Registry is a cloud-based container image hosting service provided by Tencent Cloud, supporting Docker image, Helm Chart storage distribution, and image security scanning. By using the container image service, you no longer need to build and maintain your own image hosting service, and you can enjoy secure and efficient image hosting and distribution services in the cloud.
With the SCF image deployment feature, you simply need to push the locally built image to the TCR image repository and select the specified image when creating a function.