Serverless computing
It has been suggested that Function as a Service be merged into this article. (Discuss) Proposed since July 2016. |
Serverless computing, also known as Function as a Service (FaaS), is a cloud computing code execution model in which the cloud provider fully manages starting and stopping virtual machines as necessary to serve requests, and requests are billed by an abstract measure of the resources required to satisfy the request, rather than per virtual machine, per hour.[1]
Despite the name, it does not actually involve running code without servers.[1] Serverless computing is so named because the business or person that owns the system does not have to purchase, rent or provision servers or virtual machines for the back-end code to run on.
Serverless code can be used in conjunction with code written in traditional server style, such as microservices. For example, part of a web application could be written as microservices and another part could be written as serverless code. Alternatively, an application could be written that uses no provisioned servers at all, being completely serverless.[2]
Serverless code can either be triggered by specific events (such as user registration with Amazon Cognito), or be configured to run behind an API management platform in order to expose it as a REST API endpoint.[2]
History
The first 'pay as you go' code execution platform where developers simply wrote code online including billing at a functional level, creation of virtual resources by the system as needed, exposure of functions as APIs was Zimki in 2006. AWS Lambda, introduced by Amazon in November 2014,[3] was the first major provider considered to have a serverless offering. AWS Lambda initially launched with Node.js as the only runtime,[3] but as of 2016[update] it now officially supports Python and Java, and other languages such as Haskell can also be used by using Node.js as an invoker.[4]
Google has released an alpha version of its serverless platform, which is called Google Cloud Functions,[5] and supports Node.js.[6]
IBM announced OpenWhisk as an open source serverless platform of its own at InterConnect 2016.[7][8] In addition to supporting functions as a service, OpenWhisk offers features that include user-defined triggers, function execution rules, function composition via sequences, and a model for sharing assets via packages. OpenWhisk may be hosted on premise or hosted as a service as is the case with IBM Bluemix OpenWhisk. The source code is available on GitHub. At launch, OpenWhisk included support for Node.js and Swift, as well as black box functions (in any language or runtime) via Docker containers. It now officially also includes support for Python and Java as well.
Microsoft followed up in 2016 by announcing Azure Functions, a technology usable in both the Azure public cloud and on any other cloud environment, public or private.[9] Azure functions have been generally available for production use since November 2016[10]
Advantages
Cost
Serverless computing can be more cost-efficient just in terms of computing resources, than renting or purchasing a fixed quantity of servers, which generally involves periods of underutilisation or non-use.[1] It can even be more cost-efficient than provisioning an autoscaling group, because even autoscaling groups are typically designed to have underutilisation to allow time for new instances to start up.
In addition, a serverless architecture means that developers and operations specialists do not need to spend time setting up and tuning autoscaling policies or systems – the cloud provider is responsible for ensuring that the capacity meets the demand.[1][9]
Programming model
In serverless computing, the units of code exposed to the outside world are simple functions – for example, in AWS Lambda, they are essentially functions that both consume and produce JSON, although they can make calls to other APIs, and the JSON may be automatically serialized from and deserialized to data structures at the option of the programmer. This means that typically, the programmer does not have to worry about multithreading or directly handling HTTP requests in their code, simplifying the task of back-end software development.
Disadvantages
Performance
Infrequently-used serverless code may suffer from greater response latency than code that is continuously running on a dedicated server, virtual machine, or container. This is because, unlike with an autoscaling, the cloud provider typically "spins down" the serverless code completely when not in use. This means that if the runtime in use – for example, the Java runtime, in the case of Java code – requires a significant amount of time to start up, that will introduce latency into the request handling the next time a request is made to that piece of code. However, not all code is latency-sensitive - for example, batch processing operations run by cron jobs might not be significantly affected by small, infrequent latencies such as this.
Resource limits
Serverless computing is not suited to some computing workloads, such as high-performance computing, because of the resource limits imposed by cloud providers, and also because it would likely be cheaper to bulk-provision the number of servers believed to be required at any given point in time.
Monitoring and debugging
Diagnosing performance or excessive resource usage problems with serverless code may be more challenging than with traditional server code, because although entire functions can be timed,[2] there is typically no ability to dig into more detail and attach profilers, debuggers or APM tools - and the environment in which the code runs is typically not open source, so its performance characteristics cannot be precisely replicated in a local environment.
See also
- API management platform, a technology often used in conjunction with serverless systems
- Serverless Framework, a software framework for creating serverless systems on AWS Lambda with Node.js or Python
- Platform as a service (PaaS)
References
- ^ a b c d Miller, Ron (24 Nov 2015). "AWS Lambda Makes Serverless Applications A Reality". TechCrunch. Retrieved 10 July 2016.
- ^ a b c MSV, Janakiram (16 July 2015). "PaaS Vendors, Watch Out! Amazon Is All Set To Disrupt the Market". Retrieved 10 July 2016.
- ^ a b Miller, Ron (13 Nov 2014). "Amazon Launches Lambda, An Event-Driven Compute Service". TechCrunch. Retrieved 10 July 2016.
- ^ Bailly, Arnaud (14 June 2016). "abailly/aws-lambda-haskell - Running Haskell code on AWS Lambda". GitHub. Retrieved 10 July 2016.
- ^ Novet, Jordan (9 February 2016). "Google has quietly launched its answer to AWS Lambda". VentureBeat. Retrieved 10 July 2016.
- ^ MSV, Janakiram (9 February 2016). "Google Brings Serverless Computing To Its Cloud Platform". Retrieved 10 July 2016.
- ^ Zimmerman, Mike (23 February 2016). "IBM Unveils Fast, Open Alternative to Event-Driven Programming".
- ^ Ryan, Fintan (29 February 2016). "Swift, OpenWhisk and APIs – Reflections on IBM InterConnect".
- ^ a b Miller, Ron (31 March 2016). "Microsoft answers AWS Lambda's event-triggered serverless apps with Azure Functions". TechCrunch. Retrieved 10 July 2016.
- ^ "General availability: Azure Functions". 16 November 2016. Retrieved 21 November 2016.
Further reading
- Roberts, Mike (25 July 2016). "Serverless Architectures". MartinFowler.com. Retrieved 30 July 2016.