28 using namespace impala;
30 DEFINE_string(fair_scheduler_allocation_path,
"",
"Path to the fair scheduler "
31 "allocation file (fair-scheduler.xml).");
32 DEFINE_string(llama_site_path,
"",
"Path to the Llama configuration file "
33 "(llama-site.xml). If set, fair_scheduler_allocation_path must also be set.");
39 DEFINE_int64(default_pool_max_requests, 200,
"Maximum number of concurrent outstanding "
40 "requests allowed to run before queueing incoming requests. A negative value "
41 "indicates no limit. 0 indicates no requests will be admitted. Ignored if "
42 "fair_scheduler_config_path and llama_site_path are set.");
43 DEFINE_string(default_pool_mem_limit,
"",
"Maximum amount of memory that all "
44 "outstanding requests in this pool may use before new requests to this pool"
45 " are queued. Specified as a number of bytes ('<int>[bB]?'), megabytes "
46 "('<float>[mM]'), gigabytes ('<float>[gG]'), or percentage of the physical memory "
47 "('<int>%'). 0 or not setting indicates no limit. Defaults to bytes if no unit is "
48 "given. Ignored if fair_scheduler_config_path and llama_site_path are set.");
49 DEFINE_int64(default_pool_max_queued, 200,
"Maximum number of requests allowed to be "
50 "queued before rejecting requests. A negative value or 0 indicates requests "
51 "will always be rejected once the maximum number of concurrent requests are "
52 "executing. Ignored if fair_scheduler_config_path and "
53 "llama_site_path are set.");
56 DEFINE_bool(disable_pool_mem_limits,
false,
"Disables all per-pool mem limits.");
57 DEFINE_bool(disable_pool_max_requests,
false,
"Disables all per-pool limits on the "
58 "maximum number of running requests.");
68 metrics_(metrics), resolve_pool_ms_metric_(NULL) {
73 if (FLAGS_fair_scheduler_allocation_path.empty() &&
74 FLAGS_llama_site_path.empty()) {
75 if (FLAGS_enable_rm) {
76 LOG(ERROR) <<
"If resource management is enabled, -fair_scheduler_allocation_path "
85 if (bytes_limit < 0) {
86 LOG(ERROR) <<
"Unable to parse default pool mem limit from '"
87 << FLAGS_default_pool_mem_limit <<
"'.";
91 if (bytes_limit == 0) {
102 {
"<init>",
"(Ljava/lang/String;Ljava/lang/String;)V", &
ctor_},
103 {
"start",
"()V", &start_id},
109 jni_env->FindClass(
"com/cloudera/impala/util/RequestPoolService");
111 uint32_t num_methods =
sizeof(methods) /
sizeof(methods[0]);
112 for (
int i = 0; i < num_methods; ++i) {
117 jstring fair_scheduler_config_path =
118 jni_env->NewStringUTF(FLAGS_fair_scheduler_allocation_path.c_str());
120 jstring llama_site_path =
121 jni_env->NewStringUTF(FLAGS_llama_site_path.c_str());
125 fair_scheduler_config_path, llama_site_path);
134 const string& user, TResolveRequestPoolResult* resolved_pool) {
137 resolved_pool->__set_has_access(
true);
141 TResolveRequestPoolParams params;
142 params.__set_user(user);
143 params.__set_requested_pool(requested_pool_name);
147 params, resolved_pool);
153 TPoolConfigResult* pool_config) {
155 pool_config->__set_max_requests(
156 FLAGS_disable_pool_max_requests ? -1 : FLAGS_default_pool_max_requests);
157 pool_config->__set_mem_limit(
159 pool_config->__set_max_queued(FLAGS_default_pool_max_queued);
163 TPoolConfigParams params;
164 params.__set_pool(pool_name);
167 if (FLAGS_disable_pool_max_requests) pool_config->__set_max_requests(-1);
168 if (FLAGS_disable_pool_mem_limits) pool_config->__set_mem_limit(-1);
RequestPoolService(MetricGroup *metrics)
Status GetPoolConfig(const std::string &pool_name, TPoolConfigResult *pool_config)
DEFINE_int64(default_pool_max_requests, 200,"Maximum number of concurrent outstanding ""requests allowed to run before queueing incoming requests. A negative value ""indicates no limit. 0 indicates no requests will be admitted. Ignored if ""fair_scheduler_config_path and llama_site_path are set.")
jobject request_pool_service_
Instance of com.cloudera.impala.util.RequestPoolService.
#define RETURN_IF_ERROR(stmt)
some generally useful macros
static Status LoadJniMethod(JNIEnv *jni_env, const jclass &jni_class, JniMethodDescriptor *descriptor)
M * RegisterMetric(M *metric)
static int64_t physical_mem()
Get total physical memory in bytes (ignores cgroups memory limits).
int64_t default_pool_mem_limit_
MetricGroups may be organised hierarchically as a tree.
jmethodID get_pool_config_id_
static int64_t ParseMemSpec(const std::string &mem_spec_str, bool *is_percent, int64_t relative_reference)
DEFINE_string(fair_scheduler_allocation_path,"","Path to the fair scheduler ""allocation file (fair-scheduler.xml).")
StatsMetric< double > * resolve_pool_ms_metric_
Metric measuring the time ResolveRequestPool() takes, in milliseconds.
static Status LocalToGlobalRef(JNIEnv *env, jobject local_ref, jobject *global_ref)
MetricGroup * metrics_
Metrics subsystem access.
DEFINE_bool(disable_pool_mem_limits, false,"Disables all per-pool mem limits.")
void Update(const T &value)
#define EXIT_IF_ERROR(stmt)
int64_t MonotonicMillis()
const string RESOLVE_POOL_METRIC_NAME
jclass request_pool_service_class_
Describes one method to look up in a Java object.
Status ResolveRequestPool(const std::string &requested_pool_name, const std::string &user, TResolveRequestPoolResult *resolved_pool)
const string DEFAULT_POOL_NAME
static Status CallJniMethod(const jobject &obj, const jmethodID &method, const T &arg)
jmethodID resolve_request_pool_id_
JNIEnv * getJNIEnv(void)
C linkage for helper functions in hdfsJniHelper.h.