The Tencent Serverless Cloud Function Custom Runtime allows developers to write serverless functions in any programming language.
In this article, we make the case for serverless functions in Rust and WebAssembly, and demonstrate their use in machine learning and visualization.
You will learn how to create a simple function for machine learning and deploy a serverless web site around it, for free (unless a million people use it!).
Tencent is the biggest Internet company outside of the USA with over a billion active daily users. Its cloud computing arm, Tencent Cloud, is ranked among the top 5 cloud providers in the world by market share.
If you want to reach the world-wide market with your cloud services, Tencent Cloud should be near the top of your list.
Tencent Cloud is also a leading innovator in serverless computing with strong offerings ranging from Function as a Service (FaaS) runtimes, triggers, connectors, and developer tools.
The Tencent Serverless Cloud Functions (SCF) already support 10+ programming languages and runtime frameworks. But the recently released SCF Custom Runtime took another step forward. The SCF can now support functions written in any programming language.
In this article, I will cover how to run WebAssembly functions, written in Rust, in the SCF.
We will first go over the basic concepts. Then, we will review a complete but simple hello world example to deploy your first WebAssembly serverless function.
Finally, we will do something useful with a machine earning as a service (MLaaS) example that takes data and returns the fitted model and visualization in the SVG format.
Here is the final application you will create by the end of this tutorial. It is completely “serverless” and incurs cost when people use it.
The HTML and JavaScript UI can be hosted on any computer including your laptop, and the backend function to perform machine learning and SVG drawing is on Tencent Cloud Serverless.
Traditional serverless functions are based on heavy-weight frameworks. Developers must write functions in specific application frameworks, such as JavaScript in Node.js or Python Boto and so on.
The Tencent Cloud SCF Custom Runtime breaks this mold, and allows developers to write serverless functions in any language.
To demonstrate this point, it provides examples for a Bash script-based function, a Deno-based TypeScript function, and a Rust-based native binary function. That allows us to create and deploy WebAssembly-based serverless functions on Tencent Cloud.
Why do we want to do that? Here are some reasons.
Finally, programming and deploy WebAssembly functions on Tencent Cloud is actually quite easy. You can do in it an hour. Let’s get started.
#rust #webassembly #serverless #machine-learning #cloud