Tencent Cloud Serverless Cloud Function (SCF) is a function-as-a-service (FaaS) product that provides a serverless FaaS computing platform. Therefore, when combined with the trigger event source, an SCF functions can be triggered by an event generated by the trigger source.
The origin of the serverless architecture concept can be explained in the article Serverless Architecture by Mike Roberts at Martin Fowler's blog website.
Serverless does not mean that computation can be performed without a server; instead, it means that developers can use relevant resources without caring about the underlying servers.
More broadly, cloud services that can be used directly without configuring or understanding the underlying servers can also be seen as serverless to some extent.
In the SCF product, we are targeting the computation in serverless scenarios. SCF provides FaaS capabilities in serverless mode.
Function-as-a-service (FaaS) provides the capability to execute stateless, transient, event-triggered code directly in the cloud.
FaaS is different from traditional application architectures. It provides an event-triggered operation method, where a function is not always running but triggered by an event when the event occurs, and the event is only handled once during one execution. Therefore, in the code of the function, only the handling flow for one event needs to be considered, and high-concurrency handling of many events is supported by the multi-instance function concurrency implemented by the platform.
In order to support high concurrency, the SCF platform features automatic elastic scalability, which will launch more instances to handle event requests when high volumes of requests are received and will reduce function instances (down to zero) when less or no requests are received. Therefore, in order to match the automatic scaling capability, the function code needs to be developed in a stateless manner, that is, the relevant state data is not retained in the running memory of the function or depended on when the function is executed multiple times. The state data of the function can be stored in external persistent storage services such as Cloud Memcached, TencentDB, and COS.
Anything that can generate an event and trigger the execution of a function can be referred to as a trigger or trigger source. The trigger triggers function execution by passing the event to the function after it generates the event itself.
The trigger can trigger the function synchronously or asynchronously according to its own characteristics. When the function is triggered synchronously, the trigger will wait for the function to complete and return the execution result; when the function is triggered asynchronously, the trigger will only trigger the function and ignore the execution result.
When connecting with other Tencent Cloud products or services, SCF has some special ways of implementing such as push mode and pull mode.
A trigger passes an event to a function when the function is triggered. The event is represented by a specific data structure in JSON format and passed to the function as the event input parameters of the function.
The JSON data content of the trigger event will be converted to corresponding data structures or objects in different language environments, and you do not need to perform the conversion from JSON structures to data structures in the code on your own.
For example, in Python environment, the JSON data content will be converted to a complex dict object, that is, the event input parameters of the function is a complex Python dict object. In Go or Java, the input parameters have to be an object that can match the event data structure. For more information on specific implementations, please see Development Language Descriptions.
Contact our sales team or business advisors to help your business.
Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.
Was this page helpful?