mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
default max_burst
equals to max_speed
as in Throttler
This commit is contained in:
parent
d97b4f0685
commit
311db94640
@ -38,8 +38,8 @@ inflight_requests: ᴺᵁᴸᴸ
|
||||
inflight_cost: ᴺᵁᴸᴸ
|
||||
max_requests: ᴺᵁᴸᴸ
|
||||
max_cost: ᴺᵁᴸᴸ
|
||||
max_burst: ᴺᵁᴸᴸ
|
||||
max_speed: ᴺᵁᴸᴸ
|
||||
max_burst: ᴺᵁᴸᴸ
|
||||
throttling_us: ᴺᵁᴸᴸ
|
||||
tokens: ᴺᵁᴸᴸ
|
||||
```
|
||||
@ -66,7 +66,7 @@ Columns:
|
||||
- `inflight_cost` (`Nullable(Int64)`) - For `inflight_limit` nodes only. The sum of costs (e.g. bytes) of all resource requests dequeued from this node, that are currently in consumption state.
|
||||
- `max_requests` (`Nullable(Int64)`) - For `inflight_limit` nodes only. Upper limit for `inflight_requests` leading to constraint violation.
|
||||
- `max_cost` (`Nullable(Int64)`) - For `inflight_limit` nodes only. Upper limit for `inflight_cost` leading to constraint violation.
|
||||
- `max_burst` (`Nullable(Float64)`) - For `bandwidth_limit` nodes only. Upper limit for `tokens` available in token-bucket throttler.
|
||||
- `max_speed` (`Nullable(Float64)`) - For `bandwidth_limit` nodes only. Upper limit for bandwidth in tokens per second.
|
||||
- `max_burst` (`Nullable(Float64)`) - For `bandwidth_limit` nodes only. Upper limit for `tokens` available in token-bucket throttler.
|
||||
- `throttling_us` (`Nullable(Int64)`) - For `bandwidth_limit` nodes only. Total number of microseconds this node was in throttling state.
|
||||
- `tokens` (`Nullable(Float64)`) - For `bandwidth_limit` nodes only. Number of tokens currently available in token-bucket throttler.
|
||||
|
@ -79,7 +79,7 @@ graph TD
|
||||
|
||||
**Possible node types:**
|
||||
* `inflight_limit` (constraint) - blocks if either number of concurrent in-flight requests exceeds `max_requests`, or their total cost exceeds `max_cost`; must have a single child.
|
||||
* `bandwidth_limit` (constraint) - blocks if burst exceeds `max_burst` (default 0) or current bandwidth exceeds `max_speed` (0 means unlimited); must have a single child.
|
||||
* `bandwidth_limit` (constraint) - blocks if current bandwidth exceeds `max_speed` (0 means unlimited) or burst exceeds `max_burst` (by default equals `max_speed`); must have a single child.
|
||||
* `fair` (policy) - selects the next request to serve from one of its children nodes according to max-min fairness; children nodes can specify `weight` (default is 1).
|
||||
* `priority` (policy) - selects the next request to serve from one of its children nodes according to static priorities (lower value means higher priority); children nodes can specify `priority` (default is 0).
|
||||
* `fifo` (queue) - leaf of the hierarchy capable of holding requests that exceed resource capacity.
|
||||
|
@ -18,10 +18,12 @@ namespace DB
|
||||
class ThrottlerConstraint : public ISchedulerConstraint
|
||||
{
|
||||
public:
|
||||
static constexpr double default_burst_seconds = 1.0;
|
||||
|
||||
ThrottlerConstraint(EventQueue * event_queue_, const Poco::Util::AbstractConfiguration & config = emptyConfig(), const String & config_prefix = {})
|
||||
: ISchedulerConstraint(event_queue_, config, config_prefix)
|
||||
, max_burst(config.getDouble(config_prefix + ".max_burst", 0))
|
||||
, max_speed(config.getDouble(config_prefix + ".max_speed", 0))
|
||||
, max_burst(config.getDouble(config_prefix + ".max_burst", default_burst_seconds * max_speed))
|
||||
, last_update(event_queue_->now())
|
||||
, tokens(max_burst)
|
||||
{}
|
||||
@ -37,7 +39,7 @@ public:
|
||||
if (!ISchedulerNode::equals(other))
|
||||
return false;
|
||||
if (auto * o = dynamic_cast<ThrottlerConstraint *>(other))
|
||||
return max_burst == o->max_burst && max_speed == o->max_speed;
|
||||
return max_speed == o->max_speed && max_burst == o->max_burst;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,7 +139,7 @@ public:
|
||||
|
||||
std::pair<double, double> getParams() const
|
||||
{
|
||||
return {max_burst, max_speed};
|
||||
return {max_speed, max_burst};
|
||||
}
|
||||
|
||||
private:
|
||||
@ -184,8 +186,8 @@ private:
|
||||
return satisfied() && child_active;
|
||||
}
|
||||
|
||||
const double max_burst{0}; /// in tokens
|
||||
const double max_speed{0}; /// in tokens per second
|
||||
const double max_burst{0}; /// in tokens
|
||||
|
||||
EventQueue::TimePoint last_update;
|
||||
UInt64 postponed = EventQueue::not_postponed;
|
||||
|
@ -41,8 +41,8 @@ NamesAndTypesList StorageSystemScheduler::getNamesAndTypes()
|
||||
{"inflight_cost", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>())},
|
||||
{"max_requests", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>())},
|
||||
{"max_cost", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>())},
|
||||
{"max_burst", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeFloat64>())},
|
||||
{"max_speed", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeFloat64>())},
|
||||
{"max_burst", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeFloat64>())},
|
||||
{"throttling_us", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>())},
|
||||
{"tokens", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeFloat64>())},
|
||||
};
|
||||
@ -76,8 +76,8 @@ void StorageSystemScheduler::fillData(MutableColumns & res_columns, ContextPtr c
|
||||
Field inflight_cost;
|
||||
Field max_requests;
|
||||
Field max_cost;
|
||||
Field max_burst;
|
||||
Field max_speed;
|
||||
Field max_burst;
|
||||
Field throttling_us;
|
||||
Field tokens;
|
||||
|
||||
@ -101,7 +101,7 @@ void StorageSystemScheduler::fillData(MutableColumns & res_columns, ContextPtr c
|
||||
}
|
||||
if (auto * ptr = dynamic_cast<ThrottlerConstraint *>(node.get()))
|
||||
{
|
||||
std::tie(max_burst, max_speed) = ptr->getParams();
|
||||
std::tie(max_speed, max_burst) = ptr->getParams();
|
||||
throttling_us = ptr->getThrottlingDuration().count() / 1000;
|
||||
tokens = ptr->getTokens();
|
||||
}
|
||||
@ -116,8 +116,8 @@ void StorageSystemScheduler::fillData(MutableColumns & res_columns, ContextPtr c
|
||||
res_columns[i++]->insert(inflight_cost);
|
||||
res_columns[i++]->insert(max_requests);
|
||||
res_columns[i++]->insert(max_cost);
|
||||
res_columns[i++]->insert(max_burst);
|
||||
res_columns[i++]->insert(max_speed);
|
||||
res_columns[i++]->insert(max_burst);
|
||||
res_columns[i++]->insert(throttling_us);
|
||||
res_columns[i++]->insert(tokens);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user