How to check if Squid works as a reverse proxy?

We want to reduce the load on one of our web servers, and we run some tests with squid configured as a reverse proxy.

The configuration is given in the following notes:

http_port 80 accel defaultsite = original.server.com

cache_peer original.server.com parent 80 0 no-query origininserver name = myAccel

acl our_sites dstdomain.contentpilot.net

http_access allow our_sites

cache_peer_access myAccel allows our_sites

cache_peer_access myAccel rejects all

The situation we are facing is that the server almost always returns TCP_MISS.

1238022316.988 86 69.15.30.186 TCP_MISS/200 797 GET http://original.server.com/templates/site/images/topnav_givingback.gif - FIRST_UP_PARENT/myAccel - 1238022317.016 76 69.15.30.186 TCP_MISS/200 706 GET http://original.server.com/templates/site/images/topnav_diversity.gif - FIRST_UP_PARENT/myAccel - 1238022317.158 75 69.15.30.186 TCP_MISS/200 570 GET http://original.server.com/templates/site/images/topnav_careers.gif - FIRST_UP_PARENT/myAccel - 1238022317.344 75 69.15.30.186 TCP_MISS/200 2981 GET http://original.server.com/templates/site/js/home-search-personalization.js - FIRST_UP_PARENT/myAccel - 1238022317.414 85 69.15.30.186 TCP_MISS/200 400 GET http://original.server.com/templates/site/images/submenu_arrow.gif - FIRST_UP_PARENT/myAccel - 1238022317.807 75 69.15.30.186 TCP_MISS/200 2680 GET http://original.server.com/templates/site/js/homeMakeURL.js - FIRST_UP_PARENT/myAccel - 1238022318.666 1401 69.15.30.186 TCP_MISS/200 103167 GET http://original.server.com/portalresource/lookup/wosid/intelliun-2201-301/image2.jpg - FIRST_UP_PARENT/myAccel image/pjpeg 1238022319.057 1938 69.15.30.186 TCP_MISS/200 108021 GET http://original.server.com/portalresource/lookup/wosid/intelliun-2201-301/image1.jpg - FIRST_UP_PARENT/myAccel image/pjpeg 1238022319.367 83 69.15.30.186 TCP_MISS/200 870 GET http://original.server.com/templates/site/images/home_dots.gif - FIRST_UP_PARENT/myAccel - 1238022319.367 80 69.15.30.186 TCP_MISS/200 5052 GET http://original.server.com/templates/site/images/home_search.jpg - FIRST_UP_PARENT/myAccel - 1238022319.368 88 69.15.30.186 TCP_MISS/200 5144 GET http://original.server.com/templates/site/images/home_continue.jpg - FIRST_UP_PARENT/myAccel - 1238022319.368 76 69.15.30.186 TCP_MISS/200 412 GET http://original.server.com/templates/site/js/showFooterBar.js - FIRST_UP_PARENT/myAccel - 1238022319.377 100 69.15.30.186 TCP_MISS/200 399 GET http://original.server.com/templates/site/images/home_arrow.gif - FIRST_UP_PARENT/myAccel - 

We have already tried to delete the entire cache. Any ideas. Could it be that my website tags part of the content each time, even if it has not changed since the last proxy request?

+4
source share
2 answers

What headers send the source server (web server) back with your content? In order to be cached using squid, I believe that you usually need to specify either Last-Modified or ETag in the response header. Web servers usually do this automatically for static content, but if your content is dynamically served (even if from a static source), then you need to make sure that they are there and handle request headers such as If-Modified-Since and If-None -Match.

Also, since I pointed out this question to your next session question --- is there a β€œVary” heading in the answer? For example, β€œVary: Cookie” tells caches that the content may vary depending on the cookie header in the request: therefore, static content wants to delete it. But your web server can add this to all requests if there is a session, regardless of the static / dynamic nature of the data being served.

In my experience, some experiments with HTTP headers to see which effects are cached are of great benefit: I remember that the solution was not always obvious.

+3
source

Examine the headers returned with wirehark or firebug in firefox (the latter is easier to push, but the former will give you lower-level information if you need it).

Look for these elements in the response headers (click the element in the `Net 'view to expand it and view the request and response headers):

  • Last-Modified date β†’ if no reasonable time was set in the past, then it will not be cached
  • Etags -> if these changes change every time the same item is requested, it will be re-selected
  • Cache-Control β†’ Requests from the client with max-age = 0 will (I believe) each time request a new copy of the page
  • (change) Expires header -> If this is set in the past (that is, always expired), then squid will not cache it

As suggested by araqnid, HTTP headers can make a huge difference to a proxy server, which he believes can cache. If your back-end uses apache, then check that static files served without going through any PHP or other application level can be cached.

Also, make sure that the squid settings for maximum_object_size and minimum_object_size are set to reasonable values ​​(4Mb and 0kb by default, which should be fine), and also increases the maximum age of the cache element. (See http://www.visolve.com/squid/squid30/cachesize.php#maximum_object_size for this and other settings)

+1
source

All Articles