Serverless computing explained

Geschreven door Matthias Vallaey | 13-aug-2018 12:00:08

Serverless computing allows you to build and run applications and services without thinking about servers. Serverless applications don't require you to provision, scale, and manage any servers. You can build them for virtually any type of application or backend service, and everything required to run and scale your application with high availability is handled for you.

Building serverless applications means that your developers can focus on their core product instead of worrying about managing and operating servers or runtimes, either in the cloud or on-premises. This reduced overhead lets developers reclaim time and energy that can be spent on developing great products which scale and that are reliable.

Of course, in the background, servers still exist, humming away. But serverless architectures are stateless. They do their work by executing a bit of logic—a function—and calling out to other services to do whatever else they need. If you’re a developer who primarily builds applications using services via APIs or needs to respond to events, serverless architecture may prove to be the easiest, fastest, and least risky means for getting the job done.

Among the chief services available for serverless in the cloud are AWS Lambda, Azure Functions and Google Cloud Functions. 

How it works

 

Upload the function and link it to a request or event. From the moment a request has been made (a REST invocation, for example) or an event has occurred (e.g. a file is added to an S3 bucket), your function will be called with the passed-in arguments and your return parameters will be passed along as the results.

Your function can be written in any language supported by your provider. At the moment of writing AWS Lambda supports code written in Node.js (JavaScript), Python, Java (Java 8 compatible), and C# (.NET Core) and Go.

With Serverless, you pay for consumption and are charged only for the compute time you use. With AWS Lambda, you are charged for every 100ms your code executes and the number of times your code is triggered. You don't pay anything when your code isn't running.

Because all you see is a function, there's no place to store state. When a function is done executing, its compute resources can be garbage-collected and reused. Therefore, state must be stored in some other service like a database or a cache.

Cloud-based serverless providers

All the major cloud providers are developing their own product. Amazon has AWS Lambda, Microsoft has Azure Functions and Google has Google Cloud Functions. In terms of deciding among the three, if you are already on the public cloud, it’s best to use the product from your current provider. A big part of the usefulness of Serverless is the richness of the available services and events you can consume. Those choices are best inside your cloud. But if you’re getting started in the cloud and stability is important, then AWS Lambda has been around the longest and is the safest choice thus far.

Use cases

Real-time file processing

You can use Amazon S3 to trigger AWS Lambda to process data immediately after an upload. For example, you can use Lambda to thumbnail images, transcode videos, index files, process logs, validate content, and aggregate and filter data in real-time.

Real-time Stream processing

You can use AWS Lambda and Amazon Kinesis to process real-time streaming data for application activity tracking, transaction order processing, click stream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering.

 

 

IOT Backends

You can build serverless backends using AWS Lambda to handle web, mobile, Internet of Things (IoT), and 3rd party API requests.

Web applications

By combining AWS Lambda with other AWS services, developers can build powerful web applications that automatically scale up and down and run in a highly available configuration across multiple data centers – with zero administrative effort required for scalability, back-ups or multi-data center redundancy.

 

Source: AWS & Infoworld