You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rex Young <re...@oracle.com> on 2011/03/14 19:42:22 UTC

[users@httpd] mod_cache: will a Thundering Herd be caused by reading cached files?

Hi guys,

I just read about mod_cache and Thundering Herd at 
http://httpd.apache.org/docs/2.2/mod/mod_cache.html

It describes a case of Thundering Herd which may happen when a cached 
file is being updated.  I was wondering why it does not mention another 
possible Thundering Herd caused by reading a cached file.  In latter 
case, when Apache is serving a request by reading a cached file, it may 
last for a big amount of time.  Because the client that requests the 
cached file may be very slow, or the file may be very large in size.

While serving such a request, other requests may arrived and found that 
the cached file is stale and needs to be updated.  But at the same time, 
the Apache has to wait until the read operation to finish.  Because on 
some OSes e.g. Windows you can not delete/replace a file when it is open.

If you know details how Apache handles the situation, could you please 
share it with me? Thank you.

Regards,
Rex


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_cache: will a Thundering Herd be caused by reading cached files?

Posted by Eric Covener <co...@gmail.com>.
On Mon, Mar 14, 2011 at 2:42 PM, Rex Young <re...@oracle.com> wrote:
> Hi guys,
>
> I just read about mod_cache and Thundering Herd at
> http://httpd.apache.org/docs/2.2/mod/mod_cache.html
>
> It describes a case of Thundering Herd which may happen when a cached file
> is being updated.  I was wondering why it does not mention another possible
> Thundering Herd caused by reading a cached file.  In latter case, when
> Apache is serving a request by reading a cached file, it may last for a big
> amount of time.  Because the client that requests the cached file may be
> very slow, or the file may be very large in size.
>
> While serving such a request, other requests may arrived and found that the
> cached file is stale and needs to be updated.  But at the same time, the
> Apache has to wait until the read operation to finish.  Because on some OSes
> e.g. Windows you can not delete/replace a file when it is open.
>
> If you know details how Apache handles the situation, could you please share
> it with me? Thank you.

The slow client using mod_disk_cache would have the file open the
entire time, and it doesn't matter if someone else unlinks it or
replaces it (replace the file, not the contents)  Another thread, the
one who discovers the resoure is now stale, can unlink it and start
streaming the updated file to a scratch directory.  When it's
complete, he puts it in its final location.

Outside of windows, as long as someone has a file open, unlinking it
in the filesystem only affects people who try to open the file later.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org