blob: 89e42cad6a79ecb02901b3be047b756ee22e6522 [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-design/architecture" data-has-hydrated="false">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.4.3">
<title data-rh="true">Architecture | Apache® Druid</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" name="twitter:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" property="og:url" content="https://druid.apache.org/docs/latest/design/architecture"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Architecture | Apache® Druid"><meta data-rh="true" name="description" content="&lt;!--"><meta data-rh="true" property="og:description" content="&lt;!--"><link data-rh="true" rel="icon" href="/img/favicon.png"><link data-rh="true" rel="canonical" href="https://druid.apache.org/docs/latest/design/architecture"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/design/architecture" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/design/architecture" hreflang="x-default"><link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-131010415-1",{})</script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script><link rel="stylesheet" href="/assets/css/styles.4b88a1d0.css">
<link rel="preload" href="/assets/js/runtime~main.06837abf.js" as="script">
<link rel="preload" href="/assets/js/main.66359c18.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--dark_i4oU"></div></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/technology">Technology</a><a class="navbar__item navbar__link" href="/use-cases">Use Cases</a><a class="navbar__item navbar__link" href="/druid-powered">Powered By</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs/latest/design/">Docs</a><a class="navbar__item navbar__link" href="/community/">Community</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Apache®</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Foundation<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://apachecon.com/?ref=druid.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Events<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">License<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Thanks<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Security<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Sponsorship<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><a class="navbar__item navbar__link" href="/downloads/">Download</a><div class="searchBox_ZlJk"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><input type="search" id="search_input_react" placeholder="Loading..." aria-label="Search" class="navbar__search-input search-bar" disabled=""></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/design/">Getting started</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/tutorials/tutorial-msq-extern">Tutorials</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/docs/latest/design/architecture">Design</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/docs/latest/design/architecture">Architecture</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/docs/latest/design/coordinator">Services</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/design/storage">Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/design/segments">Segments</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/design/deep-storage">Deep storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/design/metadata-storage">Metadata storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/design/zookeeper">ZooKeeper</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/ingestion/">Ingestion</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/data-management/">Data management</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/querying/sql">Querying</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/api-reference/">API reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/configuration/">Configuration</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/operations/web-console">Operations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/development/overview">Development</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/misc/papers-and-talks">Misc</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/latest/release-info/release-notes">Release info</a></div></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Design</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Architecture</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Architecture</h1></header><p>Druid has a distributed architecture that is designed to be cloud-friendly and easy to operate. You can configure and scale services independently for maximum flexibility over cluster operations. This design includes enhanced fault tolerance: an outage of one component does not immediately affect other components.</p><p>The following diagram shows the services that make up the Druid architecture, their typical arrangement across servers, and how queries and data flow through this architecture.</p><p><img loading="lazy" alt="Druid architecture" src="/assets/images/druid-architecture-7db1cd79d2d70b2e5ccc73b6bebfcaa4.svg" width="1967" height="865" class="img_ev3q"></p><p>The following sections describe the components of this architecture.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="druid-services">Druid services<a href="#druid-services" class="hash-link" aria-label="Direct link to Druid services" title="Direct link to Druid services"></a></h2><p>Druid has several types of services:</p><ul><li><a href="/docs/latest/design/coordinator">Coordinator</a> manages data availability on the cluster.</li><li><a href="/docs/latest/design/overlord">Overlord</a> controls the assignment of data ingestion workloads.</li><li><a href="/docs/latest/design/broker">Broker</a> handles queries from external clients.</li><li><a href="/docs/latest/design/router">Router</a> routes requests to Brokers, Coordinators, and Overlords.</li><li><a href="/docs/latest/design/historical">Historical</a> stores queryable data.</li><li><a href="/docs/latest/design/middlemanager">MiddleManager</a> and <a href="/docs/latest/design/peons">Peon</a> ingest data.</li><li><a href="/docs/latest/design/indexer">Indexer</a> serves an alternative to the MiddleManager + Peon task execution system.</li></ul><p>You can view services in the <strong>Services</strong> tab in the web console: </p><p><img loading="lazy" alt="Druid services" src="/assets/images/services-overview-626a864a11edcf4945591a35d4a3814c.png" title="Services in the web console" width="1250" height="640" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="druid-servers">Druid servers<a href="#druid-servers" class="hash-link" aria-label="Direct link to Druid servers" title="Direct link to Druid servers"></a></h2><p>You can deploy Druid services according to your preferences. For ease of deployment, we recommend organizing them into three server types: <a href="#master-server">Master</a>, <a href="#query-server">Query</a>, and <a href="#data-server">Data</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="master-server">Master server<a href="#master-server" class="hash-link" aria-label="Direct link to Master server" title="Direct link to Master server"></a></h3><p>A Master server manages data ingestion and availability. It is responsible for starting new ingestion jobs and coordinating availability of data on the <a href="#data-server">Data server</a>.</p><p>Master servers divide operations between Coordinator and Overlord services.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="coordinator-service">Coordinator service<a href="#coordinator-service" class="hash-link" aria-label="Direct link to Coordinator service" title="Direct link to Coordinator service"></a></h4><p><a href="/docs/latest/design/coordinator">Coordinator</a> services watch over the Historical services on the Data servers. They are responsible for assigning segments to specific servers, and for ensuring segments are well-balanced across Historicals.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="overlord-service">Overlord service<a href="#overlord-service" class="hash-link" aria-label="Direct link to Overlord service" title="Direct link to Overlord service"></a></h4><p><a href="/docs/latest/design/overlord">Overlord</a> services watch over the MiddleManager services on the Data servers and are the controllers of data ingestion into Druid. They are responsible for assigning ingestion tasks to MiddleManagers and for coordinating segment publishing.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="query-server">Query server<a href="#query-server" class="hash-link" aria-label="Direct link to Query server" title="Direct link to Query server"></a></h3><p>A Query server provides the endpoints that users and client applications interact with, routing queries to Data servers or other Query servers (and optionally proxied Master server requests).</p><p>Query servers divide operations between Broker and Router services.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="broker-service">Broker service<a href="#broker-service" class="hash-link" aria-label="Direct link to Broker service" title="Direct link to Broker service"></a></h4><p><a href="/docs/latest/design/broker">Broker</a> services receive queries from external clients and forward those queries to Data servers. When Brokers receive results from those subqueries, they merge those results and return them to the caller. Typically, you query Brokers rather than querying Historical or MiddleManager services on Data servers directly.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="router-service">Router service<a href="#router-service" class="hash-link" aria-label="Direct link to Router service" title="Direct link to Router service"></a></h4><p><a href="/docs/latest/design/router"><strong>Router</strong></a> services provide a unified API gateway in front of Brokers, Overlords, and Coordinators.</p><p>The Router service also runs the <a href="/docs/latest/operations/web-console">web console</a>, a UI for loading data, managing datasources and tasks, and viewing server status and segment information.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="data-server">Data server<a href="#data-server" class="hash-link" aria-label="Direct link to Data server" title="Direct link to Data server"></a></h3><p>A Data server executes ingestion jobs and stores queryable data.</p><p>Data servers divide operations between Historical and MiddleManager services.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="historical-service">Historical service<a href="#historical-service" class="hash-link" aria-label="Direct link to Historical service" title="Direct link to Historical service"></a></h4><p><a href="/docs/latest/design/historical"><strong>Historical</strong></a> services handle storage and querying on historical data, including any streaming data that has been in the system long enough to be committed. Historical services download segments from deep storage and respond to queries about these segments. They don&#x27;t accept writes.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="middlemanager-service">MiddleManager service<a href="#middlemanager-service" class="hash-link" aria-label="Direct link to MiddleManager service" title="Direct link to MiddleManager service"></a></h4><p><a href="/docs/latest/design/middlemanager"><strong>MiddleManager</strong></a> services handle ingestion of new data into the cluster. They are responsible
for reading from external data sources and publishing new Druid segments.</p><h5 class="anchor anchorWithStickyNavbar_LWe7" id="peon-service">Peon service<a href="#peon-service" class="hash-link" aria-label="Direct link to Peon service" title="Direct link to Peon service"></a></h5><p><a href="/docs/latest/design/peons"><strong>Peon</strong></a> services are task execution engines spawned by MiddleManagers. Each Peon runs a separate JVM and is responsible for executing a single task. Peons always run on the same host as the MiddleManager that spawned them.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="indexer-service-optional">Indexer service (optional)<a href="#indexer-service-optional" class="hash-link" aria-label="Direct link to Indexer service (optional)" title="Direct link to Indexer service (optional)"></a></h4><p><a href="/docs/latest/design/indexer"><strong>Indexer</strong></a> services are an alternative to MiddleManagers and Peons. Instead of
forking separate JVM processes per-task, the Indexer runs tasks as individual threads within a single JVM process.</p><p>The Indexer is designed to be easier to configure and deploy compared to the MiddleManager + Peon system and to better enable resource sharing across tasks. The Indexer is a newer feature and is currently designated <a href="/docs/latest/development/experimental">experimental</a> due to the fact that its memory management system is still under
development. It will continue to mature in future versions of Druid.</p><p>Typically, you would deploy either MiddleManagers or Indexers, but not both.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="colocation-of-services">Colocation of services<a href="#colocation-of-services" class="hash-link" aria-label="Direct link to Colocation of services" title="Direct link to Colocation of services"></a></h2><p>Colocating Druid services by server type generally results in better utilization of hardware resources for most clusters.
For very large scale clusters, it can be desirable to split the Druid services such that they run on individual servers to avoid resource contention.</p><p>This section describes guidelines and configuration parameters related to service colocation.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="coordinators-and-overlords">Coordinators and Overlords<a href="#coordinators-and-overlords" class="hash-link" aria-label="Direct link to Coordinators and Overlords" title="Direct link to Coordinators and Overlords"></a></h3><p>The workload on the Coordinator service tends to increase with the number of segments in the cluster. The Overlord&#x27;s workload also increases based on the number of segments in the cluster, but to a lesser degree than the Coordinator.</p><p>In clusters with very high segment counts, it can make sense to separate the Coordinator and Overlord services to provide more resources for the Coordinator&#x27;s segment balancing workload.</p><p>You can run the Coordinator and Overlord services as a single combined service by setting the <code>druid.coordinator.asOverlord.enabled</code> property.
For more information, see <a href="/docs/latest/configuration/#coordinator-operation">Coordinator Operation</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="historicals-and-middlemanagers">Historicals and MiddleManagers<a href="#historicals-and-middlemanagers" class="hash-link" aria-label="Direct link to Historicals and MiddleManagers" title="Direct link to Historicals and MiddleManagers"></a></h3><p>With higher levels of ingestion or query load, it can make sense to deploy the Historical and MiddleManager services on separate hosts to to avoid CPU and memory contention.</p><p>The Historical service also benefits from having free memory for memory mapped segments, which can be another reason to deploy the Historical and MiddleManager services separately.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="external-dependencies">External dependencies<a href="#external-dependencies" class="hash-link" aria-label="Direct link to External dependencies" title="Direct link to External dependencies"></a></h2><p>In addition to its built-in service types, Druid also has three external dependencies. These are intended to be able to
leverage existing infrastructure, where present.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="deep-storage">Deep storage<a href="#deep-storage" class="hash-link" aria-label="Direct link to Deep storage" title="Direct link to Deep storage"></a></h3><p>Druid uses deep storage to store any data that has been ingested into the system. Deep storage is shared file
storage accessible by every Druid server. In a clustered deployment, this is typically a distributed object store like S3 or
HDFS, or a network mounted filesystem. In a single-server deployment, this is typically local disk.</p><p>Druid uses deep storage for the following purposes:</p><ul><li>To store all the data you ingest. Segments that get loaded onto Historical services for low latency queries are also kept in deep storage for backup purposes. Additionally, segments that are only in deep storage can be used for <a href="/docs/latest/querying/query-deep-storage">queries from deep storage</a>.</li><li>As a way to transfer data in the background between Druid services. Druid stores data in files called <em>segments</em>.</li></ul><p>Historical services cache data segments on local disk and serve queries from that cache as well as from an in-memory cache.
Segments on disk for Historical services provide the low latency querying performance Druid is known for.</p><p>You can also query directly from deep storage. When you query segments that exist only in deep storage, you trade some performance for the ability to query more of your data without necessarily having to scale your Historical services.</p><p>When determining sizing for your storage, keep the following in mind:</p><ul><li>Deep storage needs to be able to hold all the data that you ingest into Druid.</li><li>On disk storage for Historical services need to be able to accommodate the data you want to load onto them to run queries. The data on Historical services should be data you access frequently and need to run low latency queries for. </li></ul><p>Deep storage is an important part of Druid&#x27;s elastic, fault-tolerant design. Druid bootstraps from deep storage even
if every single data server is lost and re-provisioned.</p><p>For more details, please see the <a href="/docs/latest/design/deep-storage">Deep storage</a> page.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="metadata-storage">Metadata storage<a href="#metadata-storage" class="hash-link" aria-label="Direct link to Metadata storage" title="Direct link to Metadata storage"></a></h3><p>The metadata storage holds various shared system metadata such as segment usage information and task information. In a
clustered deployment, this is typically a traditional RDBMS like PostgreSQL or MySQL. In a single-server
deployment, it is typically a locally-stored Apache Derby database.</p><p>For more details, please see the <a href="/docs/latest/design/metadata-storage">Metadata storage</a> page.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="zookeeper">ZooKeeper<a href="#zookeeper" class="hash-link" aria-label="Direct link to ZooKeeper" title="Direct link to ZooKeeper"></a></h3><p>Used for internal service discovery, coordination, and leader election.</p><p>For more details, please see the <a href="/docs/latest/design/zookeeper">ZooKeeper</a> page.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="learn-more">Learn more<a href="#learn-more" class="hash-link" aria-label="Direct link to Learn more" title="Direct link to Learn more"></a></h2><p>See the following topics for more information:</p><ul><li><a href="/docs/latest/design/storage">Storage components</a> to learn about data storage in Druid.</li><li><a href="/docs/latest/design/segments">Segments</a> to learn about segment files.</li><li><a href="/docs/latest/querying/query-processing">Query processing</a> for a high-level overview of how Druid processes queries.</li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/latest/tutorials/tutorial-jdbc"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">JDBC connector</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/latest/design/coordinator"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Coordinator</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#druid-services" class="table-of-contents__link toc-highlight">Druid services</a></li><li><a href="#druid-servers" class="table-of-contents__link toc-highlight">Druid servers</a><ul><li><a href="#master-server" class="table-of-contents__link toc-highlight">Master server</a></li><li><a href="#query-server" class="table-of-contents__link toc-highlight">Query server</a></li><li><a href="#data-server" class="table-of-contents__link toc-highlight">Data server</a></li></ul></li><li><a href="#colocation-of-services" class="table-of-contents__link toc-highlight">Colocation of services</a><ul><li><a href="#coordinators-and-overlords" class="table-of-contents__link toc-highlight">Coordinators and Overlords</a></li><li><a href="#historicals-and-middlemanagers" class="table-of-contents__link toc-highlight">Historicals and MiddleManagers</a></li></ul></li><li><a href="#external-dependencies" class="table-of-contents__link toc-highlight">External dependencies</a><ul><li><a href="#deep-storage" class="table-of-contents__link toc-highlight">Deep storage</a></li><li><a href="#metadata-storage" class="table-of-contents__link toc-highlight">Metadata storage</a></li><li><a href="#zookeeper" class="table-of-contents__link toc-highlight">ZooKeeper</a></li></ul></li><li><a href="#learn-more" class="table-of-contents__link toc-highlight">Learn more</a></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="margin-bottom--sm"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></div><div class="footer__copyright">Copyright © 2023 Apache Software Foundation. Except where otherwise noted, licensed under CC BY-SA 4.0. Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.</div></div></div></footer></div>
<script src="/assets/js/runtime~main.06837abf.js"></script>
<script src="/assets/js/main.66359c18.js"></script>
</body>
</html>