Enable mod_cache

63 views
Skip to first unread message

yaoxing zhang

unread,
Nov 3, 2009, 10:02:30 PM11/3/09
to mod_...@googlegroups.com
Hi,
Just want to know, do I need to add -enable parameter when running
configure?
This is the final enabled list I get, seems there's no mod_cache. I
don't know if it's enabled or not.
enabled:
mod_access
mod_accesslog
mod_alias
mod_auth
mod_cgi
mod_compress
mod_dirlisting
mod_evhost
mod_expire
mod_extforward
mod_fastcgi
mod_flv_streaming
mod_indexfiles
mod_mysql_vhost
mod_proxy
mod_redirect
mod_rewrite
mod_rrdtool
mod_scgi
mod_secdownload
mod_setenv
mod_simple_vhost
mod_ssi
mod_staticfile
mod_status
mod_trigger_b4_dl
mod_userdir
mod_usertrack
mod_webdav
disabled:
mod_magnet

--
Regards,
YX

shellcode

unread,
Nov 3, 2009, 10:51:55 PM11/3/09
to mod_...@googlegroups.com
mod_cache isn't in official lighttpd distribution, you need to patched lighttpd source from http://code.google.com/p/lighttpd-improved/

Kevin Yu

unread,
Nov 3, 2009, 11:41:46 PM11/3/09
to mod_...@googlegroups.com

yaoxing zhang

unread,
Nov 4, 2009, 1:34:27 AM11/4/09
to mod_...@googlegroups.com
yeah, that's the version I'm using. It seems I still can't get memory
cache enabled. I enabled debug, and my configuration now looks like below
cache.max-memory-size = 256
cache.debug = "enable"
cache.refresh-pattern = ("^[\s\S]+$" => "21600 use-memory")

And nothing is in /var/log/lighttpd/error.log
I asked this question like 2 weeks ago if you still remember. I also
read your blog about what situations can't mod_cache work. But my server
is just a static image server with about 2000000 small images (15kb in
average). The HTTP headers are correctly set, and no back end server
running.

I ran an http_load stress testing with 100 sessions,180 seconds, and
access for like 3000 sample image, which takes at least 45M memory in
total. However, in htop, lighttpd takes always about 60M memory, no
change at all. I think memory cache is not working properly. Any ideas?

Regards,
YX

shellcode

unread,
Nov 4, 2009, 2:39:01 AM11/4/09
to mod_...@googlegroups.com
how about change


cache.refresh-pattern = ("^[\s\S]+$" => "21600 use-memory")

to

cache.refresh-pattern = ("." => "21600 use-memory")

yaoxing zhang

unread,
Nov 4, 2009, 3:05:07 AM11/4/09
to mod_...@googlegroups.com
Still the same.
I also tried "\.(?i)(jpg|jpeg|gif|png)$", doesn't work either.

Regards,
YX

shellcode

unread,
Nov 4, 2009, 3:27:38 AM11/4/09
to mod_...@googlegroups.com
please post http response header of  using curl -o /dev/null -v http://xxx/xxxx

yaoxing zhang

unread,
Nov 4, 2009, 3:27:00 AM11/4/09
to mod_...@googlegroups.com
Is it possible that some modules maybe conflicting with mod_cache?
I have the following modules enabled:
mod_cache
mod_rewrite
mod_access
mod_expire
mod_accesslog
and configured with
--with-fam
--with-ssl
Regards,
YX

On 2009年11月04日 15:39, shellcode wrote:

shellcode

unread,
Nov 4, 2009, 3:30:01 AM11/4/09
to mod_...@googlegroups.com
no mod_proxy?

yaoxing zhang

unread,
Nov 4, 2009, 3:31:33 AM11/4/09
to mod_...@googlegroups.com
no mod_proxy. it's a image server that only serves static images.
And here is the curl result:
> GET /ProductImages/sku_0005_1.jpg HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: 75.126.135.148
> Accept: */*
>
< HTTP/1.1 200 OK
< Expires: Fri, 04 Dec 2009 08:30:21 GMT
< Cache-Control: max-age=2592000
< Content-Type: image/jpeg
< Accept-Ranges: bytes
< ETag: "3213402665"
< Last-Modified: Sun, 18 Oct 2009 12:05:40 GMT
< Content-Length: 11345
< Date: Wed, 04 Nov 2009 08:30:21 GMT
< Server: lighttpd/1.4.23-devel-42M
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11345 100 11345 0 0 6307 0 0:00:01 0:00:01 --:--:-- 7108Connection
#0 to host 75.126.135.148 left intact

Regards,
YX

On 2009年11月04日 16:30, shellcode wrote:
> no mod_proxy?
>
> >

shellcode

unread,
Nov 4, 2009, 3:52:28 AM11/4/09
to mod_...@googlegroups.com
for local static file caching, you need mod_mem_cache, not mod_cache

mod_mem_cache doc is http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModMemCache

yaoxing zhang

unread,
Nov 4, 2009, 5:32:04 AM11/4/09
to mod_...@googlegroups.com
Thank you. Does it mean, mod_cache must work with a back end proxy?
Regards,
YX

shellcode

unread,
Nov 4, 2009, 5:51:47 AM11/4/09
to mod_...@googlegroups.com
mod_cache is to cache remote files to local disk/memory, so mod_proxy is needed for mod_cache.
mod_mem_cache is to cache local files into memory

yaoxing zhang

unread,
Nov 4, 2009, 6:22:27 AM11/4/09
to mod_...@googlegroups.com
I see. Thanks for explainning.
Regards,
YX

任晓磊

unread,
Nov 4, 2009, 8:16:43 PM11/4/09
to mod_...@googlegroups.com
I think operating system should cache frequently accessed files into
memory, lighty does not need to control it. Am I right?

2009/11/4 shellcode <shel...@gmail.com>:


> mod_cache is to cache remote files to local disk/memory, so mod_proxy is
> needed for mod_cache.
> mod_mem_cache is to cache local files into memory
>


--
Ren Xiaolei

Kevin Yu

unread,
Nov 4, 2009, 9:28:15 PM11/4/09
to mod_...@googlegroups.com
mod_cache now natively support cache files into memory, do not need
load mod_mem_cache any more.

Kevin Yu
Mail: flyi...@gmail.com

任晓磊

unread,
Nov 4, 2009, 9:30:20 PM11/4/09
to mod_...@googlegroups.com
your answer seems not to fit my question.

2009/11/5 Kevin Yu <flyi...@gmail.com>:
--
Ren Xiaolei

shellcode

unread,
Nov 4, 2009, 9:38:23 PM11/4/09
to mod_...@googlegroups.com
OS try to cache every files recently accessed into memory, then OS will drop some cached files at any time.
mod_mem_cache/mod_cache caches files that are useful for web service only.

In summary, sometimes OS cache isn't good enough for faster web service and application cache works good enough

任晓磊

unread,
Nov 4, 2009, 10:42:30 PM11/4/09
to mod_...@googlegroups.com
Should application cache open files with NO CACHE flags to inform OS
not to cache it?
Or else, there would be two copies in memory, one is app's ,the other is OS's.

2009/11/5 shellcode <shel...@gmail.com>:


> OS try to cache every files recently accessed into memory, then OS will drop
> some cached files at any time.
> mod_mem_cache/mod_cache caches files that are useful for web service only.
> In summary, sometimes OS cache isn't good

--
Ren Xiaolei

shellcode

unread,
Nov 4, 2009, 10:58:43 PM11/4/09
to mod_...@googlegroups.com
when one file is cached in application, then there has no disk read access to it for long time, so OS will remove it from cache soon for caching other files.

yaoxing zhang

unread,
Nov 5, 2009, 12:15:31 AM11/5/09
to mod_...@googlegroups.com
Hi again,
I tried mod_mem_cache, it works fine. But I also noticed that expires
header is removed. I'm not sure yet whether it's because of lighttpd
upgrading or mod_mem_cache patch. is there any known issue of mod_mem_cache?

Regards,
YX

yaoxing zhang

unread,
Nov 5, 2009, 12:25:51 AM11/5/09
to mod_...@googlegroups.com
alright, find the solution. simply move mod_mem_cache after mod_expire
would resolve the problem.
thank you for your patient help.

Regards,
YX

Reply all
Reply to author
Forward
0 new messages