<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 6, 2017 at 11:16 AM, Csaba Henk <span dir="ltr">&lt;<a href="mailto:chenk@redhat.com" target="_blank">chenk@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">Thanks Du, nice bit of info! It made me wander about the following:<br>
<br>
- Could it be then the default answer we give to &quot;glusterfs client<br>
high memory usage&quot;<br>
  type of complaints to set vfs_cache_pressure to 100 + x? <br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- And then x = ? Was there proper performance testing done to see how<br>
performance /<br>
  mem consumtion changes in terms of vfs_cache_performace?<br></blockquote><div><br></div><div>I had a discussion with Manoj on this. One drawback with using vfs_cache_performance tunable is that its a dynamic algorithm which decides whether to purge from page cache or inode cache looking at the current memory pressure. An obvious drawback for glusterfs is that, various of caches of glusterfs are not visible to kernel (Memory consumed by Glusterfs gets reflected neither in page cache nor in inode cache). This _might_ result in algorithm working poorly.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- vfs_cache_pressure is an allover system tunable. If 100 + x is ideal<br>
for GlusterFS, can<br>
  we take the courage to propose this? Is there no risk to trash other<br>
(disk-based)<br>
  filesystems&#39; performace?<br></blockquote><div><br></div><div>That&#39;s a valid point. Behavior of other filesystems would be a concern.</div><div><br></div><div>I&#39;ve not really thought through this suggestion of tuning /proc/sys/vm tunables and I am not even an expert who knows what tunables are at our disposal. Just wanted to bring this idea to notice of wider audience.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Csaba<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Wed, Sep 6, 2017 at 6:57 AM, Raghavendra G &lt;<a href="mailto:raghavendra@gluster.com">raghavendra@gluster.com</a>&gt; wrote:<br>
&gt; Another parallel effort could be trying to configure the number of<br>
&gt; inodes/dentries cached by kernel VFS using /proc/sys/vm interface.<br>
&gt;<br>
&gt; ==============================<wbr>==============================<wbr>==<br>
&gt;<br>
&gt; vfs_cache_pressure<br>
&gt; ------------------<br>
&gt;<br>
&gt; This percentage value controls the tendency of the kernel to reclaim<br>
&gt; the memory which is used for caching of directory and inode objects.<br>
&gt;<br>
&gt; At the default value of vfs_cache_pressure=100 the kernel will attempt to<br>
&gt; reclaim dentries and inodes at a &quot;fair&quot; rate with respect to pagecache and<br>
&gt; swapcache reclaim.  Decreasing vfs_cache_pressure causes the kernel to<br>
&gt; prefer<br>
&gt; to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel<br>
&gt; will<br>
&gt; never reclaim dentries and inodes due to memory pressure and this can easily<br>
&gt; lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100<br>
&gt; causes the kernel to prefer to reclaim dentries and inodes.<br>
&gt;<br>
&gt; Increasing vfs_cache_pressure significantly beyond 100 may have negative<br>
&gt; performance impact. Reclaim code needs to take various locks to find<br>
&gt; freeable<br>
&gt; directory and inode objects. With vfs_cache_pressure=1000, it will look for<br>
&gt; ten times more freeable objects than there are.<br>
&gt;<br>
&gt; Also we&#39;ve an article for sysadmins which has a section:<br>
&gt;<br>
&gt; &lt;quote&gt;<br>
&gt;<br>
&gt; With GlusterFS, many users with a lot of storage and many small files<br>
&gt; easily end up using a lot of RAM on the server side due to<br>
&gt; &#39;inode/dentry&#39; caching, leading to decreased performance when the kernel<br>
&gt; keeps crawling through data-structures on a 40GB RAM system. Changing<br>
&gt; this value higher than 100 has helped many users to achieve fair caching<br>
&gt; and more responsiveness from the kernel.<br>
&gt;<br>
&gt; &lt;/quote&gt;<br>
&gt;<br>
&gt; Complete article can be found at:<br>
&gt; <a href="https://gluster.readthedocs.io/en/latest/Administrator%20Guide/Linux%20Kernel%20Tuning/" rel="noreferrer" target="_blank">https://gluster.readthedocs.<wbr>io/en/latest/Administrator%<wbr>20Guide/Linux%20Kernel%<wbr>20Tuning/</a><br>
&gt;<br>
&gt; regards,<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Sep 5, 2017 at 5:20 PM, Raghavendra Gowdappa &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; +gluster-devel<br>
&gt;&gt;<br>
&gt;&gt; Ashish just spoke to me about need of GC of inodes due to some state in<br>
&gt;&gt; inode that is being proposed in EC. Hence adding more people to<br>
&gt;&gt; conversation.<br>
&gt;&gt;<br>
&gt;&gt; &gt; &gt; On 4 September 2017 at 12:34, Csaba Henk &lt;<a href="mailto:chenk@redhat.com">chenk@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt; I don&#39;t know, depends on how sophisticated GC we need/want/can get<br>
&gt;&gt; &gt; &gt; &gt; by. I<br>
&gt;&gt; &gt; &gt; &gt; guess the complexity will be inherent, ie. that of the algorithm<br>
&gt;&gt; &gt; &gt; &gt; chosen<br>
&gt;&gt; &gt; &gt; &gt; and<br>
&gt;&gt; &gt; &gt; &gt; how we address concurrency &amp; performance impacts, but once that&#39;s<br>
&gt;&gt; &gt; &gt; &gt; got<br>
&gt;&gt; &gt; &gt; &gt; right<br>
&gt;&gt; &gt; &gt; &gt; the other aspects of implementation won&#39;t be hard.<br>
&gt;&gt; &gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt; Eg. would it be good just to maintain a simple LRU list?<br>
&gt;&gt; &gt; &gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Yes. I was also thinking of leveraging lru list. We can invalidate first<br>
&gt;&gt; &gt; &quot;n&quot;<br>
&gt;&gt; &gt; inodes from lru list of fuse inode table.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; That might work for starters.<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt; Csaba<br>
&gt;&gt; &gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt; On Mon, Sep 4, 2017 at 8:48 AM, Nithya Balachandran<br>
&gt;&gt; &gt; &gt; &gt; &lt;<a href="mailto:nbalacha@redhat.com">nbalacha@redhat.com</a>&gt;<br>
&gt;&gt; &gt; &gt; &gt; wrote:<br>
&gt;&gt; &gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt; On 4 September 2017 at 12:14, Csaba Henk &lt;<a href="mailto:chenk@redhat.com">chenk@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; Basically how I see the fuse invalidate calls as rescuers of<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; sanity.<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; Normally, when you have lot of certain kind of stuff that tends to<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; accumulate, the immediate thought is: let&#39;s set up some garbage<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; collection<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; mechanism, that will take care of keeping the accumulation at bay.<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; But<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; that&#39;s what doesn&#39;t work with inodes in a naive way, as they are<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; referenced<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; from kernel, so we have to keep them around until kernel tells us<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; it&#39;s<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; giving up its reference. However, with the fuse invalidate calls<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; we can<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; take the initiative and instruct the kernel: &quot;hey, kernel, give up<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; your<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; references to this thing!&quot;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; So we are actually free to implement any kind of inode GC in<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; glusterfs,<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; just have to take care to add the proper callback to<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; fuse_invalidate_*<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; and<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; we are good to go.<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt; That sounds good and something we need to do in the near future. Is<br>
&gt;&gt; &gt; &gt; &gt;&gt; this<br>
&gt;&gt; &gt; &gt; &gt;&gt; something that is easy to implement?<br>
&gt;&gt; &gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; Csaba<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; On Mon, Sep 4, 2017 at 7:00 AM, Nithya Balachandran<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; &lt;<a href="mailto:nbalacha@redhat.com">nbalacha@redhat.com</a><br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt; On 4 September 2017 at 10:25, Raghavendra Gowdappa<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt; &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a><br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; ----- Original Message -----<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; From: &quot;Nithya Balachandran&quot; &lt;<a href="mailto:nbalacha@redhat.com">nbalacha@redhat.com</a>&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; Sent: Monday, September 4, 2017 10:19:37 AM<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; Subject: Fuse mounts and inodes<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; One of the reasons for the memory consumption in gluster fuse<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; mounts<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; is the<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; number of inodes in the table which are never kicked out.<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; Is there any way to default to an entry-timeout and<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; attribute-timeout value<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; while mounting Gluster using Fuse? Say 60s each so those<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; entries<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; will be<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; purged periodically?<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; Once the entry timeouts, inodes won&#39;t be purged. Kernel sends a<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; lookup<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; to revalidate the mapping of path to inode. AFAIK, reverse<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; invalidation<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; (see inode_invalidate) is the only way to make kernel forget<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; inodes/attributes.<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; Is that something that can be done from the Fuse mount ? Or is<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; this<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt; something that needs to be added to Fuse?<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt; Nithya<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; Gluster-devel mailing list<br>
&gt;&gt; <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
&gt;&gt; <a href="http://lists.gluster.org/mailman/listinfo/gluster-devel" rel="noreferrer" target="_blank">http://lists.gluster.org/<wbr>mailman/listinfo/gluster-devel</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Raghavendra G<br>
&gt;<br>
&gt; ______________________________<wbr>_________________<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://lists.gluster.org/mailman/listinfo/gluster-devel" rel="noreferrer" target="_blank">http://lists.gluster.org/<wbr>mailman/listinfo/gluster-devel</a><br>
______________________________<wbr>_________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
<a href="http://lists.gluster.org/mailman/listinfo/gluster-devel" rel="noreferrer" target="_blank">http://lists.gluster.org/<wbr>mailman/listinfo/gluster-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Raghavendra G<br></div>
</div></div>