Resource Token Queues for Service Thread Throughput

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing Web service and RPC systems face performance issues due to blocking of service threads while waiting for downstream services, database connections, or other constrained resources, leading to reduced throughput and increased complexity when addressing resource unavailability or slowness.

Innovation Solution

Implementing a system with multiple resource queues and service request queues, where requests collect resource tokens from token buckets based on dependencies, allowing prioritization and dynamic allocation of constrained resources, and employing a stochastic fair queuing algorithm to manage requests effectively during traffic spikes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If service threads wait for constrained resources (downstream services, database connections, I/O channels), then the service can complete its work correctly, but the service threads become blocked and throughput decreases

Engineering Contradiction:
Improveservice completionVSAvoidthroughput
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system performs preliminary actions by pre-allocating resource tokens to service requests before they actually need the resources. Token buckets are pre-configured with tokens representing available constrained resources, and requests collect tokens in advance as they move through the queueing system, preventing blocking when resources are needed for actual service execution.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The service system is segmented into multiple independent queues (resource queues, service request queues) that operate separately. Each queue manages specific resource types or service categories independently, allowing different segments of the system to progress without being blocked by bottlenecks in other segments. This is implemented through separate token buckets and queueing structures for different resource types.

Inventive Principle:
Principle #1Segmentation

2Reliability

If asynchronous I/O mechanisms and timeouts are added to handle resource unavailability, then service blocking is reduced, but system complexity increases and throughput significantly decreases

Engineering Contradiction:
Improveresource availability handlingVSAvoidservice implementation complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

Token buckets serve as intermediary structures between service requests and constrained resources. Instead of directly managing complex asynchronous I/O operations and timeout logic, the system uses token buckets as mediators that abstract resource availability into simple token possession. Requests interact with the token bucket interface rather than directly with downstream services, database connections, or I/O channels, simplifying the service implementation.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system implements self-service through automatic token management. Token buckets automatically refill based on observed system performance and resource availability, without requiring manual intervention or complex control logic. The admission control subsystem automatically monitors queue lengths and performance metrics, dynamically adjusting token allocation to maintain optimal throughput while preventing blocking.

Inventive Principle:
Principle #25Self-service

3Reliability

If admission control throttling is used to prevent too many requests, then resource overload is avoided, but throughput is significantly reduced

Engineering Contradiction:
Improveresource overload preventionVSAvoidthroughput
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The admission control system is dynamic rather than static. Token bucket capacities and refill rates are not fixed but are continuously adjusted based on observed system performance, queue lengths, and resource availability. This dynamic adaptation allows the system to maximize throughput during periods of resource availability while automatically preventing overload when resources are constrained, eliminating the need for conservative static throttling.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system implements feedback loops where performance metrics and resource availability information are continuously monitored and fed back to the token bucket management. The admission control subsystem observes queue lengths, service completion rates, and resource response times, then adjusts token allocation accordingly. This feedback mechanism enables the system to maintain high throughput when resources are available while automatically reducing admission when resources are constrained, without requiring manual throttling configuration.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS9385963B1System and method for allocating resources for heterogeneous service requests
Publication Date: 2016.07.05 AMAZON TECH INC
  • US9385963B1 patent drawing
  • US9385963B1 patent drawing
  • US9385963B1 patent drawing

AI summary

A system for allocating constrained resources (e.g., downstream services, execution threads, database connections, input/output channels, computational resources, and/or memory) to requested services that are dependent on those resources may include multiple resource queues, each of which maintains a queue of requests for a respective constrained resource, and multiple service request queues, from which requests may be subsequently serviced. As each request reaches the head of a resource queue, it may receive a resource token for a respective constrained resource. Once the request has collected resource tokens for each of the constrained resources on which it depends, the request may be passed to a service request queue that maintains a queue of requests of a particular type. Requests in the multiple service request queues may be serviced on a round-robin or weighted round-robin basis. The number of tokens available for each constrained resource may be modified based on observed system performance.