hadoop/hadoop-project-dist/hadoop-common/FairCallQueue.html

714 lines
43 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
| Generated by Apache Maven Doxia at 2023-03-25
| Rendered using Apache Maven Stylus Skin 1.5
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Apache Hadoop 3.4.0-SNAPSHOT &#x2013; Fair Call Queue Guide</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta name="Date-Revision-yyyymmdd" content="20230325" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="composite">
<div id="banner">
<a href="http://hadoop.apache.org/" id="bannerLeft">
<img src="http://hadoop.apache.org/images/hadoop-logo.jpg" alt="" />
</a>
<a href="http://www.apache.org/" id="bannerRight">
<img src="http://www.apache.org/images/asf_logo_wide.png" alt="" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xright"> <a href="http://wiki.apache.org/hadoop" class="externalLink">Wiki</a>
|
<a href="https://gitbox.apache.org/repos/asf/hadoop.git" class="externalLink">git</a>
|
<a href="http://hadoop.apache.org/" class="externalLink">Apache Hadoop</a>
&nbsp;| Last Published: 2023-03-25
&nbsp;| Version: 3.4.0-SNAPSHOT
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>General</h5>
<ul>
<li class="none">
<a href="../../index.html">Overview</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/SingleCluster.html">Single Node Setup</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/ClusterSetup.html">Cluster Setup</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/CommandsManual.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/FileSystemShell.html">FileSystem Shell</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Compatibility.html">Compatibility Specification</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/DownstreamDev.html">Downstream Developer's Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/AdminCompatibilityGuide.html">Admin Compatibility Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/InterfaceClassification.html">Interface Classification</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/filesystem/index.html">FileSystem Specification</a>
</li>
</ul>
<h5>Common</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/CLIMiniCluster.html">CLI Mini Cluster</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/FairCallQueue.html">Fair Call Queue</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/NativeLibraries.html">Native Libraries</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Superusers.html">Proxy User</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/RackAwareness.html">Rack Awareness</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/SecureMode.html">Secure Mode</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/ServiceLevelAuth.html">Service Level Authorization</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/HttpAuthentication.html">HTTP Authentication</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/CredentialProviderAPI.html">Credential Provider API</a>
</li>
<li class="none">
<a href="../../hadoop-kms/index.html">Hadoop KMS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Tracing.html">Tracing</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/UnixShellGuide.html">Unix Shell Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/registry/index.html">Registry</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/AsyncProfilerServlet.html">Async Profiler</a>
</li>
</ul>
<h5>HDFS</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsDesign.html">Architecture</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html">User Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSCommands.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html">NameNode HA With QJM</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithNFS.html">NameNode HA With NFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ObserverNameNode.html">Observer NameNode</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/Federation.html">Federation</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ViewFs.html">ViewFs</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ViewFsOverloadScheme.html">ViewFsOverloadScheme</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsSnapshots.html">Snapshots</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsEditsViewer.html">Edits Viewer</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsImageViewer.html">Image Viewer</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html">Permissions and HDFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsQuotaAdminGuide.html">Quotas and HDFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/LibHdfs.html">libhdfs (C API)</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/WebHDFS.html">WebHDFS (REST API)</a>
</li>
<li class="none">
<a href="../../hadoop-hdfs-httpfs/index.html">HttpFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ShortCircuitLocalReads.html">Short Circuit Local Reads</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/CentralizedCacheManagement.html">Centralized Cache Management</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsNfsGateway.html">NFS Gateway</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsRollingUpgrade.html">Rolling Upgrade</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html">Extended Attributes</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/TransparentEncryption.html">Transparent Encryption</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsMultihoming.html">Multihoming</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ArchivalStorage.html">Storage Policies</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/MemoryStorage.html">Memory Storage Support</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/SLGUserGuide.html">Synthetic Load Generator</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSErasureCoding.html">Erasure Coding</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSDiskbalancer.html">Disk Balancer</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsUpgradeDomain.html">Upgrade Domain</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsDataNodeAdminGuide.html">DataNode Admin</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs-rbf/HDFSRouterFederation.html">Router Federation</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsProvidedStorage.html">Provided Storage</a>
</li>
</ul>
<h5>MapReduce</h5>
<ul>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html">Tutorial</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredCommands.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduce_Compatibility_Hadoop1_Hadoop2.html">Compatibility with 1.x</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/EncryptedShuffle.html">Encrypted Shuffle</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/PluggableShuffleAndPluggableSort.html">Pluggable Shuffle/Sort</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/DistributedCacheDeploy.html">Distributed Cache Deploy</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/SharedCacheSupport.html">Support for YARN Shared Cache</a>
</li>
</ul>
<h5>MapReduce REST APIs</h5>
<ul>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredAppMasterRest.html">MR Application Master</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-hs/HistoryServerRest.html">MR History Server</a>
</li>
</ul>
<h5>YARN</h5>
<ul>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YARN.html">Architecture</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YarnCommands.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/CapacityScheduler.html">Capacity Scheduler</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/FairScheduler.html">Fair Scheduler</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRestart.html">ResourceManager Restart</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerHA.html">ResourceManager HA</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceModel.html">Resource Model</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeLabel.html">Node Labels</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeAttributes.html">Node Attributes</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/WebApplicationProxy.html">Web Application Proxy</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html">Timeline Server</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html">Timeline Service V.2</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html">Writing YARN Applications</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YarnApplicationSecurity.html">YARN Application Security</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeManager.html">NodeManager</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/DockerContainers.html">Running Applications in Docker Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/RuncContainers.html">Running Applications in runC Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeManagerCgroups.html">Using CGroups</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/SecureContainer.html">Secure Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ReservationSystem.html">Reservation System</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/GracefulDecommission.html">Graceful Decommission</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/OpportunisticContainers.html">Opportunistic Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/Federation.html">YARN Federation</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/SharedCache.html">Shared Cache</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/UsingGpus.html">Using GPU</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/UsingFPGA.html">Using FPGA</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/PlacementConstraints.html">Placement Constraints</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YarnUI2.html">YARN UI2</a>
</li>
</ul>
<h5>YARN REST APIs</h5>
<ul>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/WebServicesIntro.html">Introduction</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html">Resource Manager</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeManagerRest.html">Node Manager</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html#Timeline_Server_REST_API_v1">Timeline Server</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html#Timeline_Service_v.2_REST_API">Timeline Service V.2</a>
</li>
</ul>
<h5>YARN Service</h5>
<ul>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/Overview.html">Overview</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/QuickStart.html">QuickStart</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/Concepts.html">Concepts</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/YarnServiceAPI.html">Yarn Service API</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/ServiceDiscovery.html">Service Discovery</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/SystemServices.html">System Services</a>
</li>
</ul>
<h5>Hadoop Compatible File Systems</h5>
<ul>
<li class="none">
<a href="../../hadoop-aliyun/tools/hadoop-aliyun/index.html">Aliyun OSS</a>
</li>
<li class="none">
<a href="../../hadoop-aws/tools/hadoop-aws/index.html">Amazon S3</a>
</li>
<li class="none">
<a href="../../hadoop-azure/index.html">Azure Blob Storage</a>
</li>
<li class="none">
<a href="../../hadoop-azure-datalake/index.html">Azure Data Lake Storage</a>
</li>
<li class="none">
<a href="../../hadoop-cos/cloud-storage/index.html">Tencent COS</a>
</li>
<li class="none">
<a href="../../hadoop-huaweicloud/cloud-storage/index.html">Huaweicloud OBS</a>
</li>
</ul>
<h5>Auth</h5>
<ul>
<li class="none">
<a href="../../hadoop-auth/index.html">Overview</a>
</li>
<li class="none">
<a href="../../hadoop-auth/Examples.html">Examples</a>
</li>
<li class="none">
<a href="../../hadoop-auth/Configuration.html">Configuration</a>
</li>
<li class="none">
<a href="../../hadoop-auth/BuildingIt.html">Building</a>
</li>
</ul>
<h5>Tools</h5>
<ul>
<li class="none">
<a href="../../hadoop-streaming/HadoopStreaming.html">Hadoop Streaming</a>
</li>
<li class="none">
<a href="../../hadoop-archives/HadoopArchives.html">Hadoop Archives</a>
</li>
<li class="none">
<a href="../../hadoop-archive-logs/HadoopArchiveLogs.html">Hadoop Archive Logs</a>
</li>
<li class="none">
<a href="../../hadoop-distcp/DistCp.html">DistCp</a>
</li>
<li class="none">
<a href="../../hadoop-federation-balance/HDFSFederationBalance.html">HDFS Federation Balance</a>
</li>
<li class="none">
<a href="../../hadoop-gridmix/GridMix.html">GridMix</a>
</li>
<li class="none">
<a href="../../hadoop-rumen/Rumen.html">Rumen</a>
</li>
<li class="none">
<a href="../../hadoop-resourceestimator/ResourceEstimator.html">Resource Estimator Service</a>
</li>
<li class="none">
<a href="../../hadoop-sls/SchedulerLoadSimulator.html">Scheduler Load Simulator</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Benchmarking.html">Hadoop Benchmarking</a>
</li>
<li class="none">
<a href="../../hadoop-dynamometer/Dynamometer.html">Dynamometer</a>
</li>
</ul>
<h5>Reference</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/release/">Changelog and Release Notes</a>
</li>
<li class="none">
<a href="../../api/index.html">Java API docs</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/UnixShellAPI.html">Unix Shell API</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Metrics.html">Metrics</a>
</li>
</ul>
<h5>Configuration</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/core-default.xml">core-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/hdfs-default.xml">hdfs-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs-rbf/hdfs-rbf-default.xml">hdfs-rbf-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml">mapred-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-common/yarn-default.xml">yarn-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-kms/kms-default.html">kms-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-hdfs-httpfs/httpfs-default.html">httpfs-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/DeprecatedProperties.html">Deprecated Properties</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img alt="Built by Maven" src="./images/logos/maven-feather.png"/>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<!---
Licensed 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. See accompanying LICENSE file.
-->
<h1>Fair Call Queue Guide</h1>
<ul>
<li><a href="#Purpose">Purpose</a></li>
<li><a href="#Prerequisites">Prerequisites</a></li>
<li><a href="#Overview">Overview</a></li>
<li><a href="#Design_Details">Design Details</a>
<ul>
<li><a href="#Cost-based_Fair_Call_Queue">Cost-based Fair Call Queue</a></li></ul></li>
<li><a href="#Configuration">Configuration</a>
<ul>
<li><a href="#Configuration_Prefixes">Configuration Prefixes</a></li>
<li><a href="#Full_List_of_Configurations">Full List of Configurations</a></li>
<li><a href="#Example_Configuration">Example Configuration</a></li></ul></li></ul>
<section>
<h2><a name="Purpose"></a>Purpose</h2>
<p>This document describes how to configure and manage the Fair Call Queue for Hadoop.</p></section><section>
<h2><a name="Prerequisites"></a>Prerequisites</h2>
<p>Make sure Hadoop is installed, configured and setup correctly. For more information see:</p>
<ul>
<li><a href="./SingleCluster.html">Single Node Setup</a> for first-time users.</li>
<li><a href="./ClusterSetup.html">Cluster Setup</a> for large, distributed clusters.</li>
</ul></section><section>
<h2><a name="Overview"></a>Overview</h2>
<p>Hadoop server components, in particular the HDFS NameNode, experience very heavy RPC load from clients. By default, all client requests are routed through a first-in, first-out queue and serviced in the order they arrive. This means that a single user submitting a very large number of requests can easily overwhelm the service, causing degraded service for all other users. The Fair Call Queue, and related components, aim to mitigate this impact.</p></section><section>
<h2><a name="Design_Details"></a>Design Details</h2>
<p>There are a few components in the IPC stack which have a complex interplay, each with their own tuning parameters. The image below presents a schematic overview of their interactions, which will be explained below.</p>
<p><img src="./images/faircallqueue-overview.png" alt="FairCallQueue Overview" /></p>
<p>In the following explanation, <b>bolded</b> words refer to named entities or configurables.</p>
<p>When a client makes a request to an IPC server, this request first lands in a <b>listen queue</b>. <b>Reader</b> threads remove requests from this queue and pass them to a configurable <b>RpcScheduler</b> to be assigned a priority and placed into a <b>call queue</b>; this is where FairCallQueue sits as a pluggable implementation (the other existing implementation being a FIFO queue). <b>Handler</b> threads accept requests out of the call queue, process them, and respond to the client.</p>
<p>The implementation of RpcScheduler used with FairCallQueue by default is <b>DecayRpcScheduler</b>, which maintains a count of requests received for each user. This count <i>decays</i> over time; every <b>sweep period</b> (5s by default), the number of requests per user is multiplied by a <b>decay factor</b> (0.5 by default). This maintains a weighted/rolling average of request count per user. Every time that a sweep is performed, the call counts for all known users are ranked from highest to lowest. Each user is assigned a <b>priority</b> (0-3 by default, with 0 being highest priority) based on the proportion of calls originating from that user. The default <b>priority thresholds</b> are (0.125, 0.25, 0.5), meaning that users whose calls make up more than 50% of the total (there can be at most one such user) are placed into the lowest priority, users whose calls make up between 25% and 50% of the total are in the 2nd lowest, users whose calls make up between 12.5% and 25% are in the 2nd highest priority, and all other users are placed in the highest priority. At the end of the sweep, each known user has a cached priority which will be used until the next sweep; new users which appear between sweeps will have their priority calculated on-the-fly.</p>
<p>Within FairCallQueue, there are multiple <b>priority queues</b>, each of which is designated a <b>weight</b>. When a request arrives at the call queue, the request is placed into one of these priority queues based on the current priority assigned to the call (by the RpcScheduler). When a handler thread attempts to fetch an item from the call queue, which queue it pulls from is decided via an <b>RpcMultiplexer</b>; currently this is hard-coded to be a <b>WeightedRoundRobinMultiplexer</b>. The WRRM serves requests from queues based on their weights; the default weights for the default 4 priority levels are (8, 4, 2, 1). Thus, the WRRM would serve 8 requests from the highest priority queue, 4 from the second highest, 2 from the third highest, 1 from the lowest, then serve 8 more from the highest priority queue, and so on.</p>
<p>In addition to the priority-weighting mechanisms discussed above, there is also a configurable <b>backoff</b> mechanism, in which the server will throw an exception to the client rather than handling it; the client is expected to wait some time (i.e., via exponential backoff) before trying again. Typically, backoff is triggered when a request is attempted to be placed in a priority queue (of FCQ) when that queue is full. This helps to push back further on impactful clients, reducing load, and can have substantial benefit. There is also a feature, <b>backoff by response time</b>, which will cause requests in lower priority levels to back off if requests in higher priority levels are being serviced too slowly. For example, if the response time threshold for priority 1 is set to be 10 seconds, but the average response time in that queue is 12 seconds, an incoming request at priority levels 2 or lower would receive a backoff exception, while requests at priority levels 0 and 1 would proceed as normal. The intent is to force heavier clients to back off when overall system load is heavy enough to cause high priority clients to be impacted.</p>
<p>The discussion above refers to the <b>user</b> of a request when discussing how to group together requests for throttling. This is configurable via the <b>identity provider</b>, which defaults to the <b>UserIdentityProvider</b>. The user identity provider simply uses the username of the client submitting the request. However, a custom identity provider can be used to performing throttling based on other groupings, or using an external identity provider.</p>
<p>If particular users submit important requests and you don&#x2019;t want to limit them, you can set them up as the <b>service-users</b>. They are always scheduled into the high-priority queue and won&#x2019;t be included in the priority computation of normal user calls.</p><section>
<h3><a name="Cost-based_Fair_Call_Queue"></a>Cost-based Fair Call Queue</h3>
<p>Though the fair call queue itself does a good job of mitigating the impact from users who submit a very high <i>number</i> of requests, it does not take account into how expensive each request is to process. Thus, when considering the HDFS NameNode, a user who submits 1000 &#x201c;getFileInfo&#x201d; requests would be prioritized the same as a user who submits 1000 &#x201c;listStatus&#x201d; requests on some very large directory, or a user who submits 1000 &#x201c;mkdir&#x201d; requests, which are more expensive as they require an exclusive lock on the namesystem. To account for the <i>cost</i> of an operation when considering the prioritization of user requests, there is a &#x201c;cost-based&#x201d; extension to the Fair Call Queue which uses the aggregate processing time of a user&#x2019;s operations to determine how that user should be prioritized. By default, queue time (time spent waiting to be processed) and lock wait time (time spent waiting to acquire a lock) is not considered in the cost, time spent processing without a lock is neutrally (1x) weighted, time spent processing with a shared lock is weighted 10x higher, and time spent processing with an exclusive lock is weighted 100x higher. This attempts to prioritize users based on the actual load they place on the server. To enable this feature, set the <code>costprovder.impl</code> configuration to <code>org.apache.hadoop.ipc.WeightedTimeCostProvider</code> as described below.</p></section></section><section>
<h2><a name="Configuration"></a>Configuration</h2>
<p>This section describes how to configure the fair call queue.</p><section>
<h3><a name="Configuration_Prefixes"></a>Configuration Prefixes</h3>
<p>All call queue-related configurations are relevant to only a single IPC server. This allows for a single configuration file to be used to configure different components, or even different IPC servers within a component, to have uniquely configured call queues. Each configuration is prefixed with <code>ipc.&lt;port_number&gt;</code>, where <code>&lt;port_number&gt;</code> is the port used by the IPC server to be configured. For example, <code>ipc.8020.callqueue.impl</code> will adjust the call queue implementation for the IPC server running at port 8020. For the remainder of this section, this prefix will be omitted.</p></section><section>
<h3><a name="Full_List_of_Configurations"></a>Full List of Configurations</h3>
<table border="0" class="bodyTable">
<thead>
<tr class="a">
<th align="left"> Configuration Key </th>
<th align="left"> Applicable Component </th>
<th align="left"> Description </th>
<th align="left"> Default </th></tr>
</thead><tbody>
<tr class="b">
<td align="left"> backoff.enable </td>
<td align="left"> General </td>
<td align="left"> Whether or not to enable client backoff when a queue is full. </td>
<td align="left"> false </td></tr>
<tr class="a">
<td align="left"> callqueue.impl </td>
<td align="left"> General </td>
<td align="left"> The fully qualified name of a class to use as the implementation of a call queue. Use <code>org.apache.hadoop.ipc.FairCallQueue</code> for the Fair Call Queue. </td>
<td align="left"> <code>java.util.concurrent.LinkedBlockingQueue</code> (FIFO queue) </td></tr>
<tr class="b">
<td align="left"> callqueue.capacity.weights </td>
<td align="left"> General </td>
<td align="left"> The capacity allocation weights among all subqueues. A postive int array whose length is equal to the <code>scheduler.priority.levels</code> is expected where each int is the relative weight out of total capacity. i.e. if a queue with capacity weight <code>w</code>, its queue capacity is <code>capacity * w/sum(weights)</code> </td></tr>
<tr class="a">
<td align="left"> scheduler.impl </td>
<td align="left"> General </td>
<td align="left"> The fully qualified name of a class to use as the implementation of the scheduler. Use <code>org.apache.hadoop.ipc.DecayRpcScheduler</code> in conjunction with the Fair Call Queue. </td>
<td align="left"> <code>org.apache.hadoop.ipc.DefaultRpcScheduler</code> (no-op scheduler) <br /> If using FairCallQueue, defaults to <code>org.apache.hadoop.ipc.DecayRpcScheduler</code> </td></tr>
<tr class="b">
<td align="left"> scheduler.priority.levels </td>
<td align="left"> RpcScheduler, CallQueue </td>
<td align="left"> How many priority levels to use within the scheduler and call queue. </td>
<td align="left"> 4 </td></tr>
<tr class="a">
<td align="left"> faircallqueue.multiplexer.weights </td>
<td align="left"> WeightedRoundRobinMultiplexer </td>
<td align="left"> How much weight to give to each priority queue. This should be a comma-separated list of length equal to the number of priority levels. </td>
<td align="left"> Weights descend by a factor of 2 (e.g., for 4 levels: <code>8,4,2,1</code>) </td></tr>
<tr class="b">
<td align="left"> identity-provider.impl </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> The identity provider mapping user requests to their identity. </td>
<td align="left"> org.apache.hadoop.ipc.UserIdentityProvider </td></tr>
<tr class="a">
<td align="left"> cost-provider.impl </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> The cost provider mapping user requests to their cost. To enable determination of cost based on processing time, use <code>org.apache.hadoop.ipc.WeightedTimeCostProvider</code>. </td>
<td align="left"> org.apache.hadoop.ipc.DefaultCostProvider </td></tr>
<tr class="b">
<td align="left"> decay-scheduler.period-ms </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> How frequently the decay factor should be applied to the operation counts of users. Higher values have less overhead, but respond less quickly to changes in client behavior. </td>
<td align="left"> 5000 </td></tr>
<tr class="a">
<td align="left"> decay-scheduler.decay-factor </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> When decaying the operation counts of users, the multiplicative decay factor to apply. Higher values will weight older operations more strongly, essentially giving the scheduler a longer memory, and penalizing heavy clients for a longer period of time. </td>
<td align="left"> 0.5 </td></tr>
<tr class="b">
<td align="left"> decay-scheduler.thresholds </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> The client load threshold, as an integer percentage, for each priority queue. Clients producing less load, as a percent of total operations, than specified at position <i>i</i> will be given priority <i>i</i>. This should be a comma-separated list of length equal to the number of priority levels minus 1 (the last is implicitly 100). </td>
<td align="left"> Thresholds ascend by a factor of 2 (e.g., for 4 levels: <code>13,25,50</code>) </td></tr>
<tr class="a">
<td align="left"> decay-scheduler.backoff.responsetime.enable </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> Whether or not to enable the backoff by response time feature. </td>
<td align="left"> false </td></tr>
<tr class="b">
<td align="left"> decay-scheduler.backoff.responsetime.thresholds </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> The response time thresholds, as time durations, for each priority queue. If the average response time for a queue is above this threshold, backoff will occur in lower priority queues. This should be a comma-separated list of length equal to the number of priority levels. </td>
<td align="left"> Threshold increases by 10s per level (e.g., for 4 levels: <code>10s,20s,30s,40s</code>) </td></tr>
<tr class="a">
<td align="left"> decay-scheduler.metrics.top.user.count </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> The number of top (i.e., heaviest) users to emit metric information about. </td>
<td align="left"> 10 </td></tr>
<tr class="b">
<td align="left"> decay-scheduler.service-users </td>
<td align="left"> DecayRpcScheduler </td>
<td align="left"> Service users will always be scheduled into the highest-priority queue and won&#x2019;t be included in the priority computation of normal user calls. They are specified as a comma-separated list. </td>
<td align="left"> </td></tr>
<tr class="a">
<td align="left"> weighted-cost.lockshared </td>
<td align="left"> WeightedTimeCostProvider </td>
<td align="left"> The weight multiplier to apply to the time spent in the processing phase which holds a shared (read) lock. </td>
<td align="left"> 10 </td></tr>
<tr class="b">
<td align="left"> weighted-cost.lockexclusive </td>
<td align="left"> WeightedTimeCostProvider </td>
<td align="left"> The weight multiplier to apply to the time spent in the processing phase which holds an exclusive (write) lock. </td>
<td align="left"> 100 </td></tr>
<tr class="a">
<td align="left"> weighted-cost.{handler,lockfree,response} </td>
<td align="left"> WeightedTimeCostProvider </td>
<td align="left"> The weight multiplier to apply to the time spent in the processing phases which do not involve holding a lock. See <code>org.apache.hadoop.ipc.ProcessingDetails.Timing</code> for more details on each phase. </td>
<td align="left"> 1 </td></tr>
</tbody>
</table></section><section>
<h3><a name="Example_Configuration"></a>Example Configuration</h3>
<p>This is an example of configuration an IPC server at port 8020 to use <code>FairCallQueue</code> with the <code>DecayRpcScheduler</code> and only 2 priority levels. The heaviest 10% of users are penalized heavily, given only 1% of the total requests processed.</p>
<div class="source">
<div class="source">
<pre>&lt;property&gt;
&lt;name&gt;ipc.8020.callqueue.impl&lt;/name&gt;
&lt;value&gt;org.apache.hadoop.ipc.FairCallQueue&lt;/value&gt;
&lt;/property&gt;
&lt;property&gt;
&lt;name&gt;ipc.8020.callqueue.capacity.weights&lt;/name&gt;
&lt;value&gt;7,3&lt;/value&gt;
&lt;/property&gt;
&lt;property&gt;
&lt;name&gt;ipc.8020.scheduler.impl&lt;/name&gt;
&lt;value&gt;org.apache.hadoop.ipc.DecayRpcScheduler&lt;/value&gt;
&lt;/property&gt;
&lt;property&gt;
&lt;name&gt;ipc.8020.scheduler.priority.levels&lt;/name&gt;
&lt;value&gt;2&lt;/value&gt;
&lt;/property&gt;
&lt;property&gt;
&lt;name&gt;ipc.8020.faircallqueue.multiplexer.weights&lt;/name&gt;
&lt;value&gt;99,1&lt;/value&gt;
&lt;/property&gt;
&lt;property&gt;
&lt;name&gt;ipc.8020.decay-scheduler.thresholds&lt;/name&gt;
&lt;value&gt;90&lt;/value&gt;
&lt;/property&gt;
</pre></div></div></section></section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
&#169; 2008-2023
Apache Software Foundation
- <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>