mirror of
https://github.com/taigrr/nats.docs
synced 2025-01-18 04:03:23 -08:00
updating docs
This commit is contained in:
@@ -2311,7 +2311,7 @@
|
||||
<p><strong>What happens to slow consumers?</strong></p>
|
||||
<p>When detected at the client, the application is notified and messages are dropped to allow the consumer to continue and reduce potential back pressure. When detected in the server, the server will disconnect the connection with the slow consumer to protect itself and the integrity of the messaging system.</p>
|
||||
<h2 id="slow-consumers-identified-in-the-client"><a name="slow-consumers-identified-in-the-client" class="plugin-anchor" href="#slow-consumers-identified-in-the-client"><i class="fa fa-link" aria-hidden="true"></i></a>Slow consumers identified in the client</h2>
|
||||
<p>A <a href="../documentation/writing_applications/advanced#slow-consumers">client can detect it is a slow consumer</a> on a local connection and notify the application through use of the asynchronous error callback. It is better to catch a slow consumer locally in the client rather than to allow the server to detect this condition. This example demonstrates how to define and register an asynchronous error handler that will handle slow consumer errors.</p>
|
||||
<p>A <a href="../developer/events/slow.html">client can detect it is a slow consumer</a> on a local connection and notify the application through use of the asynchronous error callback. It is better to catch a slow consumer locally in the client rather than to allow the server to detect this condition. This example demonstrates how to define and register an asynchronous error handler that will handle slow consumer errors.</p>
|
||||
<pre class="language-"><code class="lang-go"><span class="token keyword">func</span> <span class="token function">natsErrHandler</span><span class="token punctuation">(</span>nc <span class="token operator">*</span>nats<span class="token punctuation">.</span>Conn<span class="token punctuation">,</span> sub <span class="token operator">*</span>nats<span class="token punctuation">.</span>Subscription<span class="token punctuation">,</span> natsErr <span class="token builtin">error</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
fmt<span class="token punctuation">.</span><span class="token function">Printf</span><span class="token punctuation">(</span><span class="token string">"error: %v\n"</span><span class="token punctuation">,</span> natsErr<span class="token punctuation">)</span>
|
||||
<span class="token keyword">if</span> natsErr <span class="token operator">==</span> nats<span class="token punctuation">.</span>ErrSlowConsumer <span class="token punctuation">{</span>
|
||||
@@ -2343,7 +2343,7 @@ Falling behind with 65536 pending messages on subject <span class="token string"
|
||||
</code></pre>
|
||||
<p>The server will also keep count of the number of slow consumer errors encountered, available through the monitoring <code>varz</code> endpoint in the <code>slow_consumers</code> field.</p>
|
||||
<h2 id="handling-slow-consumers"><a name="handling-slow-consumers" class="plugin-anchor" href="#handling-slow-consumers"><i class="fa fa-link" aria-hidden="true"></i></a>Handling slow consumers</h2>
|
||||
<p>Apart from using <a href="http://nats.io/doc/streaming/nats-streaming-intro/" target="_blank">NATS streaming</a> or optimizing your consuming application, there are a few options available: scale, meter, or tune NATS to your environment.</p>
|
||||
<p>Apart from using <a href="nats_streaming/intro.md">NATS streaming</a> or optimizing your consuming application, there are a few options available: scale, meter, or tune NATS to your environment.</p>
|
||||
<p><strong>Scaling with queue subscribers</strong></p>
|
||||
<p>This is ideal if you do not rely on message order. Ensure your NATS subscription belongs to a <a href="http://nats.io/documentation/concepts/nats-queueing/" target="_blank">queue group</a>, then scale as required by creating more instances of your service or application. This is a great approach for microservices - each instance of your microservice will receive a portion of the messages to process, and simply add more instances of your service to scale. No code changes, configuration changes, or downtime whatsoever.</p>
|
||||
<p><strong>Create a subject namespace that can scale</strong></p>
|
||||
@@ -2411,7 +2411,7 @@ Falling behind with 65536 pending messages on subject <span class="token string"
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Slow Consumers","level":"4.6.2","depth":2,"next":{"title":"Signals","level":"4.6.3","depth":2,"path":"nats_admin/signals.md","ref":"nats_admin/signals.md","articles":[]},"previous":{"title":"Upgrading a Cluster","level":"4.6.1","depth":2,"path":"nats_admin/upgrading_cluster.md","ref":"nats_admin/upgrading_cluster.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":"nats_admin/slow_consumers.md","mtime":"2019-05-29T16:43:54.845Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-29T16:45:48.381Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Slow Consumers","level":"4.6.2","depth":2,"next":{"title":"Signals","level":"4.6.3","depth":2,"path":"nats_admin/signals.md","ref":"nats_admin/signals.md","articles":[]},"previous":{"title":"Upgrading a Cluster","level":"4.6.1","depth":2,"path":"nats_admin/upgrading_cluster.md","ref":"nats_admin/upgrading_cluster.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":"nats_admin/slow_consumers.md","mtime":"2019-05-30T17:42:13.284Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-30T17:42:48.393Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user