IP Library › Granted Patent US 11,221,883
Granted Patent B2
US 11,221,883 · App. 16/738,814 · Granted Jan 11, 2022

Hierarchical scheduler

Inventors: David Tyler Bischel (San Jose, CA); Sam Nguyen (Bothell, WA); Timothy Jenkins (Riverside, CA); Vyacheslav Kim (Anaheim, CA); Eric Yongjun Choi (Yorba Linda, CA); Isaac Saldana (Irvine, CA)
Assignee: Twilio Inc.
G06F9/5027G06F9/4881
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,221,883
App. No.
16/738,814
Granted
Jan 11, 2022
Kind
B2
Abstract

Methods, systems, and computer programs are directed to the implementation of configurable hierarchical schedulers with multiple levels, where each level may use one of several types of queueing mechanisms. A configurable, hierarchical scheduler is designed to handle large scale processing of requests (e.g., transmitting outgoing messages). The hierarchical scheduler distributes the loads to different queues handling different types of messages (e.g., by user ID, by Internet Address (IP), by schedule). The different layers of the hierarchical scheduler are configurable to queue and schedule traffic based on many factors, such as IP address, handling reputation, available downstream bandwidth, fairness, concurrency rates to handle multiple constraints, scheduling per client, time of delivery constrains, rate limits per user, domain scheduling per user, concurrency throttling per outbound channel, and sharing global rate limits across service processors.

Claims (46)

1. A method comprising:

accessing, by one or more processors, a configuration file defining a hierarchy of queues for holding messages, wherein the configuration file defines a type of each queue from the hierarchy of queues, the type of each queue being configurable from a heap queue, a round-robin queue, a rate-limit queue, a concurrency queue, and a worker-concurrency queue;

creating, by the one or more processors, a hierarchical scheduler based on the hierarchy of queues defined in the configuration file;

receiving, by the hierarchical scheduler, enqueue requests to queue messages from one or more producers;

enqueueing, by the hierarchical scheduler, each message of the enqueue requests into a respective one of the queues from the hierarchy of queues based on the respective enqueue request and the hierarchy of queues;

receiving, by the hierarchical scheduler, a dequeue request from a consumer, wherein the dequeue request includes constraints associated with messages desired by the consumer, the constraints including one of a count on a number of messages to be dequeued, an expiration time, a visibility timeout, and a consumer identifier;

selecting, by the hierarchical scheduler, a message from one of the queues from the hierarchy of queues based on the dequeue request; and

sending, by the hierarchical scheduler, the selected message to the consumer.

2. The method as recited in claim 1 , wherein the rate-limit queue enforces rate limits on an amount of messages that can be processed per period of time.

3. The method as recited in claim 1 , wherein the heap queue is a leaf node in the hierarchy of queues for storing messages until ready to be picked up by the consumer.

4. The method as recited in claim 1 , wherein the concurrency queue enforces limits on a number of inflight messages, the inflight messages being messages that have been dequeued by the consumer or another consumer but not yet deleted from the hierarchical scheduler.

5. The method as recited in claim 1 , wherein the worker-concurrency queue enforces limits on a number of consumers active at a given time processing messages from the worker-concurrency queue.

6. The method as recited in claim 5 , wherein the worker-concurrency queue is configured for limiting a number of active connections to an email domain, each worker representing a single connection to the email domain.

7. The method as recited in claim 1 , further comprising:

detecting that an amount of time since sending the selected message to the consumer is above a predetermined amount of time; and

placing, in response to the detecting, the selected message back in the queue.

8. The method as recited in claim 1 , further comprising:

receiving a delete request for the selected message from the consumer; and

deleting the selected message from the hierarchical scheduler.

9. The method as recited in claim 1 , wherein the hierarchy of queues includes a plurality of layers in a tree-like structure.

10. A system comprising:

a memory comprising instructions; and

one or more computer processors, wherein the instructions, when executed by the one or more computer processors, cause the system to perform operations comprising:

accessing a configuration file defining a hierarchy of queues for holding messages, wherein the configuration file defines a type of each queue from the hierarchy of queues, the type of each queue being configurable from a heap queue, a round-robin queue, a rate-limit queue, a concurrency queue, and a worker-concurrency queue;

creating a hierarchical scheduler based on the hierarchy of queues defined in the configuration file;

receiving, by the hierarchical scheduler, enqueue requests to queue messages from one or more producers;

enqueueing, by the hierarchical scheduler, each message of the enqueue requests into a respective one of the queues from the hierarchy of queues based on the respective enqueue request and the hierarchy of queues;

receiving, by the hierarchical scheduler, a dequeue request from a consumer, wherein the dequeue request includes constraints associated with messages desired by the consumer, the constraints including one of a count on a number of messages to be dequeued, an expiration time, a visibility timeout, and a consumer identifier;

selecting, by the hierarchical scheduler, a message from one of the queues from the hierarchy of queues based on the dequeue request; and

sending, by the hierarchical scheduler, the selected message to the consumer.

11. The system as recited in claim 10 , wherein the rate-limit queue enforces rate limits on an amount of messages that can be processed per period of time.

12. The system as recited in claim 10 , wherein the heap queue is a leaf node in the hierarchy of queues for storing messages until ready to be picked up by the consumer.

13. The system as recited in claim 10 , wherein the concurrency queue enforces limits on a number of inflight messages, the inflight messages being messages that have been dequeued by the consumer or another consumer but not yet deleted from the hierarchical scheduler.

14. The system as recited in claim 10 , wherein the worker-concurrency queue enforces limits on a number of consumers active at a given time processing messages from the worker-concurrency queue.

15. A non-transitory machine-readable storage medium including instructions that, when executed by a machine, cause the machine to perform operations comprising:

accessing a configuration file defining a hierarchy of queues for holding messages, wherein the configuration file defines a type of each queue from the hierarchy of queues, the type of each queue being configurable from a heap queue, a round-robin queue, a rate-limit queue, a concurrency queue, and a worker-concurrency queue;

creating a hierarchical scheduler based on the hierarchy of queues defined in the configuration file;

receiving, by the hierarchical scheduler, enqueue requests to queue messages from one or more producers;

enqueueing, by the hierarchical scheduler, each message of the enqueue requests into a respective one of the queues from the hierarchy of queues based on the respective enqueue request and the hierarchy of queues;

receiving, by the hierarchical scheduler, a dequeue request from a consumer, wherein the dequeue request includes constraints associated with messages desired by the consumer, the constraints including one of a count on a number of messages to be dequeued, an expiration time, a visibility timeout, and a consumer identifier;

selecting, by the hierarchical scheduler, a message from one of the queues from the hierarchy of queues based on the dequeue request; and

sending, by the hierarchical scheduler, the selected message to the consumer.

16. The non-transitory machine-readable storage medium as recited in claim 15 , wherein the rate-limit queue enforces rate limits on an amount of messages that can be processed per period of time.

17. The non-transitory machine-readable storage medium as recited in claim 15 , wherein the heap queue is a leaf node in the hierarchy of queues for storing messages until ready to be picked up by the consumer.

18. The non-transitory machine-readable storage medium as recited in claim 15 , wherein the concurrency queue enforces limits on a number of inflight messages, the inflight messages being messages that have been dequeued by the consumer or another consumer but not yet deleted from the hierarchical scheduler.

19. The non-transitory machine-readable storage medium as recited in claim 15 , wherein the worker-concurrency queue enforces limits on a number of consumers active at a given time processing messages from the worker-concurrency queue.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 9, 2020
From: BISCHEL, DAVID TYLER; NGUYEN, SAM; JENKINS, TIMOTHY; KIM, VYACHESLAV; CHOI, ERIC YONGJUN; SALDANA, ISAAC
To: TWILIO INC.
Reel/Frame 051471/0510 →
Continuity (2)
Provisional Application 62867028 · Jun 26, 2019
Related Publication 20200409763A1 · Dec 31, 2020
Cited By (2)
US 12,288,096 US 12,289,278