Hello group,
I use nginx-0.8.31 and do try the memcached config from
http://lserinol.blogspot.com/2009/03/speeding-up-your-nginx-server-with.
html.
location ~* .(jpg|png|gif)$ {
access_log off;
expires max;
add_header Last-Modified “Thu, 26 Mar 2000 17:35:45 GMT”;
set $memcached_key $uri;
memcached_pass 127.0.0.1:11211;
error_page 404 = /fetch;
}
But when I do “netstat -an”, I didn’t see port 11211 listening. Am I
missing some thing?
Thanks,
Danny Trinh
Linux Admin
Hello!
On Sun, Dec 27, 2009 at 04:38:59PM -0600, Danny Trinh wrote:
memcached_pass 127.0.0.1:11211;
error_page 404 = /fetch;
}
But when I do “netstat -an”, I didn’t see port 11211 listening. Am I
missing some thing?
Yes, you are. nginx doesn’t listen, it connects to memcached
server which should listen on ip:port you specified. It is up to
you to start memcached and place appropriate data into it.
Also, you probably want to know that on modern operating
systems it is usually bad idea to place files into memory
explicitly. Virtual memory subsystem will do it automatically as
long as you have spare memory on your server, and will likely do
it better than may be done by hand.
Other points in the post you linked are… uhm, questionable too
(you may want to read “incorrect” here, but I’m not going to
argue). You probably want to disregard this post instead of
following it.
Maxim D.
Hi Dounin,
In our system, we have used memcached in the same way as Danny Trinh do.
Recently, I have tried to use a portion of memory for storing cache
files by
mount /dev/shm to some point on filesystem. However, you said that:
Also, you probably want to know that on modern operating
systems it is usually bad idea to place files into memory
explicitly. Virtual memory subsystem will do it automatically as
long as you have spare memory on your server, and will likely do
it better than may be done by hand.
I do not know anything about this automatic mechanism.
Could you explain more about this? Or could you give me some links?
Thanks in advance.
Hi Dounin,
Thx for your link. Linux has a nearly the same mechanism.
However, if the files needed to cache are not physical files, such as
avatars stored as BLOB in MySQL of vBulletin, I think memcached is a
good
solution.
–
Nguyen Viet Cuong
On Monday 28 December 2009, Maxim D. wrote:
Yes, I agree the linked post provides a somewhat twisted scenario for
using
memcache. A better use case is to store full web pages that are
generated by
the app and use memcache timeouts to ensure files served are not stale.
This
would become more useful if you have several web heads and want to share
the
caching.
With one server, I am not sure which will be better - to use the
fastcgi/proxy caching by nginx, or memcache - I am guessing that if
there is
a difference it will be subtle anyway.
–yuval
Hello!
On Mon, Dec 28, 2009 at 08:57:29AM +0900, Nguyen Viet Cuong wrote:
I do not know anything about this automatic mechanism.
Could you explain more about this? Or could you give me some links?
In FreeBSD it’s about 15 years now all available memory are used
as disk cache (as disk cache actually integrated with VM system).
And I belive Linux does the same for a while, too. Exact
algorithms used vary.
Maxim D.