Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
add WhyDelayBox.md
  • Loading branch information
Jay authored and Jay committed Sep 10, 2024
1 parent ffeb2b3 commit 94f0386
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,32 @@

**DelayBox** is a High Throughput Distributed **ONE-TIME** Task Scheduler ⚡. It is an advanced system designed to manage and execute a vast number of tasks across a distributed network of servers with **sub-second accuracy**. Built on top of the **Redis** database, it leverages Redis's high-speed in-memory data store 🔥 for quick access and efficient task management.

DelayBox utilizes ProtoBuf internally at Redis and topics.
# Why DelayBox

**DelayBox** is a concept coming from the bigger domain of scheduling and handling delays in distributed systems, mainly towards the improvement of resilience, consistency, and fault tolerance of distributed applications. It is a middleware component that can be used to buffer messages or events with the intention of creating delays to manage distributed timing issues.

## General Idea

DelayBox consists of 2 topics (`Scheduler` and `Executor`)
<p align="center">
<img src="docs/diagram2.svg" alt="Flow Architecture" />
</p>

🎨 DelayBox also includes a centralized task delay mechanism, allowing precise control over task execution timings, which is critical for workflows requiring synchronized or delayed task processing. Additionally, the system offers the flexibility to integrate with **Kafka**, enabling seamless event streaming and message queuing for enhanced data processing capabilities.
## Read more

Here’s how DelayBox can help in designing a distributed system [click hear for more.](WhyDelayBox.md)
1. Handling Eventual Consistency:
2. Update on your job application with Toast
3. Load Management and Throttling:
4. Failure Recovery and Redundancy:
5. Decoupling Components in Event-Driven Architecture:
6. Improving Reliability in Asynchronous Workflows:
7. Dealing with Temporal Anomalies:
8. Application in Geo-Distributed Systems:

🎨 One of the standout features of this application is its easy horizontal scalability, allowing it to grow and adapt to increasing workloads effortlessly by adding more servers to the network. Equipped with sophisticated algorithms for task prioritization and resource allocation, this scheduler ensures that critical tasks are executed promptly.


## General Idea

DelayBox consists of 2 topics (`Scheduler` and `Executor`)

# Use-Case

Expand Down
58 changes: 58 additions & 0 deletions WhyDelayBox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## Why DelayBox
**DelayBox** is a concept coming from the bigger domain of scheduling and handling delays in distributed systems, mainly towards the improvement of resilience, consistency, and fault tolerance of distributed applications. It is a middleware component that can be used to buffer messages or events with the intention of creating delays to manage distributed timing issues.


<p align="center">
<img src="docs/diagram2.svg" alt="Flow Architecture" />
</p>

Here’s how DelayBox can help in designing a distributed system:

### 1. Handling Eventual Consistency:

Eventual consistency is common in distributed systems, especially when working with techniques such as event sourcing or CQRS. The DelayBox can retain messages or events for some time in order to support other parts of the system or nodes in reaching a coherent state without immediately rushing into synchronization, thus reducing race conditions or data conflicts.

> **Scenario:** In a microservices architecture where services need to propagate changes across multiple services, introducing a delay can help ensure all dependent services are ready to process the incoming data, improving consistency.
### 2. Update on your job application with Toast

The distributed systems need to support the network partitioning, a situation that arises temporarily and results in the isolation of some nodes. By introducing delays in certain operations, it allows time for nodes to recover or retry instead of assuming immediate failure.

> **Scenario:** If nodes A and B lose connectivity, a DelayBox could buffer messages from node A to node B, allowing A to temporarily operate in isolation and sync up later when B becomes available.
### 3. Load Management and Throttling:

Because the DelayBox can implement controlled delays in case a system gets overwhelmed with traffic, it enables throttling and smoothing out spikes in traffic without overloading requests onto the system.

> **Scenario:** During peak hours, an e-commerce system can use a DelayBox to introduce delays in low-priority tasks, ensuring that critical transactions and customer-facing activities are prioritized.
### 4. Failure Recovery and Redundancy:

A DelayBox can introduce retries with delays between attempts in case of system failure. This may allow for the recovery of failed components or services, rather than immediately overwhelming the system with retries.

> **Scenario:** A distributed database might experience momentary unavailability. By introducing delayed retries for failed queries, you give the system more breathing room to recover without being flooded by retry requests.
### 5. Decoupling Components in Event-Driven Architecture:

In an event-driven architecture, where the various services communicate via events (say, using Kafka, RabbitMQ, etc.), DelayBox can be utilized to manage the timings of event processing transparently. Sometimes, services need to wait a bit before processing an event to give the chance to other services to finish related work.

> **Scenario:** A DelayBox could help orchestrate processing order, especially in event streams where some operations might depend on the completion of others, reducing the likelihood of out-of-order processing.
### 6. Improving Reliability in Asynchronous Workflows:

DelayBox could ensure, in asynchronous workflows, that tasks are postponed until all prerequisites have been met. This enhances the reliability and coordination within the task execution. This could be critical in distributed workflows, such as Saga patterns or orchestration of transactions.

> **Scenario:** In a distributed payment system where multiple services need to confirm the availability of funds before finalizing a transaction, a DelayBox can help synchronize confirmations by introducing small delays before triggering the final commit.
### 7. Dealing with Temporal Anomalies:

Distributed systems often encounter temporal abnormality such as clock skews or different parts of the system operating with different latencies. A DelayBox can add delays to help align the timing of various components.

> **Scenario:** In a real-time analytics system, DelayBox could hold events until all necessary data streams are synchronized, preventing mismatched timestamps or out-of-order data.
### 8. Application in Geo-Distributed Systems:

Network latency is usually not constant for distributed systems over geographically spread-out regions. The DelayBox can help mitigate such unpredictable latency, or network jitter, by holding on to operations for a moment until a certain condition is reached and thus help enhance the consistency in performance.

> **Scenario:** In a geo-distributed database, introducing delays via DelayBox ensures that read replicas are consistent across regions before responding to read requests, enhancing the user experience.

0 comments on commit 94f0386

Please sign in to comment.