Skip to content

Commit 129576f

Browse files
csgregorianxkrogen
authored andcommitted
HDFS-14403. Cost-based extension to the RPC Fair Call Queue. Contributed by Christopher Gregorian.
1 parent d023f1f commit 129576f

File tree

10 files changed

+639
-192
lines changed

10 files changed

+639
-192
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic {
106106
public static final String IPC_CALLQUEUE_IMPL_KEY = "callqueue.impl";
107107
public static final String IPC_SCHEDULER_IMPL_KEY = "scheduler.impl";
108108
public static final String IPC_IDENTITY_PROVIDER_KEY = "identity-provider.impl";
109+
public static final String IPC_COST_PROVIDER_KEY = "cost-provider.impl";
109110
public static final String IPC_BACKOFF_ENABLE = "backoff.enable";
110111
public static final boolean IPC_BACKOFF_ENABLE_DEFAULT = false;
111112

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/CallQueueManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ void addResponseTime(String name, Schedulable e, ProcessingDetails details) {
198198
}
199199

200200
// This should be only called once per call and cached in the call object
201-
// each getPriorityLevel call will increment the counter for the caller
202201
int getPriorityLevel(Schedulable e) {
203202
return scheduler.getPriorityLevel(e);
204203
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.hadoop.ipc;
20+
21+
import org.apache.hadoop.conf.Configuration;
22+
23+
/**
24+
* Used by {@link DecayRpcScheduler} to get the cost of users' operations. This
25+
* is configurable using
26+
* {@link org.apache.hadoop.fs.CommonConfigurationKeys#IPC_COST_PROVIDER_KEY}.
27+
*/
28+
public interface CostProvider {
29+
30+
/**
31+
* Initialize this provider using the given configuration, examining only
32+
* ones which fall within the provided namespace.
33+
*
34+
* @param namespace The namespace to use when looking up configurations.
35+
* @param conf The configuration
36+
*/
37+
void init(String namespace, Configuration conf);
38+
39+
/**
40+
* Get cost from {@link ProcessingDetails} which will be used in scheduler.
41+
*
42+
* @param details Process details
43+
* @return The cost of the call
44+
*/
45+
long getCost(ProcessingDetails details);
46+
}

0 commit comments

Comments
 (0)