Say goodbye to infrastructure worries and hello to seamless, efficient development. This Webinar was conducted on 20th January 2024 by our Software Engineer, Durgesh Pawar, where he talked about Serverless Architecture. He explained how, in Serverless Architecture, the cloud provider automatically handles the infrastructure, allowing developers to focus solely on code implementation and application functionality.

What you will learn

  • What is Serverless architecture?
  • Key Components
  • How does a serverless architecture work?
  • Benefits & Advantages
  • Limitations
  • References

What is a Server?

Server is a Software/Hardware device which provides functionality for clients which are programs or devices.

Components:

  1. Hardware ( CPU, Memory, Storage device..etc )
  2. Server OS ( Windows, Linux..etc )
  3. Network Connectivity
  4. Management and Monitoring tools (uptime, dependability)
  5. High Availability Features

What does Serverless actually mean?

  • Does serverless mean a system without server? Is it so?
  • Absolutely not! There is always a server which processes your requests and will generate a response but in reality, you don’t have to manage or configure, it will be managed by third party service providers.
  • It allows the user to build and run applications without worrying about the server as the cloud provider manages them.
  • In serverless architecture, the application is deployed as a function. It is event driven, responding to the events and triggers such as Http request, File uploads etc.
  • E.g Aws lambda, Microsoft Azure function, Google Cloud function

Key Components :

1. FAAS (Function As A Service):
  • It is the building block of serverless architecture, responsible for executing logic that determines how resources are allocated in a given scenario.
  • Serverless Computing supports microservices (Small independent services)
  • These are event based functions that uses triggers to execute logic and generate response.
2. Client Interface:
  • The Interface must be able to Support Spurts of requests, Stateless (No record of previous interaction) and Flexible Interaction.
  • Interface must also be designed to be compatible with extremely high/low volume data transfers.
3. A Web Server On Cloud:
  • It is where the stateless interaction will be initiated after the user starts it and before the FAAS service terminates it.
  • Web Server is distinct from backend DB where information delivered to the user is stored.
4. A Security Service:
  • The application handles thousands of concurrent requests. Each request has to be authenticated before sending the response.
  • Due to its stateless nature, the past interaction isn’t stored . The application cannot fall back on previous interaction to validate future ones.
  • The distributed nature of serverless architecture means that there are multiple services and vendors involved.
  • We can integrate Serverless Identity and management service into our app e.g AWS Cognito
5. Backend Service ( Database ):
  • Backend Database is where information to be shared with user is stored.
  • Typically Developer uses backend as a service provider to further cut down maintenance and admin efforts.
  • It is compatible with FaaS offerings
6. API GateWay:
  • The API gateway connects FaaS and Client interface. It is a communication layer between client interface and FaaS.
  • It maps REST (Representational State transfer) endpoints with respective functions that run the business logic.

How does Serverless model work?

  • The Developer builds an application that includes function that will determine how application responds to a particular user action .
  • An event is defined as to how and when the function will be triggered. For eg, the user initiates HTTP request, application may want to fetch and deliver data. This “if-then” process is called an event.
  • Once the application is deployed and accessible to the user, the event is triggered through the user action.
  • The application relays the event to the cloud provider, and the provider dynamically allocates the resources necessary to respond to the user action as per predefined function.
  • The user receives the data or any other results as defined by the function.

Benefits :

  1. Greater flexibility (In terms of deploying and maintaining code)
  2. Reduces Cost as pricing is ‘pay as you go’.
  3. Amplified Scalability (Auto scaling and descaling upto 0 when no one requests your function. )
  4. Better Productivity ( As developer is not concerned about maintaining, configuring infrastructure so he/she can focus on implementing business logic and beautiful UI/UX designs.)
  5. High Availability (Ensures high uptime)
  6. Real time Data updates and transfers
  7. Unit Testing is easier

Limitations :

  1. Cold Start: Occurs when services experience latency during their initial request after a restart or deployment as function gets inactive if no request is there.
  2. Vendor lock-in: As you don’t have any control on server infrastructure, it creates tight coupling between application code and serverless vender as moving to new vendor is costlier.
  3. Less cost effective for long processes. ( Billed for code run time)
  4. Integration testing is difficult.