<div dir="ltr">There is already a patch submitted for moving TBF part to libglusterfs. It is under review.<div><a href="http://review.gluster.org/#/c/12413/">http://review.gluster.org/#/c/12413/</a><br></div><div><br></div><div><br></div><div>Regards,</div><div>Raghavendra</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 25, 2016 at 2:26 AM, Venky Shankar <span dir="ltr">&lt;<a href="mailto:vshankar@redhat.com" target="_blank">vshankar@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Jan 25, 2016 at 11:06:26AM +0530, Ravishankar N wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; We are planning to introduce a throttling xlator on the server (brick)<br>
&gt; process to regulate FOPS. The main motivation is to solve complaints about<br>
&gt; AFR selfheal taking too much of CPU resources. (due to too many fops for<br>
&gt; entry<br>
&gt; self-heal, rchecksums for data self-heal etc.)<br>
&gt;<br>
&gt; The throttling is achieved using the Token Bucket Filter algorithm (TBF).<br>
&gt; TBF<br>
&gt; is already used by bitrot&#39;s bitd signer (which is a client process) in<br>
&gt; gluster to regulate the CPU intensive check-sum calculation. By putting the<br>
&gt; logic on the brick side, multiple clients- selfheal, bitrot, rebalance or<br>
&gt; even the mounts themselves can avail the benefits of throttling.<br>
<br>
</span>  [Providing current TBF implementation link for completeness]<br>
<br>
  <a href="https://github.com/gluster/glusterfs/blob/master/xlators/features/bit-rot/src/bitd/bit-rot-tbf.c" rel="noreferrer" target="_blank">https://github.com/gluster/glusterfs/blob/master/xlators/features/bit-rot/src/bitd/bit-rot-tbf.c</a><br>
<br>
Also, it would be beneficial to have the core TBF implementation as part of<br>
libglusterfs so as to be consumable by the server side xlator component to<br>
throttle dispatched FOPs and for daemons to throttle anything that&#39;s outside<br>
&quot;brick&quot; boundary (such as cpu, etc..).<br>
<div><div class="h5"><br>
&gt;<br>
&gt; The TBF algorithm in a nutshell is as follows: There is a bucket which is<br>
&gt; filled<br>
&gt; at a steady (configurable) rate with tokens. Each FOP will need a fixed<br>
&gt; amount<br>
&gt; of tokens to be processed. If the bucket has that many tokens, the FOP is<br>
&gt; allowed and that many tokens are removed from the bucket. If not, the FOP is<br>
&gt; queued until the bucket is filled.<br>
&gt;<br>
&gt; The xlator will need to reside above io-threads and can have different<br>
&gt; buckets,<br>
&gt; one per client. There has to be a communication mechanism between the client<br>
&gt; and<br>
&gt; the brick (IPC?) to tell what FOPS need to be regulated from it, and the no.<br>
&gt; of<br>
&gt; tokens needed etc. These need to be re configurable via appropriate<br>
&gt; mechanisms.<br>
&gt; Each bucket will have a token filler thread which will fill the tokens in<br>
&gt; it.<br>
&gt; The main thread will enqueue heals in a list in the bucket if there aren&#39;t<br>
&gt; enough tokens. Once the token filler detects some FOPS can be serviced, it<br>
&gt; will<br>
&gt; send a cond-broadcast to a dequeue thread which will process (stack wind)<br>
&gt; all<br>
&gt; the FOPS that have the required no. of tokens from all buckets.<br>
&gt;<br>
&gt; This is just a high level abstraction: requesting feedback on any aspect of<br>
&gt; this feature. what kind of mechanism is best between the client/bricks for<br>
&gt; tuning various parameters? What other requirements do you foresee?<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Ravi<br>
<br>
</div></div>&gt; _______________________________________________<br>
&gt; Gluster-devel mailing list<br>
&gt; <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
&gt; <a href="http://www.gluster.org/mailman/listinfo/gluster-devel" rel="noreferrer" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
<br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
<a href="http://www.gluster.org/mailman/listinfo/gluster-devel" rel="noreferrer" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
</blockquote></div><br></div>