Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
how to enable memory cache
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Yaoxing  
View profile  
 More options Oct 21, 3:03 pm
From: Yaoxing <yaoxing.zh...@gmail.com>
Date: Wed, 21 Oct 2009 12:03:16 -0700 (PDT)
Local: Wed, Oct 21 2009 3:03 pm
Subject: how to enable memory cache
Hi all,
I'm new to lighttpd and mod_cache. Here I met some troubles. Could any
one help me?
I have a image server who has 2G memory, without memory cache, vmstat
looks like this:
procs -----------memory---------- ---swap-- -----io---- --system--
-----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us
sy id wa st
 1  0    112  11016  80104 1638712    0    0    38    61    0   13  0
2 95  3  0
 1  1    112   9988  80136 1639872    0    0   872  1144 8126  225  4
8 70 17  0
 0  1    112  10300  80160 1639848    0    0    80  6868 3962  102  0
2 74 24  0
 0  1    112   9804  80160 1639980    0    0     0     0 1790  161  0
1 75 24  0

As you can see, more then 20% CPU time is spent on waiting for IO. To
speed it up, I used mod_cache. These are what I have done:
1. download lighttpd-1.4.23.modcache.v.1.8.0.tar.gz, and configure
with the following command:
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/
info --enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-lfs --with-openssl --with-mysql --with-
zlib --with-memcache --enable-__cxa_atexit --disable-libunwind-
exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-
c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-
plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-
cpu=generic --host=x86_64-redhat-linux

Then make and install. Everything is successful. Then I modified
lighttpd.conf and append following lines:
cache.enable = "enable"
cache.max-memory-size = 1024
and of course enabled mod_cache at the beginning of lighttpd.conf
server.modules              = (
                                "mod_cache",
                                "mod_rewrite",
...
However, after all this, vmstat result still looks the same. No memory
is spent caching anything, and no doubt there is a lot of network
traffic. I think I must have missed something. Can anyone help me?
Thank you!


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
shellcode  
View profile  
 More options Oct 21, 9:06 pm
From: shellcode <shellc...@gmail.com>
Date: Thu, 22 Oct 2009 09:06:36 +0800
Local: Wed, Oct 21 2009 9:06 pm
Subject: Re: how to enable memory cache

full docs at http://www.linux.com.cn/modcache/

you need to use cache.refresh-pattern to enable memory usage. for example:

cache.refresh-pattern = (
   "\.(?i)(jpg|bmp|jpeg|gif|png)$" => "2880 use-memory"

)


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
yaoxing zhang  
View profile  
 More options Oct 22, 5:44 am
From: yaoxing zhang <yaoxing.zh...@gmail.com>
Date: Thu, 22 Oct 2009 17:44:03 +0800
Local: Thurs, Oct 22 2009 5:44 am
Subject: Re: how to enable memory cache
Great. It reduces about 10% CPU usage. Thank you
By the way, I still have another problem. Does lighttpd use only 1 CPU?
Now I can see only 1 CPU is used up to 50%, while other 3 CPUs are
almost not used at all. Is this the way how lighttpd works or should do
anything else for load balance?

Regards,
YX

On 2009年10月22日 09:06, shellcode wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
shellcode  
View profile  
 More options Oct 22, 6:46 am
From: shellcode <shellc...@gmail.com>
Date: Thu, 22 Oct 2009 18:46:51 +0800
Local: Thurs, Oct 22 2009 6:46 am
Subject: Re: how to enable memory cache

you can use server.max-worker = 4.

but keep in mind that modcache's memory cache don't share across lighttpd.
you got server.max-worker * cache.max-memory-size usage.

for example:
server.max-worker = 4
cache.max-memory-size = 256

4 lighttpd's modcache will eat up to 4 * 256M = 1G memory


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
yaoxing zhang  
View profile  
 More options Oct 23, 4:35 am
From: yaoxing zhang <yaoxing.zh...@gmail.com>
Date: Fri, 23 Oct 2009 16:35:53 +0800
Local: Fri, Oct 23 2009 4:35 am
Subject: Re: how to enable memory cache

Thank you so much.
About memory cache I still got a question. Now in my lighttpd.conf I got
following lines:
.....
server.modules                 = (
         "mod_indexfile",
         "mod_cache",
         "mod_rewrite",
         "mod_access",
         "mod_expire",
         "mod_accesslog",
         "mod_dirlisting",
         "mod_staticfile",
         # 8
     )
....
# for cache module
cache.enable = "enable"
cache.max-memory-size = 1024
cache.refresh-pattern = ("\.(?i)(jpg|jpeg|gif|png)$" => "21600 use-memory")

But after one day's observing, I found that free memory doesn't reduce
at all. It seems nothing's cached. This is the vmstat I get:
procs -----------memory---------- ---swap-- -----io---- --system--
-----cpu------
  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy
id wa st
  0  0    112  10148  81468 1673776    0    0    51   155   12   16  1  
4 90  5  0
  0  3    112  10032  81476 1674104    0    0   252     0 4036 1059  1  
5 78 16  0
  0  4    112   9608  81496 1674400    0    0   228   404 4217 1583  2  
6 78 14  0
  0  3    112  10500  81476 1673464    0    0   476  4776 4079  709  2  
4 69 25  0
  0  0    112   9828  81488 1673752    0    0   288     0 4173 1203  2  
6 72 20  0

I also tried not to use "use-memory" option, and set a cache.bases for
file cache. but still, I found nothing there. It seems mod_cache is not
activated. Maybe I'm still missing something?
PS: I'm using the package lighttpd-1.4.23.modcache.v.1.8.0.tar.gz

Regards,
YX


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
shellcode  
View profile  
 More options Oct 23, 5:37 am
From: shellcode <shellc...@gmail.com>
Date: Fri, 23 Oct 2009 17:37:31 +0800
Local: Fri, Oct 23 2009 5:37 am
Subject: Re: how to enable memory cache

you can read http://blog.quehy.com/archives/216.html, it's explain some
cases that modcache don't cache


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google