Re: Apache 2.4 memcached module not caching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Final configuration look like this:

LoadModule cache_module modules/mod_cache.so
LoadModule cache_socache_module modules/mod_cache_socache.so
LoadModule socache_memcache_module modules/mod_socache_memcache.so


# Enable cache for /api folder from root /var/www/html/api
CacheEnable socache /api
# Connect to memcached server
 CacheSocache memcache:localhost:11211
# Few more options
 CacheSocacheMaxSize 512000
 CacheSocacheMaxTime 86400

Checked with httpd -M and modules are loaded.

I've checked (lsof | grep cache). The following modules are loaded:

httpd       443  2740         apache  mem       REG                8,2     11176    2492656 /usr/lib64/httpd/modules/mod_socache_memcache.so

httpd       443  2740         apache  mem       REG                8,2     77352    2492592 /usr/lib64/httpd/modules/mod_cache.so

I removed the IfModule and no error appears.

Memcached statisctics with telnet:

telnet 127.0.0.1 11211
stats

STAT cmd_get 131
STAT cmd_set 2

Apache log:


[Thu Aug 07 11:24:47.429792 2014] [core:trace5] [pid 2611:tid 140526816745216] protocol.c(618): [client 192.168.1.40:40952] Request received from client: GET /api/1.jpg HTTP/1.0
[Thu Aug 07 11:24:47.429828 2014] [http:trace4] [pid 2611:tid 140526816745216] http_request.c(301): [client 192.168.1.40:40952] Headers received from client:
[Thu Aug 07 11:24:47.429831 2014] [http:trace4] [pid 2611:tid 140526816745216] http_request.c(305): [client 192.168.1.40:40952]   Host: 192.168.1.127
[Thu Aug 07 11:24:47.429833 2014] [http:trace4] [pid 2611:tid 140526816745216] http_request.c(305): [client 192.168.1.40:40952]   User-Agent: ApacheBench/2.3
[Thu Aug 07 11:24:47.429835 2014] [http:trace4] [pid 2611:tid 140526816745216] http_request.c(305): [client 192.168.1.40:40952]   Accept: */*
[Thu Aug 07 11:24:47.429844 2014] [cache:debug] [pid 2611:tid 140526816745216] cache_storage.c(664): [client 192.168.1.40:40952] AH00698: cache: Key for entity /api/1.jpg?(null) is http://192.168.1.127:80/api/1.jpg?
[Thu Aug 07 11:24:47.430332 2014] [cache:debug] [pid 2611:tid 140526816745216] mod_cache.c(636): [client 192.168.1.40:40952] AH00763: cache: running CACHE_OUT filter
[Thu Aug 07 11:24:47.430339 2014] [cache:debug] [pid 2611:tid 140526816745216] mod_cache.c(665): [client 192.168.1.40:40952] AH00764: cache: serving /api/1.jpg
[Thu Aug 07 11:24:47.430368 2014] [http:trace3] [pid 2611:tid 140526816745216] http_filters.c(963): [client 192.168.1.40:40952] Response sent with status 200, headers:
[Thu Aug 07 11:24:47.430371 2014] [http:trace5] [pid 2611:tid 140526816745216] http_filters.c(970): [client 192.168.1.40:40952]   Date: Thu, 07 Aug 2014 08:24:47 GMT
[Thu Aug 07 11:24:47.430372 2014] [http:trace5] [pid 2611:tid 140526816745216] http_filters.c(973): [client 192.168.1.40:40952]   Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.4.30
[Thu Aug 07 11:24:47.430374 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   Last-Modified: Mon, 04 Aug 2014 15:08:06 GMT
[Thu Aug 07 11:24:47.430384 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   ETag: \\"1c7bd-4ffcf1b2ba180\\"
[Thu Aug 07 11:24:47.430386 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   Accept-Ranges: bytes
[Thu Aug 07 11:24:47.430388 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   Content-Length: 116669
[Thu Aug 07 11:24:47.430389 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   Age: 204
[Thu Aug 07 11:24:47.430391 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   Connection: close
[Thu Aug 07 11:24:47.430393 2014] [http:trace4] [pid 2611:tid 140526816745216] http_filters.c(806): [client 192.168.1.40:40952]   Content-Type: image/jpeg

This is a basic configuration for static content caching with memcached and work wonderful.

Thank you!


On Wed, Aug 6, 2014 at 5:37 PM, Eric Covener <covener@xxxxxxxxx> wrote:
On Wed, Aug 6, 2014 at 10:28 AM, Solo Luke <sololuke2013@xxxxxxxxx> wrote:
> I removed IfModule and I get errors.

That's the point. You need to load modules you want used.

--
Eric Covener
covener@xxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux