<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 02/12/2013 08:43 AM, Anand Avati
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAFboF2x6mV6CmaDBgv0OsmcPEY=v3TfUPwcHcPBLSYCKaihoUg@mail.gmail.com"
      type="cite"><br>
      <br>
      <div class="gmail_quote">On Mon, Feb 11, 2013 at 7:02 PM, Pranith
        Kumar K <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:pkarampu@redhat.com" target="_blank">pkarampu@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">
          hi,<br>
          &nbsp; &nbsp; &nbsp; Problem:<br>
          <br>
          When there are multiple fds writing to same file with
          eager-lock enabled, the fd which acquires the eager-lock waits
          for<br>
          post-op-delay secs before doing the unlock. Because of this
          all other fds opened on the file face extra delay when<br>
          performing writes. Eager-locking, post-op-delay need to be
          disabled when there are multiple fds opened on the file.<br>
          <br>
          Here is the profile info output for the case above:<br>
          Execute the following command on the mount point.<br>
          for n in `seq 1 50` ; do eval "/home/pranithk/workspace/gerrit-repo/append2log.py
          ./ben.log 10000 0.001 &amp;" ; done ; wait<br>
          <br>
          &nbsp;%-latency &nbsp; Avg-latency &nbsp; Min-Latency &nbsp; Max-Latency &nbsp; No. of
          calls &nbsp; &nbsp; &nbsp; &nbsp; Fop<br>
          &nbsp;--------- &nbsp; ----------- &nbsp; ----------- &nbsp; ----------- &nbsp;
          ------------ &nbsp; &nbsp; &nbsp; &nbsp;----<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp; 0.00 us &nbsp; &nbsp; &nbsp; 0.00 us &nbsp; &nbsp; &nbsp; 0.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 50 &nbsp; &nbsp; RELEASE<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp; 0.00 us &nbsp; &nbsp; &nbsp; 0.00 us &nbsp; &nbsp; &nbsp; 0.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 60 &nbsp;RELEASEDIR<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp;55.00 us &nbsp; &nbsp; &nbsp;55.00 us &nbsp; &nbsp; &nbsp;55.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp;1 &nbsp; &nbsp;GETXATTR<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp;31.50 us &nbsp; &nbsp; &nbsp;27.00 us &nbsp; &nbsp; &nbsp;36.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp;STATFS<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp;41.00 us &nbsp; &nbsp; &nbsp;29.00 us &nbsp; &nbsp; &nbsp;53.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp;2 &nbsp; &nbsp; ENTRYLK<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; 198.00 us &nbsp; &nbsp; 198.00 us &nbsp; &nbsp; 198.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;CREATE<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; 124.00 us &nbsp; &nbsp; 108.00 us &nbsp; &nbsp; 140.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp;2 &nbsp; &nbsp; READDIR<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp;27.04 us &nbsp; &nbsp; &nbsp;17.00 us &nbsp; &nbsp; &nbsp;95.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 49 &nbsp; &nbsp; &nbsp; &nbsp;OPEN<br>
          &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; &nbsp;74.89 us &nbsp; &nbsp; &nbsp;13.00 us &nbsp; &nbsp; 206.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 47 &nbsp; &nbsp; &nbsp; &nbsp;STAT<br>
          &nbsp; &nbsp; &nbsp; 0.01 &nbsp; &nbsp; &nbsp;87.02 us &nbsp; &nbsp; &nbsp;11.00 us &nbsp; &nbsp; 391.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 50 &nbsp; &nbsp; &nbsp; FLUSH<br>
          &nbsp; &nbsp; &nbsp; 0.01 &nbsp; &nbsp; 102.43 us &nbsp; &nbsp; &nbsp;20.00 us &nbsp; &nbsp; 268.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 60 &nbsp; &nbsp; OPENDIR<br>
          &nbsp; &nbsp; &nbsp; 0.02 &nbsp; &nbsp; 344.27 us &nbsp; &nbsp; &nbsp;22.00 us &nbsp; &nbsp; 940.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 44 &nbsp; &nbsp; &nbsp; WRITE<br>
          &nbsp; &nbsp; &nbsp; 0.02 &nbsp; &nbsp; 228.80 us &nbsp; &nbsp; &nbsp;52.00 us &nbsp; &nbsp; 345.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; 82 &nbsp; &nbsp;FXATTROP<br>
          &nbsp; &nbsp; &nbsp; 0.03 &nbsp; &nbsp; 199.89 us &nbsp; &nbsp; &nbsp;19.00 us &nbsp; &nbsp; 404.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp;120 &nbsp; &nbsp;READDIRP<br>
          &nbsp; &nbsp; &nbsp; 0.05 &nbsp; &nbsp; &nbsp;91.41 us &nbsp; &nbsp; &nbsp;23.00 us &nbsp; &nbsp; 832.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp;421 &nbsp; &nbsp; &nbsp;LOOKUP<br>
          &nbsp; &nbsp; &nbsp;99.86 &nbsp;632698.45 us &nbsp; &nbsp; &nbsp;17.00 us 1999724.00 us &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp;126 &nbsp; &nbsp;FINODELK<br>
          <br>
          Observe that most of the delay is in FINODELK fop.<br>
          <br>
          &nbsp; &nbsp; &nbsp; Possible Solution:<br>
          &nbsp; &nbsp; &nbsp; With the patch: <a moz-do-not-send="true"
            href="http://review.gluster.org/4468" target="_blank">http://review.gluster.org/4468</a>
          we started maintaining open-fd count in the inode. We need to
          implement xdata based xattr retrieval in write-fop and get
          open-fd-count in write fop. Remember the open-fd-count
          received from the write-fops and maintain it in afr-fd-ctx. If
          the open-fd count is &gt;1 post-op-delay is immediately
          disabled for that write fop. All write-fops take into
          consideration this count to determine whether to enable
          eager-lock, post-op-delay for that write fop.<br>
          <br>
          Let me know if you foresee any issues with this approach.<br>
          <br>
          <a moz-do-not-send="true"
            href="https://bugzilla.redhat.com/show_bug.cgi?id=910217"
            target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=910217</a>
          is tracking this issue.<br>
        </blockquote>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Ideally you would want open-fd count to be retrieved in all
          fops, and only when an eager lock has been acquired. Any fop
          callback's xattr_rsp inspection should potentially wake up the
          sleeping post-op-delay in that inode (and disable further
          eager locking temporarily).</div>
        <div><br>
        </div>
        <div>Avati</div>
      </div>
    </blockquote>
    Avati,<br>
    &nbsp;&nbsp;&nbsp; Makes sense. Since it is in-memory virtual xattr retrieval,
    performance should not be affected too much IMO. I will have to
    implement and run perf-test to make sure of that. Other than that
    every thing else is ok right?<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I will start the implementation if no&nbsp; other issues are
    foreseen.<br>
    <br>
    pranith.<br>
  </body>
</html>