You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Frederic Paillart <Fr...@gemalto.com> on 2008/04/17 12:41:44 UTC

[users@httpd] mod_mem_cache caches incomplete content

Hi all,

I'm using mod_mem_cache to cache iso files provided by tomcat backend
server (using mod_http_proxy).
During the first client download, the iso file is stored into this cache.
If this client stops prematurely the download, the cache contains an
incomplete part of this iso file.
Consequently, for all other requests from all clients, the iso file will
be wrong.
Of course, we have the same behavior for any kind of content (jpeg,
html, ...).

This bug has already been defined partially into the 32735 and 15866 bug
reports,
but I would like to complete it.

We have two cases :
- The backend server doesn't send a complete response. For me, this case
is covered by the 15866 bug report.
I agree that we should be compliant with RFC 2616 and  so treat response
as partial.

- The first client, filling the cache, stops prematurely the download.
In such case, the mod_mem_cache must discard the body response.
I've performed same tests using the mod_disk_cache.
This one discards the body if the connection has been aborted.
"disk_cache: Discarding body for URL http://... because connection has
been aborted."

My feeling is that we should have the same behavior for mem and disk
cache modules.
The mem module is not usable because the integrity of cache content
should not depend of the client.

Fred

PS : I'm doing my tests on Apache 2.2.8 on Linux.


---------------------------------------------------------------------
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


[users@httpd] RE : RE : [users@httpd] mod_mem_cache caches incomplete content

Posted by PAILLART Frederic <Fr...@gemalto.com>.
> In the context of the current state of the mem cache, yes, I do
> consider that a bad idea. The mem cache is not well tested. And in
> addition, on systems with good buffer caches, the disk cache will be
> able to share one memory/buffer cached object across all threads and
> processes and use zero-copy IO (sendfile) to deliver it to the
> network.

OK. So I will try more carefully the disk module.
My production platform will be Linux with 2.6 kernel. 
I hope that Linux kernel buffer caches are able to manage properly objects with such big size. 

>>  I'm preparing a patch to correct the mem module bug, and writing a new
>> cache module based on shared memory.
>>  Do you think that such new module will be useful for the community ?

> Possibly. You'd need to show that it actually outperformed the disk
> cache in some scenarios. It's a topic you should definitely bring up
> on the dev list rather than here.

I plan now to perform some benchmarks before to continue my development.

Thanks a lot for your help, Joshua.
Best regards,

Fred

[users@httpd] Re: RE : [users@httpd] mod_mem_cache caches incomplete content

Posted by Joshua Slive <jo...@slive.ca>.
On Sat, Apr 19, 2008 at 4:54 PM, PAILLART Frederic
<Fr...@gemalto.com> wrote:
>
>
>
> Hi Joshua,
>
>  Thanks a lot for your answer.
>  I was not aware that the disk cache is more performant than mem cache.
>
>  I'm using worker MPM and I've configured my apache server as follow :
>  ServerLimit           4
>  ThreadLimit         502
>  StartServers          1
>  MaxClients         2008
>  MinSpareThreads      25
>  MaxSpareThreads    1024
>  ThreadsPerChild     502
>  ThreadStackSize  100000
>
>  My idea was to maximize the number of threads sharing the same heap to take
> all benefits of the memory cache module.
>  In my context, I have only few objects, but big ones (iso files).
>  It's why my feeling was to use this memory module and such configuration.
>
>  Do you think really that is a bad idea ??

In the context of the current state of the mem cache, yes, I do
consider that a bad idea. The mem cache is not well tested. And in
addition, on systems with good buffer caches, the disk cache will be
able to share one memory/buffer cached object across all threads and
processes and use zero-copy IO (sendfile) to deliver it to the
network.

>
>  I'm preparing a patch to correct the mem module bug, and writing a new
> cache module based on shared memory.
>  Do you think that such new module will be useful for the community ?

Possibly. You'd need to show that it actually outperformed the disk
cache in some scenarios. It's a topic you should definitely bring up
on the dev list rather than here.

Joshua.

---------------------------------------------------------------------
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


[users@httpd] RE : [users@httpd] mod_mem_cache caches incomplete content

Posted by PAILLART Frederic <Fr...@gemalto.com>.
Hi Joshua,

Thanks a lot for your answer.
I was not aware that the disk cache is more performant than mem cache.

I'm using worker MPM and I've configured my apache server as follow :
ServerLimit           4
ThreadLimit         502
StartServers          1
MaxClients         2008
MinSpareThreads      25
MaxSpareThreads    1024 
ThreadsPerChild     502
ThreadStackSize  100000

My idea was to maximize the number of threads sharing the same heap to take all benefits of the memory cache module.
In my context, I have only few objects, but big ones (iso files).
It's why my feeling was to use this memory module and such configuration.

Do you think really that is a bad idea ??

I'm preparing a patch to correct the mem module bug, and writing a new cache module based on shared memory.
Do you think that such new module will be useful for the community ?

Regards

Fred

On Thu, Apr 17, 2008 at 6:41 AM, Frederic Paillart
<Fr...@gemalto.com> wrote:
> Hi all,
>
>  I'm using mod_mem_cache to cache iso files provided by tomcat backend
>  server (using mod_http_proxy).
>  During the first client download, the iso file is stored into this cache.
>  If this client stops prematurely the download, the cache contains an
>  incomplete part of this iso file.
>  Consequently, for all other requests from all clients, the iso file will
>  be wrong.
>  Of course, we have the same behavior for any kind of content (jpeg,
>  html, ...).

This doesn't directly answer your question, but in general, you should
be aware that the disk cache is much more stable, and very-often more
performant than the memory cache. Unless you have a very good reason
to use the memory cache, you should try the disk cache instead.

Joshua.


Re: [users@httpd] mod_mem_cache caches incomplete content

Posted by Joshua Slive <jo...@slive.ca>.
On Thu, Apr 17, 2008 at 6:41 AM, Frederic Paillart
<Fr...@gemalto.com> wrote:
> Hi all,
>
>  I'm using mod_mem_cache to cache iso files provided by tomcat backend
>  server (using mod_http_proxy).
>  During the first client download, the iso file is stored into this cache.
>  If this client stops prematurely the download, the cache contains an
>  incomplete part of this iso file.
>  Consequently, for all other requests from all clients, the iso file will
>  be wrong.
>  Of course, we have the same behavior for any kind of content (jpeg,
>  html, ...).

This doesn't directly answer your question, but in general, you should
be aware that the disk cache is much more stable, and very-often more
performant than the memory cache. Unless you have a very good reason
to use the memory cache, you should try the disk cache instead.

Joshua.

---------------------------------------------------------------------
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