mirror of
https://github.com/element-hq/synapse.git
synced 2026-03-30 19:25:46 +00:00
1031 lines
65 KiB
HTML
1031 lines
65 KiB
HTML
<!DOCTYPE HTML>
|
||
<html lang="en" class="light sidebar-visible" dir="ltr">
|
||
<head>
|
||
<!-- Book generated using mdBook -->
|
||
<meta charset="UTF-8">
|
||
<title>Workers - Synapse</title>
|
||
|
||
|
||
<!-- Custom HTML head -->
|
||
|
||
<meta name="description" content="">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<meta name="theme-color" content="#ffffff">
|
||
|
||
<link rel="icon" href="favicon-de23e50b.svg">
|
||
<link rel="shortcut icon" href="favicon-8114d1fc.png">
|
||
<link rel="stylesheet" href="css/variables-8adf115d.css">
|
||
<link rel="stylesheet" href="css/general-2459343d.css">
|
||
<link rel="stylesheet" href="css/chrome-ae938929.css">
|
||
<link rel="stylesheet" href="css/print-9e4910d8.css" media="print">
|
||
|
||
<!-- Fonts -->
|
||
<link rel="stylesheet" href="fonts/fonts-9644e21d.css">
|
||
|
||
<!-- Highlight.js Stylesheets -->
|
||
<link rel="stylesheet" id="mdbook-highlight-css" href="highlight-493f70e1.css">
|
||
<link rel="stylesheet" id="mdbook-tomorrow-night-css" href="tomorrow-night-4c0ae647.css">
|
||
<link rel="stylesheet" id="mdbook-ayu-highlight-css" href="ayu-highlight-3fdfc3ac.css">
|
||
|
||
<!-- Custom theme stylesheets -->
|
||
<link rel="stylesheet" href="docs/website_files/indent-section-headers-3390f960.css">
|
||
<link rel="stylesheet" href="docs/website_files/version-picker-ddc5216e.css">
|
||
|
||
|
||
<!-- Provide site root and default themes to javascript -->
|
||
<script>
|
||
const path_to_root = "";
|
||
const default_light_theme = "light";
|
||
const default_dark_theme = "navy";
|
||
window.path_to_searchindex_js = "searchindex-b358e032.js";
|
||
</script>
|
||
<!-- Start loading toc.js asap -->
|
||
<script src="toc-4dc10a98.js"></script>
|
||
</head>
|
||
<body>
|
||
<div id="mdbook-help-container">
|
||
<div id="mdbook-help-popup">
|
||
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
|
||
<div>
|
||
<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>
|
||
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
|
||
<p>Press <kbd>?</kbd> to show this help</p>
|
||
<p>Press <kbd>Esc</kbd> to hide this help</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="mdbook-body-container">
|
||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||
<script>
|
||
try {
|
||
let theme = localStorage.getItem('mdbook-theme');
|
||
let sidebar = localStorage.getItem('mdbook-sidebar');
|
||
|
||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
||
}
|
||
|
||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||
}
|
||
} catch (e) { }
|
||
</script>
|
||
|
||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||
<script>
|
||
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
|
||
let theme;
|
||
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||
const html = document.documentElement;
|
||
html.classList.remove('light')
|
||
html.classList.add(theme);
|
||
html.classList.add("js");
|
||
</script>
|
||
|
||
<input type="checkbox" id="mdbook-sidebar-toggle-anchor" class="hidden">
|
||
|
||
<!-- Hide / unhide sidebar before it is displayed -->
|
||
<script>
|
||
let sidebar = null;
|
||
const sidebar_toggle = document.getElementById("mdbook-sidebar-toggle-anchor");
|
||
if (document.body.clientWidth >= 1080) {
|
||
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
||
sidebar = sidebar || 'visible';
|
||
} else {
|
||
sidebar = 'hidden';
|
||
sidebar_toggle.checked = false;
|
||
}
|
||
if (sidebar === 'visible') {
|
||
sidebar_toggle.checked = true;
|
||
} else {
|
||
html.classList.remove('sidebar-visible');
|
||
}
|
||
</script>
|
||
|
||
<nav id="mdbook-sidebar" class="sidebar" aria-label="Table of contents">
|
||
<!-- populated by js -->
|
||
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
|
||
<noscript>
|
||
<iframe class="sidebar-iframe-outer" src="toc.html"></iframe>
|
||
</noscript>
|
||
<div id="mdbook-sidebar-resize-handle" class="sidebar-resize-handle">
|
||
<div class="sidebar-resize-indicator"></div>
|
||
</div>
|
||
</nav>
|
||
|
||
<div id="mdbook-page-wrapper" class="page-wrapper">
|
||
|
||
<div class="page">
|
||
<div id="mdbook-menu-bar-hover-placeholder"></div>
|
||
<div id="mdbook-menu-bar" class="menu-bar sticky">
|
||
<div class="left-buttons">
|
||
<label id="mdbook-sidebar-toggle" class="icon-button" for="mdbook-sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="mdbook-sidebar">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg></span>
|
||
</label>
|
||
<button id="mdbook-theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="mdbook-theme-list">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M371.3 367.1c27.3-3.9 51.9-19.4 67.2-42.9L600.2 74.1c12.6-19.5 9.4-45.3-7.6-61.2S549.7-4.4 531.1 9.6L294.4 187.2c-24 18-38.2 46.1-38.4 76.1L371.3 367.1zm-19.6 25.4l-116-104.4C175.9 290.3 128 339.6 128 400c0 3.9 .2 7.8 .6 11.6c1.8 17.5-10.2 36.4-27.8 36.4H96c-17.7 0-32 14.3-32 32s14.3 32 32 32H240c61.9 0 112-50.1 112-112c0-2.5-.1-5-.2-7.5z"/></svg></span>
|
||
</button>
|
||
<ul id="mdbook-theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
||
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-default_theme">Auto</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-light">Light</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-rust">Rust</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-coal">Coal</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-navy">Navy</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-ayu">Ayu</button></li>
|
||
</ul>
|
||
<button id="mdbook-search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="mdbook-searchbar">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352c79.5 0 144-64.5 144-144s-64.5-144-144-144S64 128.5 64 208s64.5 144 144 144z"/></svg></span>
|
||
</button>
|
||
</div>
|
||
|
||
<!-- BEGIN CUSTOM SYNAPSE MODIFICATIONS -->
|
||
<div class="version-picker">
|
||
<div class="dropdown">
|
||
<div class="select">
|
||
<span></span>
|
||
<i class="fa fa-chevron-down"></i>
|
||
</div>
|
||
<input type="hidden" name="version">
|
||
<ul class="dropdown-menu">
|
||
<!-- Versions will be added dynamically in version-picker.js -->
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<!-- END CUSTOM SYNAPSE MODIFICATIONS -->
|
||
|
||
<h1 class="menu-title">Synapse</h1>
|
||
|
||
<div class="right-buttons">
|
||
<a href="print.html" title="Print this book" aria-label="Print this book">
|
||
<span class=fa-svg id="print-button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M128 0C92.7 0 64 28.7 64 64v96h64V64H354.7L384 93.3V160h64V93.3c0-17-6.7-33.3-18.7-45.3L400 18.7C388 6.7 371.7 0 354.7 0H128zM384 352v32 64H128V384 368 352H384zm64 32h32c17.7 0 32-14.3 32-32V256c0-35.3-28.7-64-64-64H64c-35.3 0-64 28.7-64 64v96c0 17.7 14.3 32 32 32H64v64c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V384zm-16-88c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg></span>
|
||
</a>
|
||
<a href="https://github.com/element-hq/synapse" title="Git repository" aria-label="Git repository">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg></span>
|
||
</a>
|
||
<a href="https://github.com/element-hq/synapse/edit/develop/docs/workers.md" title="Suggest an edit" aria-label="Suggest an edit" rel="edit">
|
||
<span class=fa-svg id="git-edit-button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M421.7 220.3l-11.3 11.3-22.6 22.6-205 205c-6.6 6.6-14.8 11.5-23.8 14.1L30.8 511c-8.4 2.5-17.5 .2-23.7-6.1S-1.5 489.7 1 481.2L38.7 353.1c2.6-9 7.5-17.2 14.1-23.8l205-205 22.6-22.6 11.3-11.3 33.9 33.9 62.1 62.1 33.9 33.9zM96 353.9l-9.3 9.3c-.9 .9-1.6 2.1-2 3.4l-25.3 86 86-25.3c1.3-.4 2.5-1.1 3.4-2l9.3-9.3H112c-8.8 0-16-7.2-16-16V353.9zM453.3 19.3l39.4 39.4c25 25 25 65.5 0 90.5l-14.5 14.5-22.6 22.6-11.3 11.3-33.9-33.9-62.1-62.1L314.3 67.7l11.3-11.3 22.6-22.6 14.5-14.5c25-25 65.5-25 90.5 0z"/></svg></span>
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div id="mdbook-search-wrapper" class="hidden">
|
||
<form id="mdbook-searchbar-outer" class="searchbar-outer">
|
||
<div class="search-wrapper">
|
||
<input type="search" id="mdbook-searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="mdbook-searchresults-outer" aria-describedby="searchresults-header">
|
||
<div class="spinner-wrapper">
|
||
<span class=fa-svg id="fa-spin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M304 48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zm0 416c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM48 304c26.5 0 48-21.5 48-48s-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48zm464-48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM142.9 437c18.7-18.7 18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zm0-294.2c18.7-18.7 18.7-49.1 0-67.9S93.7 56.2 75 75s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zM369.1 437c18.7 18.7 49.1 18.7 67.9 0s18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9z"/></svg></span>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<div id="mdbook-searchresults-outer" class="searchresults-outer hidden">
|
||
<div id="mdbook-searchresults-header" class="searchresults-header"></div>
|
||
<ul id="mdbook-searchresults">
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
||
<script>
|
||
document.getElementById('mdbook-sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
||
document.getElementById('mdbook-sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
||
Array.from(document.querySelectorAll('#mdbook-sidebar a')).forEach(function(link) {
|
||
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
||
});
|
||
</script>
|
||
|
||
<div id="mdbook-content" class="content">
|
||
<main>
|
||
<h1 id="scaling-synapse-via-workers"><a class="header" href="#scaling-synapse-via-workers">Scaling synapse via workers</a></h1>
|
||
<p>For small instances it is recommended to run Synapse in the default monolith mode.
|
||
For larger instances where performance is a concern it can be helpful to split
|
||
out functionality into multiple separate python processes. These processes are
|
||
called ‘workers’, and are (eventually) intended to scale horizontally
|
||
independently.</p>
|
||
<p>Synapse’s worker support is under active development and subject to change as
|
||
we attempt to rapidly scale ever larger Synapse instances. However we are
|
||
documenting it here to help admins needing a highly scalable Synapse instance
|
||
similar to the one running <code>matrix.org</code>.</p>
|
||
<p>All processes continue to share the same database instance, and as such,
|
||
workers only work with PostgreSQL-based Synapse deployments. SQLite should only
|
||
be used for demo purposes and any admin considering workers should already be
|
||
running PostgreSQL.</p>
|
||
<p>See also <a href="https://matrix.org/blog/2020/11/03/how-we-fixed-synapses-scalability">Matrix.org blog post</a>
|
||
for a higher level overview.</p>
|
||
<h2 id="main-processworker-communication"><a class="header" href="#main-processworker-communication">Main process/worker communication</a></h2>
|
||
<p>The processes communicate with each other via a Synapse-specific protocol called
|
||
‘replication’ (analogous to MySQL- or Postgres-style database replication) which
|
||
feeds streams of newly written data between processes so they can be kept in
|
||
sync with the database state.</p>
|
||
<p>When configured to do so, Synapse uses a
|
||
<a href="https://redis.io/docs/manual/pubsub/">Redis pub/sub channel</a> to send the replication
|
||
stream between all configured Synapse processes. Additionally, processes may
|
||
make HTTP requests to each other, primarily for operations which need to wait
|
||
for a reply ─ such as sending an event.</p>
|
||
<p>All the workers and the main process connect to Redis, which relays replication
|
||
commands between processes.</p>
|
||
<p>If Redis support is enabled Synapse will use it as a shared cache, as well as a
|
||
pub/sub mechanism.</p>
|
||
<p>See the <a href="#architectural-diagram">Architectural diagram</a> section at the end for
|
||
a visualisation of what this looks like.</p>
|
||
<h2 id="setting-up-workers"><a class="header" href="#setting-up-workers">Setting up workers</a></h2>
|
||
<p>A Redis server is required to manage the communication between the processes.
|
||
The Redis server should be installed following the normal procedure for your
|
||
distribution (e.g. <code>apt install redis-server</code> on Debian). It is safe to use an
|
||
existing Redis deployment if you have one.</p>
|
||
<p>Once installed, check that Redis is running and accessible from the host running
|
||
Synapse, for example by executing <code>echo PING | nc -q1 localhost 6379</code> and seeing
|
||
a response of <code>+PONG</code>.</p>
|
||
<p>The appropriate dependencies must also be installed for Synapse. If using a
|
||
virtualenv, these can be installed with:</p>
|
||
<pre><code class="language-sh">pip install "matrix-synapse[redis]"
|
||
</code></pre>
|
||
<p>Note that these dependencies are included when synapse is installed with <code>pip install matrix-synapse[all]</code>. They are also included in the debian packages from
|
||
<code>packages.matrix.org</code> and in the docker images at
|
||
https://hub.docker.com/r/ectorim/synapse/.</p>
|
||
<p>To make effective use of the workers, you will need to configure an HTTP
|
||
reverse-proxy such as nginx or haproxy, which will direct incoming requests to
|
||
the correct worker, or to the main synapse instance. See
|
||
<a href="reverse_proxy.html">the reverse proxy documentation</a> for information on setting up a reverse
|
||
proxy.</p>
|
||
<p>When using workers, each worker process has its own configuration file which
|
||
contains settings specific to that worker, such as the HTTP listener that it
|
||
provides (if any), logging configuration, etc.</p>
|
||
<p>Normally, the worker processes are configured to read from a shared
|
||
configuration file as well as the worker-specific configuration files. This
|
||
makes it easier to keep common configuration settings synchronised across all
|
||
the processes.</p>
|
||
<p>The main process is somewhat special in this respect: it does not normally
|
||
need its own configuration file and can take all of its configuration from the
|
||
shared configuration file.</p>
|
||
<h3 id="shared-configuration"><a class="header" href="#shared-configuration">Shared configuration</a></h3>
|
||
<p>Normally, only a few changes are needed to make an existing configuration
|
||
file suitable for use with workers:</p>
|
||
<ul>
|
||
<li>First, you need to enable an
|
||
<a href="usage/configuration/config_documentation.html#listeners">“HTTP replication listener”</a>
|
||
for the main process</li>
|
||
<li>Secondly, you need to enable
|
||
<a href="usage/configuration/config_documentation.html#redis">redis-based replication</a></li>
|
||
<li>You will need to add an <a href="usage/configuration/config_documentation.html#instance_map"><code>instance_map</code></a>
|
||
with the <code>main</code> process defined, as well as the relevant connection information from
|
||
it’s HTTP <code>replication</code> listener (defined in step 1 above).
|
||
<ul>
|
||
<li>Note that the <code>host</code> defined is the address the worker needs to look for the <code>main</code>
|
||
process at, not necessarily the same address that is bound to.</li>
|
||
<li>If you are using Unix sockets for the <code>replication</code> resource, make sure to
|
||
use a <code>path</code> to the socket file instead of a <code>port</code>.</li>
|
||
</ul>
|
||
</li>
|
||
<li>Optionally, a <a href="usage/configuration/config_documentation.html#worker_replication_secret">shared secret</a>
|
||
can be used to authenticate HTTP traffic between workers. For example:</li>
|
||
</ul>
|
||
<pre><code class="language-yaml"># extend the existing `listeners` section. This defines the ports that the
|
||
# main process will listen on.
|
||
listeners:
|
||
# The HTTP replication port
|
||
- port: 9093
|
||
bind_address: '127.0.0.1'
|
||
type: http
|
||
resources:
|
||
- names: [replication]
|
||
|
||
# Add a random shared secret to authenticate traffic.
|
||
worker_replication_secret: ""
|
||
|
||
redis:
|
||
enabled: true
|
||
# For additional Redis configuration options (TLS, authentication, etc.),
|
||
# see the Synapse configuration documentation:
|
||
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#redis
|
||
|
||
instance_map:
|
||
main:
|
||
host: 'localhost'
|
||
port: 9093
|
||
</code></pre>
|
||
<p>See the <a href="usage/configuration/config_documentation.html">configuration manual</a>
|
||
for the full documentation of each option.</p>
|
||
<p>Under <strong>no circumstances</strong> should the replication listener be exposed to the
|
||
public internet; replication traffic is:</p>
|
||
<ul>
|
||
<li>always unencrypted</li>
|
||
<li>unauthenticated, unless <a href="usage/configuration/config_documentation.html#worker_replication_secret"><code>worker_replication_secret</code></a>
|
||
is configured</li>
|
||
</ul>
|
||
<h3 id="worker-configuration"><a class="header" href="#worker-configuration">Worker configuration</a></h3>
|
||
<p>In the config file for each worker, you must specify:</p>
|
||
<ul>
|
||
<li>The type of worker (<a href="usage/configuration/config_documentation.html#worker_app"><code>worker_app</code></a>).
|
||
The currently available worker applications are listed <a href="#available-worker-applications">below</a>.</li>
|
||
<li>A unique name for the worker (<a href="usage/configuration/config_documentation.html#worker_name"><code>worker_name</code></a>).</li>
|
||
<li>If handling HTTP requests, a <a href="usage/configuration/config_documentation.html#worker_listeners"><code>worker_listeners</code></a> option
|
||
with an <code>http</code> listener.</li>
|
||
<li><strong>Synapse 1.72 and older:</strong> if handling the <code>^/_matrix/client/v3/keys/upload</code> endpoint, the HTTP URI for
|
||
the main process (<code>worker_main_http_uri</code>). This config option is no longer required and is ignored when running Synapse 1.73 and newer.</li>
|
||
</ul>
|
||
<p>For example:</p>
|
||
<pre><code class="language-yaml">worker_app: synapse.app.generic_worker
|
||
worker_name: generic_worker1
|
||
|
||
worker_listeners:
|
||
- type: http
|
||
port: 8083
|
||
x_forwarded: true
|
||
resources:
|
||
- names: [client, federation]
|
||
|
||
worker_log_config: /etc/matrix-synapse/generic-worker-log.yaml
|
||
</code></pre>
|
||
<p>…is a full configuration for a generic worker instance, which will expose a
|
||
plain HTTP endpoint on port 8083 separately serving various endpoints, e.g.
|
||
<code>/sync</code>, which are listed below.</p>
|
||
<p>Obviously you should configure your reverse-proxy to route the relevant
|
||
endpoints to the worker (<code>localhost:8083</code> in the above example).</p>
|
||
<h3 id="running-synapse-with-workers"><a class="header" href="#running-synapse-with-workers">Running Synapse with workers</a></h3>
|
||
<p>Finally, you need to start your worker processes. This can be done with either
|
||
<code>synctl</code> or your distribution’s preferred service manager such as <code>systemd</code>. We
|
||
recommend the use of <code>systemd</code> where available: for information on setting up
|
||
<code>systemd</code> to start synapse workers, see
|
||
<a href="systemd-with-workers/">Systemd with Workers</a>. To use <code>synctl</code>, see
|
||
<a href="synctl_workers.html">Using synctl with Workers</a>.</p>
|
||
<h2 id="start-synapse-with-poetry"><a class="header" href="#start-synapse-with-poetry">Start Synapse with Poetry</a></h2>
|
||
<p>The following applies to Synapse installations that have been installed from source using <code>poetry</code>.</p>
|
||
<p>You can start the main Synapse process with Poetry by running the following command:</p>
|
||
<pre><code class="language-console">poetry run synapse_homeserver --config-path [your homeserver.yaml]
|
||
</code></pre>
|
||
<p>For worker setups, you can run the following command</p>
|
||
<pre><code class="language-console">poetry run synapse_worker --config-path [your homeserver.yaml] --config-path [your worker.yaml]
|
||
</code></pre>
|
||
<h2 id="available-worker-applications"><a class="header" href="#available-worker-applications">Available worker applications</a></h2>
|
||
<h3 id="synapseappgeneric_worker"><a class="header" href="#synapseappgeneric_worker"><code>synapse.app.generic_worker</code></a></h3>
|
||
<p>This worker can handle API requests matching the following regular expressions.
|
||
These endpoints can be routed to any worker. If a worker is set up to handle a
|
||
stream then, for maximum efficiency, additional endpoints should be routed to that
|
||
worker: refer to the <a href="#stream-writers">stream writers</a> section below for further
|
||
information.</p>
|
||
<pre><code># Sync requests
|
||
^/_matrix/client/(r0|v3)/sync$
|
||
^/_matrix/client/(api/v1|r0|v3)/events$
|
||
^/_matrix/client/(api/v1|r0|v3)/initialSync$
|
||
^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$
|
||
|
||
# Federation requests
|
||
^/_matrix/federation/v1/version$
|
||
^/_matrix/federation/v1/event/
|
||
^/_matrix/federation/v1/state/
|
||
^/_matrix/federation/v1/state_ids/
|
||
^/_matrix/federation/v1/backfill/
|
||
^/_matrix/federation/v1/get_missing_events/
|
||
^/_matrix/federation/v1/publicRooms
|
||
^/_matrix/federation/v1/query/
|
||
^/_matrix/federation/v1/make_join/
|
||
^/_matrix/federation/v1/make_leave/
|
||
^/_matrix/federation/(v1|v2)/send_join/
|
||
^/_matrix/federation/(v1|v2)/send_leave/
|
||
^/_matrix/federation/v1/make_knock/
|
||
^/_matrix/federation/v1/send_knock/
|
||
^/_matrix/federation/(v1|v2)/invite/
|
||
^/_matrix/federation/v1/event_auth/
|
||
^/_matrix/federation/v1/timestamp_to_event/
|
||
^/_matrix/federation/v1/exchange_third_party_invite/
|
||
^/_matrix/federation/v1/user/devices/
|
||
^/_matrix/key/v2/query
|
||
^/_matrix/federation/v1/hierarchy/
|
||
|
||
# Inbound federation transaction request
|
||
^/_matrix/federation/v1/send/
|
||
|
||
# Client API requests
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$
|
||
^/_matrix/client/v1/rooms/.*/hierarchy$
|
||
^/_matrix/client/(v1|unstable)/rooms/.*/relations/
|
||
^/_matrix/client/v1/rooms/.*/threads$
|
||
^/_matrix/client/unstable/im.nheko.summary/summary/.*$
|
||
^/_matrix/client/(r0|v3|unstable)/account/3pid$
|
||
^/_matrix/client/(r0|v3|unstable)/account/whoami$
|
||
^/_matrix/client/(r0|v3|unstable)/account/deactivate$
|
||
^/_matrix/client/(r0|v3)/delete_devices$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/devices(/|$)
|
||
^/_matrix/client/versions$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
|
||
^/_matrix/client/v1/rooms/.*/timestamp_to_event$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable/.*)/rooms/.*/aliases
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/search$
|
||
^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$)
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/directory/room/.*$
|
||
^/_matrix/client/(r0|v3|unstable)/capabilities$
|
||
^/_matrix/client/(r0|v3|unstable)/notifications$
|
||
|
||
# Admin API requests
|
||
^/_synapse/admin/v1/rooms/[^/]+$
|
||
|
||
# Encryption requests
|
||
^/_matrix/client/(r0|v3|unstable)/keys/query$
|
||
^/_matrix/client/(r0|v3|unstable)/keys/changes$
|
||
^/_matrix/client/(r0|v3|unstable)/keys/claim$
|
||
^/_matrix/client/(r0|v3|unstable)/room_keys/
|
||
^/_matrix/client/(r0|v3|unstable)/keys/upload
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$
|
||
|
||
# Registration/login requests
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/login$
|
||
^/_matrix/client/(r0|v3|unstable)/register$
|
||
^/_matrix/client/(r0|v3|unstable)/register/available$
|
||
^/_matrix/client/v1/register/m.login.registration_token/validity$
|
||
^/_matrix/client/(r0|v3|unstable)/password_policy$
|
||
|
||
# Event sending requests
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/join/
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/knock/
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/profile/
|
||
|
||
# User directory search requests
|
||
^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||
|
||
# Unstable MSC4140 support
|
||
^/_matrix/client/unstable/org.matrix.msc4140/delayed_events(/.*/restart)?$
|
||
</code></pre>
|
||
<p>Additionally, the following REST endpoints can be handled for GET requests:</p>
|
||
<pre><code># Push rules requests
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
|
||
|
||
# Account data requests
|
||
^/_matrix/client/(r0|v3|unstable)/.*/tags
|
||
^/_matrix/client/(r0|v3|unstable)/.*/account_data
|
||
|
||
# Presence requests
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
|
||
|
||
# Admin API requests
|
||
^/_synapse/admin/v2/users/[^/]+$
|
||
</code></pre>
|
||
<p>Pagination requests can also be handled, but all requests for a given
|
||
room must be routed to the same instance. Additionally, care must be taken to
|
||
ensure that the purge history admin API is not used while pagination requests
|
||
for the room are in flight:</p>
|
||
<pre><code>^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/messages$
|
||
</code></pre>
|
||
<p>Additionally, the following endpoints should be included if Synapse is configured
|
||
to use SSO (you only need to include the ones for whichever SSO provider you’re
|
||
using):</p>
|
||
<pre><code># for all SSO providers
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect
|
||
^/_synapse/client/pick_idp$
|
||
^/_synapse/client/pick_username
|
||
^/_synapse/client/new_user_consent$
|
||
^/_synapse/client/sso_register$
|
||
|
||
# OpenID Connect requests.
|
||
^/_synapse/client/oidc/callback$
|
||
|
||
# SAML requests.
|
||
^/_synapse/client/saml2/authn_response$
|
||
|
||
# CAS requests.
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/login/cas/ticket$
|
||
</code></pre>
|
||
<p>Ensure that all SSO logins go to a single process.
|
||
For multiple workers not handling the SSO endpoints properly, see
|
||
<a href="https://github.com/matrix-org/synapse/issues/7530">#7530</a> and
|
||
<a href="https://github.com/matrix-org/synapse/issues/9427">#9427</a>.</p>
|
||
<p>Additionally, when MSC3861 is enabled (<code>experimental_features.msc3861.enabled</code>
|
||
set to <code>true</code>), the following endpoints can be handled by the worker:</p>
|
||
<pre><code>^/_synapse/admin/v2/users/[^/]+$
|
||
^/_synapse/admin/v1/username_available$
|
||
^/_synapse/admin/v1/users/[^/]+/_allow_cross_signing_replacement_without_uia$
|
||
^/_synapse/admin/v1/users/[^/]+/devices$
|
||
</code></pre>
|
||
<p>Note that a <a href="usage/configuration/config_documentation.html#listeners">HTTP listener</a>
|
||
with <code>client</code> and <code>federation</code> <code>resources</code> must be configured in the
|
||
<a href="usage/configuration/config_documentation.html#worker_listeners"><code>worker_listeners</code></a>
|
||
option in the worker config.</p>
|
||
<h4 id="load-balancing"><a class="header" href="#load-balancing">Load balancing</a></h4>
|
||
<p>It is possible to run multiple instances of this worker app, with incoming requests
|
||
being load-balanced between them by the reverse-proxy. However, different endpoints
|
||
have different characteristics and so admins
|
||
may wish to run multiple groups of workers handling different endpoints so that
|
||
load balancing can be done in different ways.</p>
|
||
<p>For <code>/sync</code> and <code>/initialSync</code> requests it will be more efficient if all
|
||
requests from a particular user are routed to a single instance. This can
|
||
be done in reverse proxy by extracting username part from the users access token.</p>
|
||
<p>Admins may additionally wish to separate out <code>/sync</code>
|
||
requests that have a <code>since</code> query parameter from those that don’t (and
|
||
<code>/initialSync</code>), as requests that don’t are known as “initial sync” that happens
|
||
when a user logs in on a new device and can be <em>very</em> resource intensive, so
|
||
isolating these requests will stop them from interfering with other users ongoing
|
||
syncs.</p>
|
||
<p>Example <code>nginx</code> configuration snippet that handles the cases above. This is just an
|
||
example and probably requires some changes according to your particular setup:</p>
|
||
<pre><code class="language-nginx"># Choose sync worker based on the existence of "since" query parameter
|
||
map $arg_since $sync {
|
||
default synapse_sync;
|
||
'' synapse_initial_sync;
|
||
}
|
||
|
||
# Extract username from access token passed as URL parameter
|
||
map $arg_access_token $accesstoken_from_urlparam {
|
||
# Defaults to just passing back the whole accesstoken
|
||
default $arg_access_token;
|
||
# Try to extract username part from accesstoken URL parameter
|
||
"~syt_(?<username>.*?)_.*" $username;
|
||
}
|
||
|
||
# Extract username from access token passed as authorization header
|
||
map $http_authorization $mxid_localpart {
|
||
# Defaults to just passing back the whole accesstoken
|
||
default $http_authorization;
|
||
# Try to extract username part from accesstoken header
|
||
"~Bearer syt_(?<username>.*?)_.*" $username;
|
||
# if no authorization-header exist, try mapper for URL parameter "access_token"
|
||
"" $accesstoken_from_urlparam;
|
||
}
|
||
|
||
upstream synapse_initial_sync {
|
||
# Use the username mapper result for hash key
|
||
hash $mxid_localpart consistent;
|
||
server 127.0.0.1:8016;
|
||
server 127.0.0.1:8036;
|
||
}
|
||
|
||
upstream synapse_sync {
|
||
# Use the username mapper result for hash key
|
||
hash $mxid_localpart consistent;
|
||
server 127.0.0.1:8013;
|
||
server 127.0.0.1:8037;
|
||
server 127.0.0.1:8038;
|
||
server 127.0.0.1:8039;
|
||
}
|
||
|
||
# Sync initial/normal
|
||
location ~ ^/_matrix/client/(r0|v3)/sync$ {
|
||
proxy_pass http://$sync;
|
||
}
|
||
|
||
# Normal sync
|
||
location ~ ^/_matrix/client/(api/v1|r0|v3)/events$ {
|
||
proxy_pass http://synapse_sync;
|
||
}
|
||
|
||
# Initial_sync
|
||
location ~ ^/_matrix/client/(api/v1|r0|v3)/initialSync$ {
|
||
proxy_pass http://synapse_initial_sync;
|
||
}
|
||
location ~ ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ {
|
||
proxy_pass http://synapse_initial_sync;
|
||
}
|
||
</code></pre>
|
||
<p>Federation and client requests can be balanced via simple round robin.</p>
|
||
<p>The inbound federation transaction request <code>^/_matrix/federation/v1/send/</code>
|
||
should be balanced by source IP so that transactions from the same remote server
|
||
go to the same process.</p>
|
||
<p>Registration/login requests can be handled separately purely to help ensure that
|
||
unexpected load doesn’t affect new logins and sign ups.</p>
|
||
<p>Finally, event sending requests can be balanced by the room ID in the URI (or
|
||
the full URI, or even just round robin), the room ID is the path component after
|
||
<code>/rooms/</code>. If there is a large bridge connected that is sending or may send lots
|
||
of events, then a dedicated set of workers can be provisioned to limit the
|
||
effects of bursts of events from that bridge on events sent by normal users.</p>
|
||
<h4 id="stream-writers"><a class="header" href="#stream-writers">Stream writers</a></h4>
|
||
<p>Additionally, the writing of specific streams (such as events) can be moved off
|
||
of the main process to a particular worker.</p>
|
||
<p>To enable this, the worker must have:</p>
|
||
<ul>
|
||
<li>An <a href="usage/configuration/config_documentation.html#listeners">HTTP <code>replication</code> listener</a> configured,</li>
|
||
<li>Have a <a href="usage/configuration/config_documentation.html#worker_name"><code>worker_name</code></a>
|
||
and be listed in the <a href="usage/configuration/config_documentation.html#instance_map"><code>instance_map</code></a>
|
||
config.</li>
|
||
<li>Have the main process declared on the <a href="usage/configuration/config_documentation.html#instance_map"><code>instance_map</code></a> as well.</li>
|
||
</ul>
|
||
<p>Note: The same worker can handle multiple streams, but unless otherwise documented,
|
||
each stream can only have a single writer.</p>
|
||
<p>For example, to move event persistence off to a dedicated worker, the shared
|
||
configuration would include:</p>
|
||
<pre><code class="language-yaml">instance_map:
|
||
main:
|
||
host: localhost
|
||
port: 8030
|
||
event_persister1:
|
||
host: localhost
|
||
port: 8034
|
||
|
||
stream_writers:
|
||
events: event_persister1
|
||
</code></pre>
|
||
<p>An example for a stream writer instance:</p>
|
||
<pre><code class="language-yaml">worker_app: synapse.app.generic_worker
|
||
worker_name: event_persister1
|
||
|
||
worker_listeners:
|
||
- type: http
|
||
port: 8034
|
||
resources:
|
||
- names: [replication]
|
||
|
||
# Enable listener if this stream writer handles endpoints for the `typing` or
|
||
# `to_device` streams. Uses a different port to the `replication` listener to
|
||
# avoid exposing the `replication` listener publicly.
|
||
#
|
||
#- type: http
|
||
# port: 8035
|
||
# x_forwarded: true
|
||
# resources:
|
||
# - names: [client]
|
||
|
||
worker_log_config: /etc/matrix-synapse/event-persister-log.yaml
|
||
</code></pre>
|
||
<p>Some of the streams have associated endpoints which, for maximum efficiency, should
|
||
be routed to the workers handling that stream. See below for the currently supported
|
||
streams and the endpoints associated with them:</p>
|
||
<h5 id="the-events-stream"><a class="header" href="#the-events-stream">The <code>events</code> stream</a></h5>
|
||
<p>The <code>events</code> stream experimentally supports having multiple writer workers, where load
|
||
is sharded between them by room ID. Each writer is called an <em>event persister</em>. They are
|
||
responsible for</p>
|
||
<ul>
|
||
<li>receiving new events,</li>
|
||
<li>linking them to those already in the room <a href="development/room-dag-concepts.html">DAG</a>,</li>
|
||
<li>persisting them to the DB, and finally</li>
|
||
<li>updating the events stream.</li>
|
||
</ul>
|
||
<p>Because load is sharded in this way, you <em>must</em> restart all worker instances when
|
||
adding or removing event persisters.</p>
|
||
<p>An <code>event_persister</code> should not be mistaken for an <code>event_creator</code>.
|
||
An <code>event_creator</code> listens for requests from clients to create new events and does
|
||
so. It will then pass those events over HTTP replication to any configured event
|
||
persisters (or the main process if none are configured).</p>
|
||
<p>Note that <code>event_creator</code>s and <code>event_persister</code>s are implemented using the same
|
||
<a href="#synapseappgeneric_worker"><code>synapse.app.generic_worker</code></a>.</p>
|
||
<p>An example <a href="usage/configuration/config_documentation.html#stream_writers"><code>stream_writers</code></a>
|
||
configuration with multiple writers:</p>
|
||
<pre><code class="language-yaml">stream_writers:
|
||
events:
|
||
- event_persister1
|
||
- event_persister2
|
||
</code></pre>
|
||
<h5 id="the-typing-stream"><a class="header" href="#the-typing-stream">The <code>typing</code> stream</a></h5>
|
||
<p>The following endpoints should be routed directly to the worker configured as
|
||
the stream writer for the <code>typing</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing
|
||
</code></pre>
|
||
<h5 id="the-to_device-stream"><a class="header" href="#the-to_device-stream">The <code>to_device</code> stream</a></h5>
|
||
<p>The following endpoints should be routed directly to the worker configured as
|
||
the stream writer for the <code>to_device</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(r0|v3|unstable)/sendToDevice/
|
||
</code></pre>
|
||
<h5 id="the-account_data-stream"><a class="header" href="#the-account_data-stream">The <code>account_data</code> stream</a></h5>
|
||
<p>The following endpoints should be routed directly to the worker configured as
|
||
the stream writer for the <code>account_data</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(r0|v3|unstable)/.*/tags
|
||
^/_matrix/client/(r0|v3|unstable)/.*/account_data
|
||
</code></pre>
|
||
<h5 id="the-receipts-stream"><a class="header" href="#the-receipts-stream">The <code>receipts</code> stream</a></h5>
|
||
<p>The <code>receipts</code> stream supports multiple writers. The following endpoints
|
||
can be handled by any worker, but should be routed directly to one of the workers
|
||
configured as stream writer for the <code>receipts</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
|
||
^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
|
||
</code></pre>
|
||
<h5 id="the-presence-stream"><a class="header" href="#the-presence-stream">The <code>presence</code> stream</a></h5>
|
||
<p>The following endpoints should be routed directly to the worker configured as
|
||
the stream writer for the <code>presence</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
|
||
</code></pre>
|
||
<h5 id="the-push_rules-stream"><a class="header" href="#the-push_rules-stream">The <code>push_rules</code> stream</a></h5>
|
||
<p>The following endpoints should be routed directly to the worker configured as
|
||
the stream writer for the <code>push_rules</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
|
||
</code></pre>
|
||
<h5 id="the-device_lists-stream"><a class="header" href="#the-device_lists-stream">The <code>device_lists</code> stream</a></h5>
|
||
<p>The <code>device_lists</code> stream supports multiple writers. The following endpoints
|
||
can be handled by any worker, but should be routed directly to one of the workers
|
||
configured as stream writer for the <code>device_lists</code> stream:</p>
|
||
<pre><code>^/_matrix/client/(r0|v3)/delete_devices$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/devices(/|$)
|
||
^/_matrix/client/(r0|v3|unstable)/keys/upload
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$
|
||
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$
|
||
</code></pre>
|
||
<h4 id="restrict-outbound-federation-traffic-to-a-specific-set-of-workers"><a class="header" href="#restrict-outbound-federation-traffic-to-a-specific-set-of-workers">Restrict outbound federation traffic to a specific set of workers</a></h4>
|
||
<p>The
|
||
<a href="usage/configuration/config_documentation.html#outbound_federation_restricted_to"><code>outbound_federation_restricted_to</code></a>
|
||
configuration is useful to make sure outbound federation traffic only goes through a
|
||
specified subset of workers. This allows you to set more strict access controls (like a
|
||
firewall) for all workers and only allow the <code>federation_sender</code>’s to contact the
|
||
outside world.</p>
|
||
<pre><code class="language-yaml">instance_map:
|
||
main:
|
||
host: localhost
|
||
port: 8030
|
||
federation_sender1:
|
||
host: localhost
|
||
port: 8034
|
||
|
||
outbound_federation_restricted_to:
|
||
- federation_sender1
|
||
|
||
worker_replication_secret: "secret_secret"
|
||
</code></pre>
|
||
<h4 id="background-tasks"><a class="header" href="#background-tasks">Background tasks</a></h4>
|
||
<p>There is also support for moving background tasks to a separate
|
||
worker. Background tasks are run periodically or started via replication. Exactly
|
||
which tasks are configured to run depends on your Synapse configuration (e.g. if
|
||
stats is enabled). This worker doesn’t handle any REST endpoints itself.</p>
|
||
<p>To enable this, the worker must have a unique
|
||
<a href="usage/configuration/config_documentation.html#worker_name"><code>worker_name</code></a>
|
||
and can be configured to run background tasks. For example, to move background tasks
|
||
to a dedicated worker, the shared configuration would include:</p>
|
||
<pre><code class="language-yaml">run_background_tasks_on: background_worker
|
||
</code></pre>
|
||
<p>You might also wish to investigate the
|
||
<a href="#updating-the-user-directory"><code>update_user_directory_from_worker</code></a> and
|
||
<a href="#synapseappmedia_repository"><code>media_instance_running_background_jobs</code></a> settings.</p>
|
||
<p>An example for a dedicated background worker instance:</p>
|
||
<pre><code class="language-yaml">worker_app: synapse.app.generic_worker
|
||
worker_name: background_worker
|
||
|
||
worker_log_config: /etc/matrix-synapse/background-worker-log.yaml
|
||
</code></pre>
|
||
<h4 id="updating-the-user-directory"><a class="header" href="#updating-the-user-directory">Updating the User Directory</a></h4>
|
||
<p>You can designate one generic worker to update the user directory.</p>
|
||
<p>Specify its name in the <a href="usage/configuration/config_documentation.html#update_user_directory_from_worker">shared configuration</a>
|
||
as follows:</p>
|
||
<pre><code class="language-yaml">update_user_directory_from_worker: worker_name
|
||
</code></pre>
|
||
<p>This work cannot be load-balanced; please ensure the main process is restarted
|
||
after setting this option in the shared configuration!</p>
|
||
<p>User directory updates allow REST endpoints matching the following regular
|
||
expressions to work:</p>
|
||
<pre><code>^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||
</code></pre>
|
||
<p>The above endpoints can be routed to any worker, though you may choose to route
|
||
it to the chosen user directory worker.</p>
|
||
<p>This style of configuration supersedes the legacy <code>synapse.app.user_dir</code>
|
||
worker application type.</p>
|
||
<h4 id="notifying-application-services"><a class="header" href="#notifying-application-services">Notifying Application Services</a></h4>
|
||
<p>You can designate one generic worker to send output traffic to Application Services.
|
||
Doesn’t handle any REST endpoints itself, but you should specify its name in the
|
||
<a href="usage/configuration/config_documentation.html#notify_appservices_from_worker">shared configuration</a>
|
||
as follows:</p>
|
||
<pre><code class="language-yaml">notify_appservices_from_worker: worker_name
|
||
</code></pre>
|
||
<p>This work cannot be load-balanced; please ensure the main process is restarted
|
||
after setting this option in the shared configuration!</p>
|
||
<p>This style of configuration supersedes the legacy <code>synapse.app.appservice</code>
|
||
worker application type.</p>
|
||
<h4 id="push-notifications"><a class="header" href="#push-notifications">Push Notifications</a></h4>
|
||
<p>You can designate generic workers to send push notifications to
|
||
a <a href="https://spec.matrix.org/v1.5/push-gateway-api/">push gateway</a> such as
|
||
<a href="https://github.com/matrix-org/sygnal">sygnal</a> and email.</p>
|
||
<p>This will stop the main process sending push notifications.</p>
|
||
<p>The workers responsible for sending push notifications can be defined using the
|
||
<a href="usage/configuration/config_documentation.html#pusher_instances"><code>pusher_instances</code></a>
|
||
option. For example:</p>
|
||
<pre><code class="language-yaml">pusher_instances:
|
||
- pusher_worker1
|
||
- pusher_worker2
|
||
</code></pre>
|
||
<p>Multiple workers can be added to this map, in which case the work is balanced
|
||
across them. Ensure the main process and all pusher workers are restarted after changing
|
||
this option.</p>
|
||
<p>These workers don’t need to accept incoming HTTP requests to send push notifications,
|
||
so no additional reverse proxy configuration is required for pusher workers.</p>
|
||
<p>This style of configuration supersedes the legacy <code>synapse.app.pusher</code>
|
||
worker application type.</p>
|
||
<h3 id="synapseapppusher"><a class="header" href="#synapseapppusher"><code>synapse.app.pusher</code></a></h3>
|
||
<p>It is likely this option will be deprecated in the future and is not recommended for new
|
||
installations. Instead, <a href="#push-notifications">use <code>synapse.app.generic_worker</code> with the <code>pusher_instances</code></a>.</p>
|
||
<p>Handles sending push notifications to sygnal and email. Doesn’t handle any
|
||
REST endpoints itself, but you should set
|
||
<a href="usage/configuration/config_documentation.html#start_pushers"><code>start_pushers: false</code></a> in the
|
||
shared configuration file to stop the main synapse sending push notifications.</p>
|
||
<p>To run multiple instances at once the
|
||
<a href="usage/configuration/config_documentation.html#pusher_instances"><code>pusher_instances</code></a>
|
||
option should list all pusher instances by their
|
||
<a href="usage/configuration/config_documentation.html#worker_name"><code>worker_name</code></a>, e.g.:</p>
|
||
<pre><code class="language-yaml">start_pushers: false
|
||
pusher_instances:
|
||
- pusher_worker1
|
||
- pusher_worker2
|
||
</code></pre>
|
||
<p>An example for a pusher instance:</p>
|
||
<pre><code class="language-yaml">worker_app: synapse.app.pusher
|
||
worker_name: pusher_worker1
|
||
|
||
worker_log_config: /etc/matrix-synapse/pusher-worker-log.yaml
|
||
</code></pre>
|
||
<h3 id="synapseappappservice"><a class="header" href="#synapseappappservice"><code>synapse.app.appservice</code></a></h3>
|
||
<p><strong>Deprecated as of Synapse v1.59.</strong> <a href="#notifying-application-services">Use <code>synapse.app.generic_worker</code> with the
|
||
<code>notify_appservices_from_worker</code> option instead.</a></p>
|
||
<p>Handles sending output traffic to Application Services. Doesn’t handle any
|
||
REST endpoints itself, but you should set <code>notify_appservices: False</code> in the
|
||
shared configuration file to stop the main synapse sending appservice notifications.</p>
|
||
<p>Note this worker cannot be load-balanced: only one instance should be active.</p>
|
||
<h3 id="synapseappfederation_sender"><a class="header" href="#synapseappfederation_sender"><code>synapse.app.federation_sender</code></a></h3>
|
||
<p>It is likely this option will be deprecated in the future and not recommended for
|
||
new installations. Instead, <a href="usage/configuration/config_documentation.html#federation_sender_instances">use <code>synapse.app.generic_worker</code> with the <code>federation_sender_instances</code></a>.</p>
|
||
<p>Handles sending federation traffic to other servers. Doesn’t handle any
|
||
REST endpoints itself, but you should set
|
||
<a href="usage/configuration/config_documentation.html#send_federation"><code>send_federation: false</code></a>
|
||
in the shared configuration file to stop the main synapse sending this traffic.</p>
|
||
<p>If running multiple federation senders then you must list each
|
||
instance in the
|
||
<a href="usage/configuration/config_documentation.html#federation_sender_instances"><code>federation_sender_instances</code></a>
|
||
option by their
|
||
<a href="usage/configuration/config_documentation.html#worker_name"><code>worker_name</code></a>.
|
||
All instances must be stopped and started when adding or removing instances.
|
||
For example:</p>
|
||
<pre><code class="language-yaml">send_federation: false
|
||
federation_sender_instances:
|
||
- federation_sender1
|
||
- federation_sender2
|
||
</code></pre>
|
||
<p>An example for a federation sender instance:</p>
|
||
<pre><code class="language-yaml">worker_app: synapse.app.federation_sender
|
||
worker_name: federation_sender1
|
||
|
||
worker_log_config: /etc/matrix-synapse/federation-sender-log.yaml
|
||
</code></pre>
|
||
<h3 id="synapseappmedia_repository"><a class="header" href="#synapseappmedia_repository"><code>synapse.app.media_repository</code></a></h3>
|
||
<p>Handles the media repository. It can handle all endpoints starting with:</p>
|
||
<pre><code>/_matrix/media/
|
||
/_matrix/client/v1/media/
|
||
/_matrix/federation/v1/media/
|
||
</code></pre>
|
||
<p>… and the following regular expressions matching media-specific administration APIs:</p>
|
||
<pre><code>^/_synapse/admin/v1/purge_media_cache$
|
||
^/_synapse/admin/v1/room/.*/media.*$
|
||
^/_synapse/admin/v1/user/.*/media.*$
|
||
^/_synapse/admin/v1/media/.*$
|
||
^/_synapse/admin/v1/quarantine_media/.*$
|
||
^/_synapse/admin/v1/users/.*/media$
|
||
</code></pre>
|
||
<p>You should also set
|
||
<a href="usage/configuration/config_documentation.html#enable_media_repo"><code>enable_media_repo: False</code></a>
|
||
in the shared configuration
|
||
file to stop the main synapse running background jobs related to managing the
|
||
media repository. Note that doing so will prevent the main process from being
|
||
able to handle the above endpoints.</p>
|
||
<p>In the <code>media_repository</code> worker configuration file, configure the
|
||
<a href="usage/configuration/config_documentation.html#listeners">HTTP listener</a> to
|
||
expose the <code>media</code> resource. For example:</p>
|
||
<pre><code class="language-yaml">worker_app: synapse.app.media_repository
|
||
worker_name: media_worker
|
||
|
||
worker_listeners:
|
||
- type: http
|
||
port: 8085
|
||
x_forwarded: true
|
||
resources:
|
||
- names: [media]
|
||
|
||
worker_log_config: /etc/matrix-synapse/media-worker-log.yaml
|
||
</code></pre>
|
||
<p>Note that if running multiple media repositories they must be on the same server
|
||
and you must specify a single instance to run the background tasks in the
|
||
<a href="usage/configuration/config_documentation.html#media_instance_running_background_jobs">shared configuration</a>,
|
||
e.g.:</p>
|
||
<pre><code class="language-yaml">media_instance_running_background_jobs: "media-repository-1"
|
||
</code></pre>
|
||
<p>Note that if a reverse proxy is used , then <code>/_matrix/media/</code> must be routed for both inbound client and federation requests (if they are handled separately).</p>
|
||
<h3 id="synapseappuser_dir"><a class="header" href="#synapseappuser_dir"><code>synapse.app.user_dir</code></a></h3>
|
||
<p><strong>Deprecated as of Synapse v1.59.</strong> <a href="#updating-the-user-directory">Use <code>synapse.app.generic_worker</code> with the
|
||
<code>update_user_directory_from_worker</code> option instead.</a></p>
|
||
<p>Handles searches in the user directory. It can handle REST endpoints matching
|
||
the following regular expressions:</p>
|
||
<pre><code>^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||
</code></pre>
|
||
<p>When using this worker you must also set <code>update_user_directory: false</code> in the
|
||
shared configuration file to stop the main synapse running background
|
||
jobs related to updating the user directory.</p>
|
||
<p>Above endpoint is not <em>required</em> to be routed to this worker. By default,
|
||
<code>update_user_directory</code> is set to <code>true</code>, which means the main process
|
||
will handle updates. All workers configured with <code>client</code> can handle the above
|
||
endpoint as long as either this worker or the main process are configured to
|
||
handle it, and are online.</p>
|
||
<p>If <code>update_user_directory</code> is set to <code>false</code>, and this worker is not running,
|
||
the above endpoint may give outdated results.</p>
|
||
<h3 id="historical-apps"><a class="header" href="#historical-apps">Historical apps</a></h3>
|
||
<p>The following used to be separate worker application types, but are now
|
||
equivalent to <code>synapse.app.generic_worker</code>:</p>
|
||
<ul>
|
||
<li><code>synapse.app.client_reader</code></li>
|
||
<li><code>synapse.app.event_creator</code></li>
|
||
<li><code>synapse.app.federation_reader</code></li>
|
||
<li><code>synapse.app.federation_sender</code></li>
|
||
<li><code>synapse.app.frontend_proxy</code></li>
|
||
<li><code>synapse.app.pusher</code></li>
|
||
<li><code>synapse.app.synchrotron</code></li>
|
||
</ul>
|
||
<h2 id="migration-from-old-config"><a class="header" href="#migration-from-old-config">Migration from old config</a></h2>
|
||
<p>A main change that has occurred is the merging of worker apps into
|
||
<code>synapse.app.generic_worker</code>. This change is backwards compatible and so no
|
||
changes to the config are required.</p>
|
||
<p>To migrate apps to use <code>synapse.app.generic_worker</code> simply update the
|
||
<code>worker_app</code> option in the worker configs, and where worker are started (e.g.
|
||
in systemd service files, but not required for synctl).</p>
|
||
<h2 id="architectural-diagram"><a class="header" href="#architectural-diagram">Architectural diagram</a></h2>
|
||
<p>The following shows an example setup using Redis and a reverse proxy:</p>
|
||
<pre><code> Clients & Federation
|
||
|
|
||
v
|
||
+-----------+
|
||
| |
|
||
| Reverse |
|
||
| Proxy |
|
||
| |
|
||
+-----------+
|
||
| | |
|
||
| | | HTTP requests
|
||
+-------------------+ | +-----------+
|
||
| +---+ |
|
||
| | |
|
||
v v v
|
||
+--------------+ +--------------+ +--------------+ +--------------+
|
||
| Main | | Generic | | Generic | | Event |
|
||
| Process | | Worker 1 | | Worker 2 | | Persister |
|
||
+--------------+ +--------------+ +--------------+ +--------------+
|
||
^ ^ | ^ | | ^ | | ^ ^
|
||
| | | | | | | | | | |
|
||
| | | | | HTTP | | | | | |
|
||
| +----------+<--|---|---------+<--|---|---------+ | |
|
||
| | +-------------|-->+-------------+ |
|
||
| | | |
|
||
| | | |
|
||
v v v v
|
||
======================================================================
|
||
Redis pub/sub channel
|
||
</code></pre>
|
||
|
||
</main>
|
||
|
||
<nav class="nav-wrapper" aria-label="Page navigation">
|
||
<!-- Mobile navigation buttons -->
|
||
<a rel="prev" href="modules/porting_legacy_module.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg></span>
|
||
</a>
|
||
|
||
<a rel="next prefetch" href="synctl_workers.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg></span>
|
||
</a>
|
||
|
||
<div style="clear: both"></div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
|
||
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
||
<a rel="prev" href="modules/porting_legacy_module.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg></span>
|
||
</a>
|
||
|
||
<a rel="next prefetch" href="synctl_workers.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg></span>
|
||
</a>
|
||
</nav>
|
||
|
||
</div>
|
||
|
||
<template id=fa-eye><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM432 256c0 79.5-64.5 144-144 144s-144-64.5-144-144s64.5-144 144-144s144 64.5 144 144zM288 192c0 35.3-28.7 64-64 64c-11.5 0-22.3-3-31.6-8.4c-.2 2.8-.4 5.5-.4 8.4c0 53 43 96 96 96s96-43 96-96s-43-96-96-96c-2.8 0-5.6 .1-8.4 .4c5.3 9.3 8.4 20.1 8.4 31.6z"/></svg></span></template>
|
||
<template id=fa-eye-slash><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c5.2-11.8 8-24.8 8-38.5c0-53-43-96-96-96c-2.8 0-5.6 .1-8.4 .4c5.3 9.3 8.4 20.1 8.4 31.6c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zm223.1 298L373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5z"/></svg></span></template>
|
||
<template id=fa-copy><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/></svg></span></template>
|
||
<template id=fa-play><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg></span></template>
|
||
<template id=fa-clock-rotate-left><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z"/></svg></span></template>
|
||
|
||
|
||
|
||
<script>
|
||
window.playground_copyable = true;
|
||
</script>
|
||
|
||
|
||
<script src="elasticlunr-ef4e11c1.min.js"></script>
|
||
<script src="mark-09e88c2c.min.js"></script>
|
||
<script src="searcher-c2a407aa.js"></script>
|
||
|
||
<script src="clipboard-1626706a.min.js"></script>
|
||
<script src="highlight-abc7f01d.js"></script>
|
||
<script src="book-a0b12cfe.js"></script>
|
||
|
||
<!-- Custom JS scripts -->
|
||
<script src="docs/website_files/version-picker-a1e40922.js"></script>
|
||
<script src="docs/website_files/version-d2c738f4.js"></script>
|
||
|
||
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|