1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

updating docs

This commit is contained in:
ainsley
2019-05-29 11:47:21 -05:00
parent 0f32311e3a
commit d35e3cb277
151 changed files with 5644 additions and 658 deletions

View File

@@ -1044,9 +1044,9 @@
</li>
<li class="chapter " data-level="4.5.1.2.5" data-path="../../nats_server/jwt_auth.html">
<li class="chapter " data-level="4.5.1.2.5" data-path="../../nats_server/accounts.html">
<a href="../../nats_server/jwt_auth.html">
<a href="../../nats_server/accounts.html">
Accounts
@@ -1057,7 +1057,20 @@
</li>
<li class="chapter " data-level="4.5.1.2.6" data-path="../../nats_server/auth_timeout.html">
<li class="chapter " data-level="4.5.1.2.6" data-path="../../nats_server/jwt_auth.html">
<a href="../../nats_server/jwt_auth.html">
JWTs
</a>
</li>
<li class="chapter " data-level="4.5.1.2.7" data-path="../../nats_server/auth_timeout.html">
<a href="../../nats_server/auth_timeout.html">
@@ -2289,7 +2302,65 @@
<section class="normal markdown-section">
<h1 id="nats-streaming"><a name="nats-streaming" class="plugin-anchor" href="#nats-streaming"><i class="fa fa-link" aria-hidden="true"></i></a>NATS Streaming</h1>
<p>Where NATS provides at most once quality of service, streaming adds at least once. Streaming is implemented as a request-reply service on top of NATS, where streaming messages are encoded as protocol buffers and the streaming clients use NATS to talk to the streaming server. The streaming server organizes messages in channels and stores them in files or databases, using ACKs to ensure delivery in both directions.</p>
<h2 id="deciding-to-use-at-least-once-delivery"><a name="deciding-to-use-at-least-once-delivery" class="plugin-anchor" href="#deciding-to-use-at-least-once-delivery"><i class="fa fa-link" aria-hidden="true"></i></a>Deciding to Use At-Least-Once Delivery</h2>
<p>The decision to use the at least once delivery through NATS streaming is
important. It will affect your deployment, usage, performance, and total
cost of ownership.</p>
<p>In modern systems applications can expose services or produce and consume data
streams. At a high level, if observability is required, applications need to
consume messages in the future, need to come consume at their own pace, or
need all messages, then at-least-once semantics (NATS streaming) makes sense. If
observation needs to be realtime and the most recent message is the most important,
the use <em>At-Most-Once</em> delivery semantics with core NATS.</p>
<p>Just be aware that using an a least once guarantee is the facet of messaging with the highest cost in terms of compute and storage. The NATS Maintainers highly recommend
a strategy of defaulting to core NATS using a service pattern (request/reply)
to guarantee delivery at the application level and using streaming only when necessary. This ultimately results in a more stable distributed system. Entire systems such as Cloud
Foundry have been built upon core NATS with no messaging persistence involved.</p>
<h3 id="when-to-use-nats-streaming"><a name="when-to-use-nats-streaming" class="plugin-anchor" href="#when-to-use-nats-streaming"><i class="fa fa-link" aria-hidden="true"></i></a>When to use NATS Streaming</h3>
<p>NATS streaming is ideal when:</p>
<ul>
<li>A historical record of a stream is required. This is when a replay of data
is required by a consumer.</li>
<li>The last message produced on a stream is required for initialization and
the producer may be offline.</li>
<li>A-priori knowledge of consumers is not available, but consumers must receive
messages. This is often a false assumption.</li>
<li>Data producers and consumers are highly decoupled. They may be online at
different times and consumers must receive messages.</li>
<li>The data in messages being sent have a lifespan beyond that of the
intended application lifespan.</li>
<li>Applications need to consume data at their own pace.</li>
</ul>
<p>Note that no assumptions should ever be made of who will receive and process
data in the future, or for what purpose.</p>
<h3 id="when-to-use-core-nats"><a name="when-to-use-core-nats" class="plugin-anchor" href="#when-to-use-core-nats"><i class="fa fa-link" aria-hidden="true"></i></a>When to use Core NATS</h3>
<p>Using core NATS is ideal for the fast request path for scalable services
where there is tolerance for message loss or when applications themselves handle
message delivery guarantees.</p>
<p>These include:</p>
<ul>
<li>Service patterns where there is a tightly coupled request/reply<ul>
<li>A request is made, and the application handles error cases upon timeout
(resends, errors, etc). <strong>Relying on a messaging system to resend here is
considered an anti-pattern.</strong></li>
</ul>
</li>
<li>Where only the last message received is important and new messages will
be received frequently enough for applications to tolerate a lost message.
This might be a stock ticker stream, frequent exchange of messages in a
service control plane, or device telemetry.</li>
<li>Message TTL is low, where the value of the data being transmitted degrades
or expires quickly.</li>
<li>The expected consumer set for a message is available a-priori and consumers
are expected to be live. The request/reply pattern works well here or
consumers can send an application level acknowledgement.</li>
</ul>
<p>We&apos;ve found that core NATS is sufficient for most use cases. Also note
that nothing precludes the use of both core NATS and NATS streaming side
by side, leveraging the strengths of each to build a highly resilient
distributed system.</p>
<h2 id="nats-streaming-overview"><a name="nats-streaming-overview" class="plugin-anchor" href="#nats-streaming-overview"><i class="fa fa-link" aria-hidden="true"></i></a>NATS Streaming Overview</h2>
<p>Where NATS provides at most once quality of service, streaming adds at least once. Streaming is implemented as a request-reply service on top of NATS. Streaming messages are encoded as protocol buffers, the streaming clients use NATS to talk to the streaming server. The streaming server organizes messages in channels and stores them in files and databases. ACKs are used to insure delivery in both directions.</p>
<blockquote>
<p>Sometimes the maintainers will refer to NATS as &quot;nats core&quot; and streaming as &quot;stan&quot; or &quot;streaming&quot;.</p>
</blockquote>
@@ -2376,7 +2447,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"7.1","depth":1,"next":{"title":"Connecting to NATS Streaming","level":"7.2","depth":1,"path":"developer/streaming/connecting.md","ref":"developer/streaming/connecting.md","articles":[]},"previous":{"title":"Partitioning","level":"6.8","depth":1,"path":"nats_streaming/partitioning.md","ref":"nats_streaming/partitioning.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html","toggle-chapters","anchors"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"lang":{"ascii":"markup","text":"markup"}},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"include-html":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"toggle-chapters":{}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"developer/streaming/README.md","mtime":"2019-05-23T20:46:31.283Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-24T21:09:44.530Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"7.1","depth":1,"next":{"title":"Connecting to NATS Streaming","level":"7.2","depth":1,"path":"developer/streaming/connecting.md","ref":"developer/streaming/connecting.md","articles":[]},"previous":{"title":"Partitioning","level":"6.8","depth":1,"path":"nats_streaming/partitioning.md","ref":"nats_streaming/partitioning.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html","toggle-chapters","anchors"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"lang":{"ascii":"markup","text":"markup"}},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"include-html":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"toggle-chapters":{}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"developer/streaming/README.md","mtime":"2019-05-29T16:43:54.758Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-29T16:45:48.381Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>