-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HDFS-17713. [ARR] Throtting asynchronous calls for each nameservice.
- Loading branch information
1 parent
8efd978
commit 54fa4eb
Showing
5 changed files
with
237 additions
and
50 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...apache/hadoop/hdfs/server/federation/fairness/RouterAsyncRpcFairnessPolicyController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hadoop.hdfs.server.federation.fairness; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.hdfs.server.federation.router.FederationUtil; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.Set; | ||
|
||
import static org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys. | ||
DFS_ROUTER_ASYNC_RPC_MAX_ASYNCCALL_PERMIT_KEY; | ||
import static org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys. | ||
DFS_ROUTER_ASYNC_RPC_MAX_ASYNC_CALL_PERMIT_DEFAULT; | ||
|
||
public class RouterAsyncRpcFairnessPolicyController extends | ||
AbstractRouterRpcFairnessPolicyController { | ||
|
||
private static final Logger LOG = | ||
LoggerFactory.getLogger(RouterAsyncRpcFairnessPolicyController.class); | ||
|
||
public RouterAsyncRpcFairnessPolicyController(Configuration conf) { | ||
init(conf); | ||
} | ||
|
||
public void init(Configuration conf) throws IllegalArgumentException { | ||
super.init(conf); | ||
|
||
int maxAsyncCallPermit = conf.getInt(DFS_ROUTER_ASYNC_RPC_MAX_ASYNCCALL_PERMIT_KEY, | ||
DFS_ROUTER_ASYNC_RPC_MAX_ASYNC_CALL_PERMIT_DEFAULT); | ||
if (maxAsyncCallPermit <= 0) { | ||
maxAsyncCallPermit = DFS_ROUTER_ASYNC_RPC_MAX_ASYNC_CALL_PERMIT_DEFAULT; | ||
} | ||
LOG.info("Max async call permits per nameservice: {}", maxAsyncCallPermit); | ||
|
||
// Get all name services configured | ||
Set<String> allConfiguredNS = FederationUtil.getAllConfiguredNS(conf); | ||
|
||
for (String nsId : allConfiguredNS) { | ||
LOG.info("Dedicated permits {} for ns {} ", maxAsyncCallPermit, nsId); | ||
insertNameServiceWithPermits(nsId, maxAsyncCallPermit); | ||
logAssignment(nsId, maxAsyncCallPermit); | ||
} | ||
} | ||
|
||
private static void logAssignment(String nsId, int count) { | ||
LOG.info("Assigned {} permits to nsId {} ", count, nsId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.