1

Not able to cache anything with squid reverse proxy, running in centOS6.5

squid.conf

http_port 81 accel defaultsite=example.com:8080 no-vhost

cache_peer example.com.ip.address parent 8080 0 no-query originserver name=myAccel

acl our_sites dstdomain example.com

http_access allow our_sites

cache_peer_access myAccel allow our_sites
cache_peer_access myAccel deny all


cache_dir ufs /tmp/squid/cache 4000 16 256
coredump_dir /tmp/squid/cache

cache_mem 500 MB
maximum_object_size_in_memory 512 KB
minimum_object_size 0 KB 
maximum_object_size 200 MB

refresh_pattern .   0 20% 4320 store-stale

access.log

1453410187.703     21 10.0.2.2 TCP_CLIENT_REFRESH_MISS/200 738 GET http://example.com:8080/sample.json - FIRSTUP_PARENT/example.com.ip.address application/json
1453410187.923     21 10.0.2.2 TCP_CLIENT_REFRESH_MISS/200 733 GET http://example.com:8080/sample.json - FIRSTUP_PARENT/example.com.ip.address application/json

squid -v

[root@localhost vagrant]# squid -v
Squid Cache: Version 3.5.13
Service Name: squid
configure options:  '--prefix=/usr' '--includedir=/usr/include' '--datadir=/usr/share' '--bindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--localstatedir=/var' '--sysconfdir=/etc/squid' '--with-openssl' --enable-ltdl-convenience

header response

Cache-Control → no-transform,max-age=300,s-maxage=900
Connection → keep-alive
Content-Encoding → gzip
Content-Type → application/json
Date → Thu, 21 Jan 2016 21:03:07 GMT
Server → Apache-Coyote/1.1
Transfer-Encoding → chunked
Vary → Accept-Encoding
Via → 1.1 localhost.localdomain (squid/3.5.13)
X-Cache → MISS from localhost.localdomain

running squid as

[root@localhost vagrant]# squid -NCd1
2016/01/21 21:13:17| Set Current Directory to /tmp/squid/cache
2016/01/21 21:13:17| Starting Squid Cache version 3.5.13 for x86_64-pc-linux-gnu...
2016/01/21 21:13:17| Service Name: squid
2016/01/21 21:13:17| Process ID 7399
2016/01/21 21:13:17| Process Roles: master worker
2016/01/21 21:13:17| With 1024 file descriptors available
2016/01/21 21:13:17| Initializing IP Cache...
2016/01/21 21:13:17| DNS Socket created at [::], FD 8
2016/01/21 21:13:17| DNS Socket created at 0.0.0.0, FD 9
2016/01/21 21:13:17| Adding domain XXXXXX from /etc/resolv.conf
2016/01/21 21:13:17| Adding nameserver 10.0.2.3 from /etc/resolv.conf
2016/01/21 21:13:17| Logfile: opening log daemon:/var/logs/access.log
2016/01/21 21:13:17| Logfile Daemon: opening log /var/logs/access.log
2016/01/21 21:13:17| Unlinkd pipe opened on FD 15
2016/01/21 21:13:17| Store logging disabled
2016/01/21 21:13:17| Swap maxSize 4096000 + 512000 KB, estimated 354461 objects
2016/01/21 21:13:17| Target number of buckets: 17723
2016/01/21 21:13:17| Using 32768 Store buckets
2016/01/21 21:13:17| Max Mem  size: 512000 KB
2016/01/21 21:13:17| Max Swap size: 4096000 KB
2016/01/21 21:13:17| Rebuilding storage in /tmp/squid/cache (clean log)
2016/01/21 21:13:17| Using Least Load store dir selection
2016/01/21 21:13:17| Set Current Directory to /tmp/squid/cache
2016/01/21 21:13:17| Finished loading MIME types and icons.
2016/01/21 21:13:17| HTCP Disabled.
2016/01/21 21:13:17| Configuring Parent exampl.com.ip/8085/0
2016/01/21 21:13:17| Squid plugin modules loaded: 0
2016/01/21 21:13:17| Adaptation support is off.
2016/01/21 21:13:17| Accepting reverse-proxy HTTP Socket connections at local=[::]:81 remote=[::] FD 18 flags=9
2016/01/21 21:13:17| Done reading /tmp/squid/cache swaplog (11 entries)
2016/01/21 21:13:17| Finished rebuilding storage from disk.
2016/01/21 21:13:17|        11 Entries scanned
2016/01/21 21:13:17|         0 Invalid entries.
2016/01/21 21:13:17|         0 With invalid flags.
2016/01/21 21:13:17|        11 Objects loaded.
2016/01/21 21:13:17|         0 Objects expired.
2016/01/21 21:13:17|         0 Objects cancelled.
2016/01/21 21:13:17|         0 Duplicate URLs purged.
2016/01/21 21:13:17|         0 Swapfile clashes avoided.
2016/01/21 21:13:17|   Took 0.03 seconds (418.25 objects/sec).
2016/01/21 21:13:17| Beginning Validation Procedure
2016/01/21 21:13:17|   Completed Validation Procedure
2016/01/21 21:13:17|   Validated 11 Entries
2016/01/21 21:13:17|   store_swap_size = 44.00 KB
2016/01/21 21:13:18| storeLateRelease: released 0 objects

any pointers and what else could be missing?

3
  • curl -I link_to_the_object give TCP_MEM_HIT while the same link/object in the browser gives a TCP_MISS
    – ZeTradr
    Jan 21, 2016 at 22:29
  • If a curl request causes a hit and a browser request causes a miss, check the request headers in the browser request. They could be requesting that no cache be used.
    – Chad Clark
    Jan 23, 2016 at 7:09
  • indeed; weird that with nginx similar setup wasn't an issue
    – ZeTradr
    Jan 25, 2016 at 23:21

0

You must log in to answer this question.

Browse other questions tagged .