What Is Serverless Computing and How Is It Useful in IoT?

Featured Image Serverless Computing Iot

Serverless computing is an efficient software architecture to build applications on the cloud without having to deal with on-premise servers, virtual servers, or containers. As a computing technology, serverless is very fast, more cost-effective, and less prone to failure compared to its predecessors.

The following will provide you with a clearer understanding of serverless computing and how it is impacting the Internet of things space.

Evolution of Serverless Computing

In the beginning, there were only dedicated servers hosted in large physical data centers. Our massive dependence on data co-located in these physical servers has often caused unpredictable downtime episodes. In March 2019, for example, Facebook, WhatsApp and Instagram all went down for nearly 24 hours so that their technical teams could work on “server configuration changes.”

Serverless Computing Evolution
Evolution of Serverless Computing

The arrival of virtual servers was seen as a better way to prevent such outages, as the data could be managed through density efficiency in virtual machines (VMs) offered by a hosting provider. However, when the 2016 Dyn attacks brought down entire websites such as Paypal, GitHub, and Twitter, even this method was no longer deemed robust enough. In recent years, containers and microservices have gained popularity because they provide better density and faster startup times compared to VMs.

Serverless computing is the latest in the evolution and is currently the most advanced stage in managing computing resources.

How Serverless Computing Works

Unlike what its name implies, there are still servers involved in serverless computing. The difference lies in the way the server is run. Traditional servers are actively running and waiting for a request to come in. Power and money are wasted when the servers are underutilized. Servers in the serverless computing environment are idle and in low-power mode. They will only run when a request comes in and will go back to standby mode after the request is fulfilled.

Developers making use of serverless computing will only be charged on usage per second. When there is no request coming in, the developers won’t be charged, unlike the traditional settings where the developers have to pay for the server cost every month regardless of the number of requests.

AWS is seen as a pioneer in the serverless space and its serverless function, AWS Lambda, has been around since 2014. It is also the largest vendor in this product category.

Serverless Computing Aws Lambda 1
AWS Lambda Architecture

To build a user application in a serverless computing environment, the coder has to gain programming skills in an execution environment, which is technically called a “serverless function.” They only have to write code using a command-line interface, web, or APIs, and the serverless function takes care of the remaining tasks.

Pros and Cons of Serverless Computing

The basic premise of serverless is that the client should not have to pay for idle resources – only when the code is executed. While servers run on a sequential batch process, its capacity is limited. With serverless computing, you can run multiple processes in parallel. Therefore, the cost of running a serverless platform is lower compared to a dedicated server. It frees the client’s developers from worrying about any backend infrastructure.

A client will also prefer going serverless because it helps them achieve always-on availability of their services due to the provider’s global network of server farms. One of the disadvantages is the vendor lock-in one finds themselves in. As a developer, you are greatly dependent on the cloud provider for any upgrades on their function.

Why Serverless Computing Is Useful in IoT

While essentially different technologies, both serverless computing and the Internet of things have a lot in common because they are fairly new on the block. Should you use serverless computing for IoT applications?

It might be the case because all the leading vendors have an integral IoT component in their serverless functions. For example, AWS Lambda securely connects with AWS IoT, which means developers can create specific IoT rules for their devices to interact with AWS services. LG is one of the IoT applications which uses AWS Lambda for its intelligent “ThinQ” appliance series. Azure Functions is securely connected with Azure IoT Hub, the core platform which all Azure IoT products use.

Nest Thermostat And Lg Smart Thinq Refrigerator Protocols
LG ThinQ Appliances

Since, serverless technology uses parallel processing and serverless databases (Amazon DynamoDB is one example of such a database) ensures that the functions closest to the end device are executed on priority. This makes serverless functions a natural fit for edge computing applications.

Serverless also supports the protocols which IoT devices require in actual deployment conditions. For instance, many IoT devices with limited power, such as edge sensors, uses MQTT, a lightweight messaging protocol. All the functions including Lambda and Azure have been designed to publish to an MQTT topic.

In the IoT era, you cannot afford downtime, as there are many essential services that depend on the Web, and it will have real world consequences, which means they can come to a grinding halt. Therefore, IoT and serverless computing are a perfect combination.

Have you been fascinated by serverless technologies? Please share your views in the comments.

Image Credit: serverless

Sayak Boral Sayak Boral

IoT-addicted since early 2016. Love to explore the challenges, opportunities and trend insights into what is becoming the third wave of Internet.