You're viewing old version number 31. - Current version
Nginx and Memcached - September 2014
On Oct 2, 2014, I installed Memcached.
apt-get install memcached
The above installed version 1.4.13.
As of Oct 20, 2014, the latest stable memcached release is v1.4.21.
/etc/memcached.conf
/etc/init.d/memcached
/usr/share/memcached/scripts/start-memcached
listens on port 11211
http://wiki.nginx.org/HttpMemcachedModule
http://nginx.org/en/docs/http/ngx_http_memcached_module.html
https://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/
http://blog.octo.com/en/http-caching-with-nginx-and-memcached/
http://stackoverflow.com/questions/5150995/how-to-configure-nginx-with-memcached-to-serve-html
https://wildlyinaccurate.com/blazing-fast-wordpress-with-nginx-and-memcached
enhanced module:
https://github.com/bpaquet/ngx_http_enhanced_memcached_module
Perl Clients
Pure Perl:
Cache::Memcached
http://search.cpan.org/~dormando/Cache-Memcached-1.30/lib/Cache/Memcached.pm
Perl client written in C:
Cache::Memcached::Fast
http://search.cpan.org/~kroki/Cache-Memcached-Fast-0.22/lib/Cache/Memcached/Fast.pm
Installed on Oct 20, 2014
perl -MCPAN -e 'install Cache::Memcached::Fast'
http://search.cpan.org/~mdorman/Memcached-Client-2.01/lib/Memcached/Client.pm
install failed
http://search.cpan.org/~elizabeth/Cache-Memcached-Managed-0.24/lib/Cache/Memcached/Managed.pm
Installed on Oct 20, 2014
perl -MCPAN -e 'install Cache::Memcached::Managed'
that install managed to install Cache::Memcached.
http://search.cpan.org/dist/Cache-Memcached-libmemcached/lib/Cache/Memcached/libmemcached.pm
Installed on Oct 20, 2014
perl -MCPAN -e 'install Cache::Memcached::libmemcached '
http://libmemcached.org/libMemcached.html
docs
https://code.google.com/p/memcached/wiki/NewProgramming
https://github.com/memcached/memcached/blob/master/doc/protocol.txt
https://code.google.com/p/memcached/wiki/NewCommands
http://lzone.de/articles/memcached.htm
http://skipperkongen.dk/2013/01/21/summary-of-memcached-commands-as-used-through-telnet/
[X] http://www.journaldev.com/16/memcached-telnet-commands-with-example
[X] http://blog.elijaa.org/index.php?post/2010/05/21/Memcached-telnet-command-summary
For my new uses, I think Redis will be easier. Redis allows a hash type, so that I can purge the entire cache for a top level domain. And since I host multiple websites on the same server and store those sites' content in the same Redis server, it's easier to remove the cache for one site within Redis.
Within Memcached, I could store key-value data like this:
birdbrainsbrewing.com-1 "html content for page id 1"
birdbrainsbrewing.com-5 "html content for page id 5"
maketoledo.com-1 "html content for page id 1"
But I cannot determine how to remove all the keys for one domain. For Redis, I delete the hash birdbrainsbrewing.com and all those cache pages are removed.
At the moment, it seems that I can only delete one key at a time for Memcached. A flush_all command will remove the entire cache. That's fine if I only hosted one site within Memcached.
For Memcached, I would need to run a version or instance of server for each site that's hosted on the same Linux server, and then specify the port number within my Grebe YAML config file. If this is possible to do.
Then key-value would be simply:
1 'html for page id 1'
2 'html for page id 2'
https://code.google.com/p/memcached/wiki/NewConfiguringServer#Multiple_Instances
https://gist.github.com/gimler/612961
http://www.nginxtips.com/configure-multiple-memcached-instances/
http://serverfault.com/questions/361894/dividing-memcached-between-sites
http://www.vionblog.com/multiple-memcached-instances-on-one-server/
simple instance startup:
memcached -m 24 -p 11212 -d
#nginx - #memcached - #cache - #scalability
From JR's : articles
343 words - 4012 chars
- 1 min read
created on
updated on
- #
source
- versions
Related articles
Nginx and Memcached - September 2014 - Dec 01, 2014