<html v="urn:schemas-microsoft-com:vml" o="urn:schemas-microsoft-com:office:office" w="urn:schemas-microsoft-com:office:word" m="http://schemas.microsoft.com/office/2004/12/omml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta name="Generator" content="Microsoft Word 15 (filtered medium)" />
<style><!--
/* Font Definitions */
@font-face
 {font-family:"Cambria Math";
 panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
 {font-family:Calibri;
 panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
 {margin:0cm;
 margin-bottom:.0001pt;
 font-size:11.0pt;
 font-family:"Calibri",sans-serif;
 mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
 {mso-style-priority:99;
 color:#0563C1;
 text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
 {mso-style-priority:99;
 color:#954F72;
 text-decoration:underline;}
span.EmailStyle17
 {mso-style-type:personal-compose;
 font-family:"Calibri",sans-serif;
 color:windowtext;}
.MsoChpDefault
 {mso-style-type:export-only;
 font-family:"Calibri",sans-serif;
 mso-fareast-language:EN-US;}
@page WordSection1
 {size:612.0pt 792.0pt;
 margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
 {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->

</head><body lang="EN-GB" link="#0563C1" vlink="#954F72">The -l flag is causing a metadata lookup for every file in the directory. The way the ls command does that it&#39;s with individual fstat calls to each directory entry. That&#39;s a lot of tiny network round trips with fops that don&#39;t even fill a standard frame thus each frame has a high percentage of overhead for tcp. Add to that the replica check to ensure you&#39;re not getting stale data and you have another round trip for each file. Your 123k directory entries require several frames of getdirent and over 492k frames for the individual fstat calls. That&#39;s roughly 16us per frame.<br>
<br>
Can you eliminate the fstat calls? If you only get the directory listing that should be significantly better. To prove this, do &quot;echo *&quot;. You will instantly see your 123k entries.<br><br><div class="gmail_quote">On November 27, 2017 5:18:56 AM PST, Aaron Roberts &lt;aroberts@domicilium.com&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div class="WordSection1">
<p class="MsoNormal">Hi,</p><p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have a situation where an apache web server is trying to locate the IndexDocument for a directory on a gluster volume.&nbsp; This URL is being hit roughly 20 times per second.&nbsp; There is only 1 file in this directory.&nbsp; However,
 the parent directory does have a large number of items (+123,000 files and dirs) and we are performing operations to move these files into 2 levels of subdirs.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">We are seeing very slow response times (around 8 seconds) in apache and also when trying to ls on this dir.&nbsp; Before we started the migrations to move files on the large parent dir into 2 sub levels, we weren&rsquo;t aware of a problem.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">[root@web-02 images]# time ls -l dir1/get/ | wc -l</p><p></p>
<p class="MsoNormal">2</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">real&nbsp;&nbsp;&nbsp; 0m8.114s</p><p></p>
<p class="MsoNormal">user&nbsp;&nbsp;&nbsp; 0m0.002s</p><p></p>
<p class="MsoNormal">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.014s</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Other directories with only 1 item return very quickly (&lt;1 sec).</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">[root@Web-01 images]# time ls -l dir1/tmp1/ | wc -l</p><p></p>
<p class="MsoNormal">2</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">real&nbsp;&nbsp;&nbsp; 0m0.014s</p><p></p>
<p class="MsoNormal">user&nbsp;&nbsp;&nbsp; 0m0.003s</p><p></p>
<p class="MsoNormal">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.006s</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">I&rsquo;m just trying to understand what would slow down this operation so much. &nbsp;Is it the high frequency of attempts to read the directory (apache hits to dir1/get/) ?&nbsp; Do the move operations on items in the parent directory have any impact?</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Some background info:</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">[root@web-02 images]# gluster --version</p><p></p>
<p class="MsoNormal">glusterfs 3.7.20 built on Jan 30 2017 15:39:29</p><p></p>
<p class="MsoNormal">Repository revision: git://git.gluster.com/glusterfs.git</p><p></p>
<p class="MsoNormal">Copyright (c) 2006-2011 Gluster Inc. &lt;http://www.gluster.com&gt;</p><p></p>
<p class="MsoNormal">GlusterFS comes with ABSOLUTELY NO WARRANTY.</p><p></p>
<p class="MsoNormal">You may redistribute copies of GlusterFS under the terms of the GNU General Public License.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">[root@web-02 images]# gluster vol info</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Volume Name: web_vol1</p><p></p>
<p class="MsoNormal">Type: Replicate</p><p></p>
<p class="MsoNormal">Volume ID: 0d63de20-c9c2-4931-b4a3-6aed5ae28057</p><p></p>
<p class="MsoNormal">Status: Started</p><p></p>
<p class="MsoNormal">Number of Bricks: 1 x 2 = 2</p><p></p>
<p class="MsoNormal">Transport-type: tcp</p><p></p>
<p class="MsoNormal">Bricks:</p><p></p>
<p class="MsoNormal">Brick1: web-01:/export/brick1/web_vol1_brick1</p><p></p>
<p class="MsoNormal">Brick2: web-02:/export/brick1/web_vol1_brick1</p><p></p>
<p class="MsoNormal">Options Reconfigured:</p><p></p>
<p class="MsoNormal">performance.readdir-ahead: on</p><p></p>
<p class="MsoNormal">performance.io-thread-count: 32</p><p></p>
<p class="MsoNormal">performance.cache-size: 512MB</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Any insight would be gratefully received.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Thanks,</p><p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aaron</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
</div>

</blockquote></div><br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>