Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 3 nodes in a web server cluster. Each node is running Squid on the LAN interface and Apache on the localhost interface. Squid caches properly for each server individually, but I don't believe I setup cache peers correctly.

cache_peer 127.0.0.1 parent 80 0 no-query originserver name=Server1
cache_peer Server2 sibling 80 3130 proxy-only
cache_peer Server3 sibling 80 3130 proxy-only
cache_peer_access Server1 allow MYDOMAIN

Each server has similar cache_peer settings except each is its own parent and uses the other two servers as siblings. My goal is to improve hit rate as much as possible, but I don't know if I'm understanding the cache peer logic correctly.

I want Squid to try to find http://www.example.com/mypage/ in it's local cache, and if it's not query the siblings until it finds it. If it can't find it, THEN it should hit Apache.

Am I doing this right?

share|improve this question
    
Are you getting any error message? Why do you believe your setup is not working. –  Khaled Feb 25 '11 at 7:21
    
I don't see anything in the access logs about hitting up a peer for a cache object. Instead, it seems like all the Squid instances are throwing their own TCP_MISS and fetching the object themselves. –  Matt Beckman Feb 28 '11 at 23:02

2 Answers 2

up vote 0 down vote accepted

Squid tries to query each peer via ICP, measures response times and then decides which parent to use. There is common problems:

  • your peers doesn't respond on ICP queries and squid marks them as DEAD
  • your peers doesn't support cache digest
  • you are serving not cacheable content and squid always connects directly
  • your acl rules doesn't allows use other peers

Answer is in your access logs. so try this and give us an example: tail -f /var/log/squid/access.log

share|improve this answer

So in this example, do you have squid listening to your external IP on port 80, and apache bound to localhost:80 on each server?

One thing to check is to make sure you have icp_port 3130 if you're running squid 3.0 or above; in 2.x versions 3130 it was the default but in 3.x it's now 0 (disabled).

share|improve this answer
    
Correct. Each web server has Squid listening on the LAN interface on port 80, and Apache is bound to localhost on port 80. I'm using the Debian Lenny package (2.7). –  Matt Beckman Mar 11 '11 at 17:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.