Back in the days, developers in IT organizations would call on IT admin to administer the necessary platform or environment to build something. That means, whenever a developer wanted an environment to build software on, that developer had to make a change request call. Then the IT admin would come along and set up the required OS and software. Not only was this not flexible, but time-wasting, mainly because the IT admin would sometimes install the incorrect version of the software the developer required. Many little IT organizations still go through this trouble today.
Something needed to be done. What if developers could write code and run it without worrying about the underlying hardware, operating platform and OS. That is what this article sheds light on, What serverless computing is, how it works and how developers can leverage it, and its pros and cons.
Why Serverless Computing?
Big Tech organizations use to house their data-centers to run enterprise applications and other services. A better, efficient and cost-effective deployment model was needed to host applications without worrying about underlying the servers, software platform and OS.
To further broaden the advent of serverless computing, let’s look at some technologies that have led to it.
Enterprise applications were hosted on physical servers. That meant the applications had direct hardware running them. For efficiency and cost-effectiveness, this eventually changed to using a virtual machine that allowed for better utilization of resources. Rather than mounting direct physical servers for every application and services, a server could be split to have different guest operating systems running on host OS using a virtual machine, and then have different applications run on them. This did not only cut down the overall cost of deployment, it also cut down the time. With virtualization, developing and deploying application became a breeze, but you still had to manage the underlying hardware, software platform and OS. This brought about Containers.
Containerization is the packaging application with its dependencies so that it can run uniformly on any computing environment. it is an alternative to virtualization. unlike virtual machines, containers don’t require a lot of resources to run. Containerize apps are quicker to deploy, scale dynamically, and allows for agile Continuous Integration and Continuous Development(CI/CD). However, scalability means management, and to manage a fleet of containers and their underlying physical server is, again, not as efficient and cost-effective. An efficient and flexible deployment model as containerization was needed, but without the trouble and hassle of managing underlying resources. This idea gave birth to serverless computing.
What is Serverless Computing.
Serverless Computing is a Cloud Computing execution model that allows you to run your application code on an allocated space on a CPU and memory without worrying about the hassle and trouble of the OS, software platform, and the underlying server. Just take your code and run it!
Serverless computing is used in tandem with containers.
Using Serverless Computing.
Serverless Computing is offered as an on-demand service by public Cloud providers, such as AWS, Google Cloud Platform, Microsoft Azure, and IBM Cloud as a managed service. This where FaaS comes in.
Function as a Service (FaaS).
This means writing code as a function that performs a specific task or service on an allocated resource (RAM) required to run the code on the serverless cloud computing service. The service manages the amount of RAM and CPU cycles your code needs to run.
Pros and Cons of Serverless Computing.
Here is a list of what you can benefit from serverless computing as a developer.
No “ware” to manage: There is no software or hardware to manage in serverless computing. The management of the application, computing environment and underlying hardware is taken care of by the cloud provider.
Faster execution time: The boot-up time for an application running on serverless model instances is super fast. It is due to functions running on independent containerized platforms.
Cost-effectiveness: Service charge is based on the duration of your code and the memory it consumes. Backend functions are only called when needed by the serverless application, and the code automatically scales up as required. The duration is calculated from the time the functions begin executing to the time they terminate, and it’s rounded to the nearest 100 ms. Serverless provisioning is dynamic, precise, and real-time.
Microservice compatible. Traditionally, monolithic applications do not scale effectively, but the introduction of microservice in serverless computing has made it possible to scale at ease. Applications are broken down into small independent services designed to perform specific tasks and called when needed, rather than monolithically.
Event-driven applications: If you are building an event-driven application, then serverless functions are an ideal choice. Your application can trigger a function to start a new process or react to certain events.
Exciting, right? Well…don’t get too excited yet! There are some serverless computing cons you should be aware of before moving your code to the cloud.
- Debugging and Testing: Debugging and Testing can pose a challenge since the serverless environment can be not easily replicated to see how your code will work when deployed. Developers should not have unnecessary microservices running because they do not have visibility to the serverless backend process. Limiting microservices to what is necessary will make managing services and debugging code easy for the developer.
- Execution duration: Serverless functions run for a short duration of time. This is a limit set by most cloud providers, but there are workarounds to it.
- Stateless: Serverless functions are stateless. That means nothing is stored in memory when a function executes or terminates.
- Lack of tools: Serverless computing in all its glory still lacks support for some out-of-the-box tools for deployment, management and monitoring.
- Complexity: The more code is split into little services (microservices), the more complex they become to mange when you view the application as a whole system. Running small independent functions to perform specific tasks is good, but having too many can and will make the application complex to manage.
- vendor lock-in: This is one big problem with public cloud vendors. Cloud vendors provide their own unique set of tools, and backend services, thus increasing the developers’ reliance on the provider, it becomes hard to switch to other vendors. Even when successful, adapting to different tools and workflow becomes a challenge.
The advent of Serverless computing has brought about an efficient and cost-effective way for IT organization and developers to deploy their applications in a breeze without worrying about the maintenance of hardware and OS platforms. It has its disadvantages, but so far, the pros far outweigh cons.