[OpenAFS] Slow loading of virtually hosted web content

Jeffrey E Altman jaltman@auristor.com
Fri, 19 Nov 2021 21:34:10 -0500


This is a cryptographically signed message in MIME format.

--------------ms080001070806040706080806
Content-Type: multipart/alternative;
 boundary="------------O9iAT32RuXs650YQRjLEG3rv"

--------------O9iAT32RuXs650YQRjLEG3rv
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On 11/10/2021 3:27 PM, Kendrick Hernandez (kendrick.hernandez@umbc.edu)
wrote:
> Hi all,
>
> We host around 240 departmental and campus web sites (individual afs
> volumes) across 6 virtual web servers on AFS storage. The web servers
> are 4 core, 16G VMs, and the 4 file servers are 4 core 32G VMs. All
> CentOS 7 systems.
>
> In the past week or so, we've encountered high-load on the web servers
> (primary consumers being apache and afsd) during periods of increased
> traffic, and we're trying to identify ways to tune performance.
"In the past week or so" appears to imply that the high-load was not
observed previously.  If that is the case, one question to ask is "what
changed?"  Analysis of the Apache access and error logs compared to the
prior period might provide some important clues.
> After seeing the following in the logs:
>
>     2021 11 08 08:52:03 -05:00 virthost4 [kern.warning] kernel: afs:
>     Warning: We are having trouble keeping the AFS stat cache trimmed
>     down under the configured limit (current -stat setting: 3000,
>     current vcache usage: 18116).
>     2021 11 08 08:52:03 -05:00 virthost4 [kern.warning] kernel: afs:
>     If AFS access seems slow, consider raising the -stat setting for afsd.
>
There is a one-to-one mapping between AFS vnodes and Linux inodes. 
Unlike some other platforms with OpenAFS kernel modules, the Linux
kernel module does not strictly enforce the vnode cache (aka vcache)
limit.  When the limit is reached instead of finding a vnode to recycle,
new vnodes are created and a background task attempts to prune excess
vnodes.   Its that background task which is logging the text quoted above. 

> I increased the disk cache to 10g and the -stat parameter to 100000,
> which has improved things somewhat, but we're not quite there yet.

As Ben Kaduk mentioned in his reply, callback promises must be tracked
by both the fileserver and the client.  Increasing the vcache (-stat)
limit increases the number of vnodes for which callbacks must be
tracked.  The umbc.edu cell is behind a firewall so its not possible for
me to probe the fileserver statistics to determine if increasing to
100,000 on the clients also requires an increase on the fileservers.  If
the fileserver callback table is full, then it might have to prematurely
break callback promises to satisfy the new allocation.  A callback break
requires issuing an RPC to the client whose promise is being broken.

> This is the current client cache configuration from one of the web
> servers:
>
>     Chunk files:   281250
>     Stat caches:   100000
>     Data caches:   10000
>
The data cache might need to be increased if the web servers are serving
content from more than 18,000 files
>
>     Volume caches: 200
>
If the web servers are serving data from 240 volumes, then 200 volumes
is too small.
>
>     Chunk size:    1048576
>     Cache size:    9000000 kB
>     Set time:      no
>     Cache type:    disk
>
>
> Has anyone else experienced this? I think the bottleneck is with the
> cache manager and not the file servers themselves, because they don't
> seem to be impacted much during those periods of high load, and I can
> access files in those web volumes from my local client without any
> noticable lag.

Apart from the cache settings how the web server is configured and how
it accesses content from /afs matters. 

* Are the web servers configured with mod_waklog to obtain tokens for
authenticated users?

* Are PAGs in use?

* How many active RX connections are there from the cache manager to the
fileservers?

* Are the volumes being served primarily RW volumes or RO volumes?

* Are the contents of the volumes frequently changing?

Finally, compared to the AuriStorFS and kafs clients, the OpenAFS cache
manager suffers from a number of bottlenecks on multiprocessor systems
due to reliance on a global lock to protect internal data structures. 
The cache manager's callback service is another potential bottleneck
because only one incoming RPC can be processed at a time and each
incoming RPC must acquire the aforementioned global lock for the life of
the call.  

Good luck,

Jeffrey Altman


--------------O9iAT32RuXs650YQRjLEG3rv
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 11/10/2021 3:27 PM, Kendrick
      Hernandez (<a class="moz-txt-link-abbreviated" href="mailto:kendrick.hernandez@umbc.edu">kendrick.hernandez@umbc.edu</a>) wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABWMJQUUa4mHFrTR7jAA8gZ9g9R16PqZ2NZ4Nss0zaDqM6915w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi all,
        <div><br>
        </div>
        <div>We host around 240 departmental and campus web sites
          (individual afs volumes) across 6 virtual web servers on AFS
          storage. The web servers are 4 core, 16G VMs, and the 4 file
          servers are 4 core 32G VMs. All CentOS 7 systems. <br>
        </div>
        <div><br>
        </div>
        <div>In the past week or so, we've encountered high-load on the
          web servers (primary consumers being apache and afsd) during
          periods of increased traffic, and we're trying to identify
          ways to tune performance. </div>
      </div>
    </blockquote>
    "In the past week or so" appears to imply that the high-load was not
    observed previously.  If that is the case, one question to ask is
    "what changed?"  Analysis of the Apache access and error logs
    compared to the prior period might provide some important clues.<br>
    <blockquote type="cite"
cite="mid:CABWMJQUUa4mHFrTR7jAA8gZ9g9R16PqZ2NZ4Nss0zaDqM6915w@mail.gmail.com">
      <div dir="ltr">
        <div>After seeing the following in the logs:</div>
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span
            style="font-family:monospace">2021 11 08 08:52:03 -05:00
            virthost4 [kern.warning] kernel: afs: Warning: We are having
            trouble keeping the AFS stat cache trimmed down under the
            configured limit (current -stat setting: 3000, current
            vcache usage: 18116).</span><br>
          <span style="font-family:monospace">2021 11 08 08:52:03 -05:00
            virthost4 [kern.warning] kernel: afs: If AFS access seems
            slow, consider raising the -stat setting for afsd.</span></blockquote>
      </div>
    </blockquote>
    <p>There is a one-to-one mapping between AFS vnodes and Linux
      inodes.  Unlike some other platforms with OpenAFS kernel modules,
      the Linux kernel module does not strictly enforce the vnode cache
      (aka vcache) limit.  When the limit is reached instead of finding
      a vnode to recycle, new vnodes are created and a background task
      attempts to prune excess vnodes.   Its that background task which
      is logging the text quoted above.  <br>
    </p>
    <blockquote type="cite"
cite="mid:CABWMJQUUa4mHFrTR7jAA8gZ9g9R16PqZ2NZ4Nss0zaDqM6915w@mail.gmail.com">
      <div dir="ltr">
        <div>I increased the disk cache to 10g and the -stat parameter
          to 100000, which has improved things somewhat, but we're not
          quite there yet. </div>
      </div>
    </blockquote>
    <p>As Ben Kaduk mentioned in his reply, callback promises must be
      tracked by both the fileserver and the client.  Increasing the
      vcache (-stat) limit increases the number of vnodes for which
      callbacks must be tracked.  The umbc.edu cell is behind a firewall
      so its not possible for me to probe the fileserver statistics to
      determine if increasing to 100,000 on the clients also requires an
      increase on the fileservers.  If the fileserver callback table is
      full, then it might have to prematurely break callback promises to
      satisfy the new allocation.  A callback break requires issuing an
      RPC to the client whose promise is being broken.<br>
    </p>
    <blockquote type="cite"
cite="mid:CABWMJQUUa4mHFrTR7jAA8gZ9g9R16PqZ2NZ4Nss0zaDqM6915w@mail.gmail.com">
      <div dir="ltr">
        <div>This is the current client cache configuration from one of
          the web servers:<br>
        </div>
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div><span style="font-family:monospace">Chunk files:   281250<br>
              Stat caches:   100000</span></div>
          <div><span style="font-family:monospace"></span></div>
          <span style="font-family:monospace">Data caches:   10000</span><br>
        </blockquote>
      </div>
    </blockquote>
    The data cache might need to be increased if the web servers are
    serving content from more than 18,000 files<br>
    <blockquote type="cite"
cite="mid:CABWMJQUUa4mHFrTR7jAA8gZ9g9R16PqZ2NZ4Nss0zaDqM6915w@mail.gmail.com">
      <div dir="ltr">
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span
            style="font-family:monospace">Volume caches: 200</span><br>
        </blockquote>
      </div>
    </blockquote>
    If the web servers are serving data from 240 volumes, then 200
    volumes is too small.<br>
    <blockquote type="cite"
cite="mid:CABWMJQUUa4mHFrTR7jAA8gZ9g9R16PqZ2NZ4Nss0zaDqM6915w@mail.gmail.com">
      <div dir="ltr">
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span
            style="font-family:monospace">Chunk size:    1048576</span><br>
          <span style="font-family:monospace">Cache size:    9000000 kB</span><br>
          <span style="font-family:monospace">Set time:      no</span><br>
          <span style="font-family:monospace">Cache type:    disk</span></blockquote>
        <div><br>
        </div>
        <div>Has anyone else experienced this? I think the bottleneck is
          with the cache manager and not the file servers themselves,
          because they don't seem to be impacted much during those
          periods of high load, and I can access files in those web
          volumes from my local client without any noticable lag. <br>
        </div>
      </div>
    </blockquote>
    <p>Apart from the cache settings how the web server is configured
      and how it accesses content from /afs matters.  <br>
    </p>
    <p>* Are the web servers configured with mod_waklog to obtain tokens
      for authenticated users?</p>
    <p>* Are PAGs in use?</p>
    <p>* How many active RX connections are there from the cache manager
      to the fileservers?</p>
    <p>* Are the volumes being served primarily RW volumes or RO
      volumes?</p>
    <p>* Are the contents of the volumes frequently changing?<br>
    </p>
    <p>Finally, compared to the AuriStorFS and kafs clients, the OpenAFS
      cache manager suffers from a number of bottlenecks on
      multiprocessor systems due to reliance on a global lock to protect
      internal data structures.  The cache manager's callback service is
      another potential bottleneck because only one incoming RPC can be
      processed at a time and each incoming RPC must acquire the
      aforementioned global lock for the life of the call.   <br>
    </p>
    <p>Good luck,</p>
    <p>Jeffrey Altman</p>
    <p><br>
    </p>
  </body>
</html>
--------------O9iAT32RuXs650YQRjLEG3rv--


--------------ms080001070806040706080806
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC
DGswggXSMIIEuqADAgECAhBAAW0B1qVVQ32wvx2EXYU6MA0GCSqGSIb3DQEBCwUAMDoxCzAJ
BgNVBAYTAlVTMRIwEAYDVQQKEwlJZGVuVHJ1c3QxFzAVBgNVBAMTDlRydXN0SUQgQ0EgQTEy
MB4XDTE5MDkwNTE0MzE0N1oXDTIyMTEwMTE0MzE0N1owcDEvMC0GCgmSJomT8ixkAQETH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