Exploring some of the ideal use cases, costs and infrastructure behind serverless cloud computing
The conventional view of cloud computing is that of taking existing servers out of your own data center and hosting them elsewhere. In that scenario, the basic building block is the cloud server, which might run Windows or Linux and host a website or two, email, a database engine, and so on.
You’ve probably also heard mention of serverless cloud computing. But how can that be? Where do you host your website, database and so on if you haven’t first created one or more virtual servers?
Serverless cloud computing is provided by Alibaba Cloud within a product set known as Function Compute. This actually provides a useful clue as to how the concept actually works. The basic building block is no longer a server but a block of code, which is known as a function. The function is executed by an event known as a trigger. This can be an API call, a call to a particular URL, a timer reaching a predetermined value or the appearance of a new file in a directory, for example.
Functions still run on cloud servers, but those servers are part of Alibaba Cloud’s fully-managed core infrastructure. You don’t need to build, patch, secure or pay for your own servers. Instead, you simply create and upload functions, and then create triggers which cause them to run.
Function Compute is massively scalable, without the need for you to implement any load balancing or contingency planning. Whether a function gets called once a month, or a million times a minute, the underlying infrastructure will take care of it.
Billing for Serverless Cloud Computing
Billing is straightforward and easy to budget for. The cost of calling a function is made up of three components: request, duration, and an optional Internet traffic fee.
Request fees are USD $0.20 per million. The duration component is measured in gigabyte seconds, and is calculated by multiplying the time your function takes to run by the amount of RAM you allocated to it. For example, a function which runs for 0.1 seconds and is allocated 0.5GB of RAM will incur a cost of 0.05 gigabyte seconds. Gigabyte seconds cost $0.00001668, which is around 6 cents per gigabyte hour.
As an Alibaba Cloud account holder, your first 1 million Function Compute requests and 400,000 gigabyte seconds each month are completely free. Therefore, you could trigger around 32,200 function calls per day, each allocated 0.4GB of RAM and running for 100 milliseconds, and pay absolutely nothing. This compares very favorably with conventional cloud servers, especially as there’s no need to expend additional time and effort securing, patching and updating your own VMs.
If your function generates traffic on the public Internet, this is charged at between $0.07 and $0.13 depending on the region.
Ideal Uses for Function Compute
Function Compute currently supports python, node.js, Java, C# and PHP. And while it doesn’t necessarily replace all aspects of your cloud computing requirements, there are clearly some situations which can transfer very well. For example, when a user uploads an image to your website, this could trigger a function which compresses the file in order to save on storage costs. Other ideal uses for Function Compute include web crawlers, data and log analysis, automated backups, and implementing APIs. Coupled with OSS storage, Function Compute also makes a great back end for IoT devices and mobile apps, especially as it’s so scalable and cost effective.
You can even implement an entire serverless website. Create your content (static HTML files or database-driven) and upload the files to an Alibaba Cloud Object Storage Service (OSS) bucket. Then create triggers which retrieve and display the relevant content in response to a particular URL being accessed. You can find a complete step-by-step tutorial on how to do this at https://www.alibabacloud.com/blog/create-a-serverless-website-with-alibaba-cloud-function-compute_594594 .
To learn more about Function Compute, see https://www.alibabacloud.com/products/function-compute .