Skip to content

Ease of Serverless and Flexibility of Event Driven Architecture

Posted on:June 22, 2023 at 08:17 AM

BizChat, an emerging player in the business communication landscape, recently hit a remarkable milestone. The platform successfully served 5,000 messages without incurring any costs by leveraging the power of serverless computing and event-driven architecture. This blog post will explore how BizChat accomplished this feat and what this means for the future of cost-effective, scalable communication platforms.

Understanding the Basics

Serverless Computing

Serverless computing is a cloud-computing execution model where the cloud provider dynamically allocates resources to execute a piece of code. The term “serverless” is somewhat of a misnomer – there are still servers involved, but the responsibility of server management is handled by the cloud provider. This model allows developers to focus on writing code without worrying about infrastructure management.

Event-Driven Architecture

Event-Driven Architecture (EDA) is a software design pattern where the flow of the program is determined by events such as user actions, sensor outputs, or messages from other programs. In EDA, a piece of software sends events to which another piece of software reacts. This architecture is well-suited for applications where scalability and responsiveness are critical.

Why Serverless and Event-Driven Architecture

There are two main reasons why we chose to use a serverless and event-driven architecture:

  1. Handling Unpredictable Workloads: Our workload is highly unpredictable as we cannot anticipate when our clients will receive a large volume of messages - something that is also beyond our control. Serverless architecture is ideal for such scenarios as it can automatically scale based on the workload. This means that during periods of high traffic, additional resources are allocated automatically to handle the load. Conversely, during periods of low traffic, resources are scaled back, ensuring cost-effectiveness.

  2. Ease of Supporting New Integrations: Our aim was to make it easy to support new integrations. By segregating responsibilities using a queue-based system, we have created an architecture that is modular and extensible. This modular approach means that we can easily add support for new integrations without impacting the existing system. Moreover, thanks to the queue-based architecture, we are not limited in the number of integrations we can support. The system can continue to scale and accommodate any number of integrations with ease.

By combining serverless computing with an event-driven architecture, we have built a system that is not only scalable and cost-effective but also extensible and capable of handling an unlimited number of integrations. This ensures that as our clients’ needs grow and evolve, our system is well-equipped to handle them.

How BizChat Implemented Serverless and Event-Driven Architecture

v1 architecture

Layers include Lambda functions that interact with a queue.

Using a queue helps in decoupling the responsibilities of each component.

  1. When a message is sent from any integration, it first reaches the Integrations Layer.
  2. The data within this message is then transformed into a format that the Slack layer can process, and it is enqueued in the To Slack queue.
  3. he Slack Layer, which houses the business logic needed for routing, dequeues the data. It then delivers the message to the appropriate Slack Team and Channel based on the processed data.
  4. The same process is utilized in reverse when a message is received from Slack.
  5. The Slack layer transforms the message into a format that the Integrations layer can understand and places it in the To Integrations queue.
  6. Upon dequeuing the message, the Integrations layer can execute the necessary business logic and route the message to the relevant integration.

This architecture effectively decouples the components, ensuring that each layer has a single responsibility, and improves the maintainability and scalability of the system. Lambda functions facilitate this process by acting as serverless compute services that process the data as it moves through the layers.

BizChat’s accomplishment of serving 5,000 messages for $0 is a testament to the power of serverless computing and event-driven architecture. This approach not only minimizes costs but also allows for a focus on core product development. Businesses looking to build scalable and cost-effective applications should consider leveraging these technologies.

The caveat to consider is that serverless can actually be more expensive for scenarios where there is a consistently high and predictable load.

After all, choosing a software architecture is often about weighing the trade-offs, isn’t it?