Distributed Query Scheduling Under Memory and OOM Constraints
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing database systems face challenges in achieving predictability, high throughput, and reliability during concurrent query execution due to inaccurate scheduling, resource competition, and out-of-memory (OOM) errors, particularly in distributed environments.
Innovation Solution
A system and method for real-time scheduling that considers memory availability and network transfer times, uses a concurrency regulator to prioritize queries, employs a retry handler to handle OOM errors, and implements stride scheduling for fair resource allocation across queries.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If queries are executed concurrently to improve throughput, then productivity increases, but reliability deteriorates due to out-of-memory errors from resource competition
Solution Approach 1:
The system dynamically adjusts the degree of concurrency based on current memory availability and query characteristics. The concurrency regulator continuously monitors system state and adapts the scheduling strategy, transitioning between more aggressive concurrent execution when resources are abundant and more conservative execution when memory pressure is high, thus maintaining both throughput and reliability
Solution Approach 2:
The system performs preliminary actions by estimating memory requirements and execution times before query submission. The concurrency regulator evaluates predicted memory usage and schedules queries in advance to prevent OOM errors, while the retry handler proactively prepares retry strategies for queries that may fail due to memory constraints
2Reliability
If serialization is used to improve reliability by executing queries in isolation, then reliability improves, but productivity deteriorates due to reduced throughput
Solution Approach 1:
Instead of fully serializing all queries, the system applies partial concurrency by allowing multiple queries to execute simultaneously when memory resources permit. The concurrency regulator selectively permits concurrent execution for queries with compatible memory requirements, achieving partial parallelism that maintains reliability while improving throughput beyond complete serialization
Solution Approach 2:
The concurrency regulator acts as an intermediary between the query submission interface and the execution engine. It mediates concurrent query requests by evaluating system state, making intelligent scheduling decisions that balance reliability and throughput, and coordinating query execution to prevent OOM errors while maximizing resource utilization
3Loss of time
If priority queue scheduling is used to improve predictability for short-running queries, then predictability improves, but productivity deteriorates due to underutilization of system resources
Solution Approach 1:
The system changes scheduling parameters dynamically based on query characteristics and system state. Instead of using a fixed priority scheme, the concurrency regulator adjusts scheduling priorities, time quotas, and concurrency levels according to query type, estimated execution time, and current memory availability, thereby improving predictability for interactive queries while maintaining high resource utilization
Solution Approach 2:
The system implements periodic scheduling actions where the concurrency regulator periodically evaluates system state and adjusts query scheduling decisions. This periodic reassessment allows short-running queries to receive timely execution slots while ensuring that system resources are continuously optimized for overall throughput, preventing both starvation and resource underutilization
Data Source
AI summary
Techniques for real-time scheduling for distributed query processing are provided. In one technique, a global counter and multiple local counters are stored, each local counter corresponding to a different query of multiple queries. Each query is scheduled based on the multiple local counters and the global counter. In response to determining that a particular query is waiting for data to arrive at a computing node, a first current value of the global counter is stored in association with the particular query. In response to determining that the data has arrived at the computing node: a current value of the global counter is identified; a difference between the second current value and the first current value is determined; and a current value of the local counter of the particular query is updated based on the difference.


