Skip to content

Scheduler for Creating Cron Expressions

Chakshu Gautam edited this page Apr 11, 2022 · 9 revisions

Table of Contents

S.No Description
1. Wireframes
2. Block Diagram
3. Schemas
4. Non-Functional Estimates

Wireframes

Taken from - firebase compose notification.

  • Recurring

    • Daily Cron

      Daily Cron


    • Certain Days of a Week

      Certain Days of a Week

  • Scheduling for fixed Day and Time - one time

    Scheduling for a Certain Day


Block-Diagram

Data Flow Diagram

The UI will output a cron expression that will be sent to a scheduler with a botId. The same will be saved in the schedule table as well - which will allow us to manage the schedules and only the live ones are scheduled. This entity should allow for CRUD APIs which are standard for other entities. This will decouple creation and making it live allowing for a draft version of a schedule.

Questions

1. Why is Scheduler a new service rather than being part of uci-api?

Scheduler will be a new service based on NestJS that will manage invocations for Broadcasts, etc. This is done as a separate service rather than the existing uci-api service so

  • that there is no single point of failure and
  • single responsibility principle
  • can be used as a webhook management lego block that can be used elsewhere
  • will allow us to manage service invocations ahead of time which is not part of the uci-api which is just a controller for inbound information without any scheduling.

2. What kind of scale can we expect from this?

BullMQ has done its own benchmarks which suggest that it should be able to handle 5k requests per second but my own benchmarks suggest there would be a hit of 4-5x on this and a single instance should be able to manage 800-1000 schedule creation and start every second.


Schemas

DB Schema (1)


Non-Functional Estimates

Owners

  1. Frontend - Manoj
  2. Backend - Tanisha