16 #ifndef SCHEDULING_ADMISSION_CONTROLLER_H
17 #define SCHEDULING_ADMISSION_CONTROLLER_H
23 #include <boost/unordered_map.hpp>
24 #include <boost/unordered_set.hpp>
25 #include <boost/thread/mutex.hpp>
84 const std::string& backend_id);
199 typedef boost::unordered_set<std::string>
PoolSet;
251 std::vector<TTopicDelta>* subscriber_topic_updates);
274 void AddPoolUpdates(std::vector<TTopicDelta>* subscriber_topic_updates);
283 const int64_t mem_limit,
const QuerySchedule& schedule,
bool admit_from_queue);
288 const int64_t mem_limit,
const int64_t max_queued,
const QuerySchedule& schedule);
298 #endif // SCHEDULING_ADMISSION_CONTROLLER_H
InternalQueue< QueueNode > RequestQueue
IntCounter * local_rejected
PerBackendPoolStatsMap per_backend_pool_stats_map_
void HandleTopicUpdates(const std::vector< TTopicItem > &topic_updates)
IntGauge * local_mem_estimate
The sum of planner memory estimates for requests that were started locally.
Promise< bool > is_admitted
void UpdatePoolStats(const StatestoreSubscriber::TopicDeltaMap &incoming_topic_deltas, std::vector< TTopicDelta > *subscriber_topic_updates)
Statestore subscriber callback that updates the pool stats state.
IntGauge * local_num_running
The total number of queries currently running that were initiated locally.
IntCounter * local_queued
void HandleTopicDeletions(const std::vector< std::string > &topic_deletions)
boost::scoped_ptr< Thread > dequeue_thread_
Thread dequeuing and admitting queries.
IntCounter * local_admitted
RequestQueueMap request_queue_map_
class SimpleMetric< int64_t, TMetricKind::COUNTER > IntCounter
MetricGroups may be organised hierarchically as a tree.
IntGauge * cluster_in_queue
The estimated total number of requests currently queued across the cluster.
Status ReleaseQuery(QuerySchedule *schedule)
IntGauge * local_mem_usage
The total amount of memory used by this pool locally.
boost::unordered_map< std::string, PoolMetrics > PoolMetricsMap
Map of pool names to pool metrics.
const std::string backend_id_
Unique id for this impalad, used to construct topic keys.
static const std::string IMPALA_REQUEST_QUEUE_TOPIC
boost::condition_variable dequeue_cv_
void UpdateLocalMemUsage(const std::string &pool_name)
QueueNode(const QuerySchedule &query_schedule)
void DequeueLoop()
Dequeues and admits queued queries when notified by dequeue_cv_.
IntGauge * cluster_mem_estimate
The sum of planner memory estimates for requests across the cluster.
boost::unordered_set< std::string > PoolSet
A set of pool names.
PoolConfigMap pool_config_cache_
ThriftSerializer thrift_serializer_
Serializes/deserializes TPoolStats when sending and receiving topic updates.
IntGauge * cluster_mem_usage
Approximate total amount of memory used by this pool across the cluster.
Status AdmitQuery(QuerySchedule *schedule)
void AddPoolUpdates(std::vector< TTopicDelta > *subscriber_topic_updates)
boost::unordered_map< std::string, TPoolStats > PoolStatsMap
Map of pool names to pool statistics.
std::map< Statestore::TopicId, TTopicDelta > TopicDeltaMap
A TopicDeltaMap is passed to each callback. See UpdateCallback for more details.
boost::unordered_map< std::string, RequestQueue > RequestQueueMap
Map of pool names to request queues.
Status RejectRequest(const std::string &pool, const int64_t max_requests, const int64_t mem_limit, const int64_t max_queued, const QuerySchedule &schedule)
bool done_
If true, tear down the dequeuing thread. This only happens in unit tests.
IntGauge * cluster_num_running
Status CanAdmitRequest(const std::string &pool, const int64_t max_requests, const int64_t mem_limit, const QuerySchedule &schedule, bool admit_from_queue)
T must be a subclass of InternalQueue::Node.
IntGauge * local_in_queue
The total number of requests currently queued locally.
void UpdateClusterAggregates(const std::string &pool_name)
PoolStatsMap cluster_pool_stats_
PoolSet pools_for_updates_
IntCounter * local_completed
IntCounter * local_dequeued
The total number of requests that have been dequeued locally.
RequestPoolService * request_pool_service_
boost::unordered_map< std::string, PoolStatsMap > PerBackendPoolStatsMap
boost::mutex admission_ctrl_lock_
PoolMetrics * GetPoolMetrics(const std::string &pool_name)
AdmissionController(RequestPoolService *request_pool_service, MetricGroup *metrics, const std::string &backend_id)
MetricGroup * metrics_
Metrics subsystem access.
Status Init(StatestoreSubscriber *subscriber)
Registers with the subscription manager.
IntCounter * local_timed_out
The total number of requests that timed out while waiting for admission locally.
PoolMetricsMap pool_metrics_map_
const QuerySchedule & schedule
IntCounter * local_time_in_queue_ms
boost::unordered_map< std::string, TPoolConfigResult > PoolConfigMap
PoolStatsMap local_pool_stats_