File: FAQ-7.html

package info (click to toggle)
squid 1.1.21-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,828 kB
  • ctags: 3,705
  • sloc: ansic: 34,400; sh: 1,975; perl: 899; makefile: 559
file content (279 lines) | stat: -rw-r--r-- 10,340 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<HTML>
<HEAD>
<TITLE>SQUID Frequently Asked Questions: Operational issues</TITLE>
</HEAD>
<BODY>
<A HREF="FAQ-6.html">Previous</A>
<A HREF="FAQ-8.html">Next</A>
<A HREF="FAQ.html#toc7">Table of Contents</A>
<HR>
<H2><A NAME="s7">7. Operational issues</A></H2>

<H2><A NAME="ss7.1">7.1 How do I see system level Squid statistics?</A></H2>

<P>The Squid distribution includes a CGI utility called <EM>cachemgr.cgi</EM>
which can be used to view squid statistics with a web browser.
This document has a section devoted to <EM>cachemgr.cgi</EM> usage
which you should consult for more information.</P>


<H2><A NAME="ss7.2">7.2 How can I find the biggest objects in my cache?</A></H2>

<P>
<PRE>
        sort -r -n +4 -5 access.log | awk '{print $5, $7}' | head -25
</PRE>
</P>


<H2><A NAME="ss7.3">7.3 I want to restart Squid with a clean cache</A></H2>

<P>One way is to add <CODE>-z</CODE> to the command line.</P>

<P>Another, perhaps easier way is to simply remove the <CODE>log</CODE>
file found in the first <CODE>cache_dir</CODE> directory.</P>


<H2><A NAME="ss7.4">7.4 How can I proxy/cache Real Audio?</A></H2>

<P>
<UL>
<LI>Point the RealPlayer at your Squid server's HTTP port (e.g. 3128).
</LI>
<LI>Using the Preferences->Transport tab, select <EM>Use specified transports</EM>
and with the <EM>Specified Transports</EM> button, select use <EM>HTTP Only</EM>.</LI>
</UL>
</P>
<P>The RealPlayer (and RealPlayer Plus) manual states:
<PRE>
Use HTTP Only
        Select this option if you are behind a firewall and cannot
        receive data through TCP.  All data will be streamed through
        HTTP.

        Note:  You may not be able to receive some content if you select
        this option.
</PRE>
</P>

<P>Again, from the documentation:
<PRE>
RealPlayer 4.0 identifies itself to the firewall when making a
request for content to a RealServer.  The following string is
attached to any URL that the Player requests using HTTP GET:

        /SmpDsBhgRl

Thus, to identify an HTTP GET request from the RealPlayer, look
for:

        http://[^/]+/SmpDsBhgRl

The Player can also be identified by the mime type in a POST to
the RealServer.  The RealPlayer POST has the following mime
type:

        &quot;application/x-pncmd&quot;
</PRE>
</P>
<P>Note that the first request is a POST, and the second has a '?' in the URL, so
standard Squid configurations would treat it as non-cacheable. It also looks
rather ``magic.''</P>

<P>HTTP is an alternative delivery mechanism introduced with version 3 players,
and it allows a reasonable approximation to ``streaming'' data - that is playing
it as you receive it.  For more details, see their notes on
<A HREF="http://www.real.com/products/encoder/realvideo/httpstream.html">HTTP Pseudo-Streaming</A>.</P>

<P>It isn't available in the general case: only if someone has made the realaudio
file available via an HTTP server, or they're using a version 4 server, they've
switched it on, and you're using a version 4 client. If someone has made the
file available via their HTTP server, then it'll be cacheable. Otherwise, it
won't be (as far as we can tell.)</P>

<P>The more common RealAudio link connects via their own <EM>pnm:</EM> method and is
transferred using their proprietary protocol (via TCP or UDP) and not using
HTTP. It can't be cached nor proxied by Squid, and requires something such as
the simple proxy that Progressive Networks themselves have made available, if
you're in a firewall/no direct route situation. Their product does not cache
(and I don't know of any software available that does.)</P>

<P>Some confusion arises because there is also a configuration option to use an
HTTP proxy (such as Squid) with the Realaudio/RealVideo players. This is
because the players can fetch the ``<CODE>.ram</CODE>'' file that contains the <EM>pnm:</EM>
reference for the audio/video stream. They fetch that .ram file from an HTTP
server, using HTTP.</P>

<P>
<BLOCKQUOTE>
--Rodney van den Oever &lt;roever@nse.simac.nl&gt;<BR>
--James R Grinter &lt;jrg@blodwen.demon.co.uk&gt;
</BLOCKQUOTE>
</P>


<H2><A NAME="ss7.5">7.5 How can I purge an object from my cache?</A></H2>

<P>A purge feature was added to Squid-1.1.6.  It only allowed you
to purge HTTP objects until Squid-1.1.11.  Squid does not allow
you to purge objects unless it is configured with access controls
in <EM>squid.conf</EM>.  First you must add something like
<PRE>
        acl PURGE method purge
        acl localhost src 127.0.0.1
        http_access allow purge localhost
        http_access deny purge
</PRE>

The above only allows purge requests which come from the local host and
denies all other purge requests.</P>

<P>To purge an object, you can use the <EM>client</EM> program:
<PRE>
        client -m PURGE http://www.miscreant.com/
</PRE>

If the purge was successful, you will see a ``200 OK'' response:
<PRE>
        HTTP/1.0 200 OK
        Date: Thu, 17 Jul 1997 16:03:32 GMT
        Server: Squid/1.1.14
</PRE>

If the object was not found in the cache, you will see a ``404 Not Found''
response:
<PRE>
        HTTP/1.0 404 Not Found
        Date: Thu, 17 Jul 1997 16:03:22 GMT
        Server: Squid/1.1.14
</PRE>
</P>




<H2><A NAME="using-icmp"></A> <A NAME="ss7.6">7.6 Using ICMP to Measure the Network</A></H2>

<P>As of version 1.1.9, Squid is able to utilize ICMP Round-Trip-Time (RTT)
measurements to select the optimal location to forward a cache miss.
Previously, cache misses would be forwarded to the parent cache
which returned the first ICP reply message.  These were logged
with FIRST_PARENT_MISS in the access.log file.  Now we can 
select the parent which is closest (RTT-wise) to the origin 
server.  </P>

<H3>Supporting ICMP in your Squid cache</H3>

<P>It is more important that your parent caches enable the ICMP
features.  If you are acting as a parent, then you may want
to enable ICMP on your cache.  Also, if your cache makes
RTT measurements, it will fetch objects directly if your 
cache is closer than any of the parents.</P>

<P>If you want your Squid cache to measure RTT's to origin servers,
Squid must be compiled with the USE_ICMP option.  This is easily
accomplished by uncommenting "-DUSE_ICMP=1" in <EM>src/Makefile</EM> and/or
<EM>src/Makefile.in</EM>.</P>

<P>An external program called <EM>pinger</EM> is responsible for sending and
receiving ICMP packets.  It must run with root privileges.  After
Squid has been compiled, the pinger program must be installed
separately.  A special Makefile target will install <EM>pinger</EM> with
appropriate permissions.
<PRE>
        % make install
        % su
        # make install-pinger
</PRE>

There are three configuration file options for tuning the
measurement database on your cache.  <EM>netdb_low</EM> and <EM>netdb_high</EM>
specify high and low water marks for keeping the database to a
certain size  (e.g. just like with the IP cache).  The <EM>netdb_ttl</EM>
option specifies the minimum rate for pinging a site.  If
<EM>netdb_ttl</EM> is set to 300 seconds (5 minutes) then an ICMP packet
will not be sent to the same site more than once every five
minutes.  Note that a site is only pinged when an HTTP request for
the site is received.</P>
<P>Another option, <EM>minimum_direct_hops</EM> can be used to try finding
servers which are close to your cache.  If the measured hop count
to the origin server is less than or equal to <EM>minimum_direct_hops</EM>,
the request will be forwarded directly to the origin server.</P>

<H3>Utilizing your parents database</H3>

<P>Your parent caches can be asked to include the RTT measurements
in their ICP replies.  To do this, you must enable <EM>query_icmp</EM>
in your config file:
<PRE>
        query_icmp on
</PRE>

This causes a flag to be set in your outgoing ICP queries. </P>
<P>If your parent caches return ICMP RTT measurements then 
the eighth column of your access.log will have lines 
similar to:
<PRE>
        CLOSEST_PARENT_MISS/it.cache.nlanr.net
</PRE>

In this case, it means that <EM>it.cache.nlanr.net</EM> returned 
the lowest RTT to the origin server.  If your cache measured
a lower RTT than any of the parents, the request will
be logged with
<PRE>
        CLOSEST_DIRECT/www.sample.com
</PRE>
</P>

<H3>Inspecting the database</H3>

<P>The measurement database can be viewed from the cachemgr by
selecting "Network Probe Database."  Hostnames are aggregated
into /24 networks.  All measurements made are averaged over
time.  Measurements are made to specific hosts, taken from
the URLs of HTTP requests.  The recv and sent fields are the
number of ICMP packets sent and received.  At this time they
are only informational.</P>
<P>A typical database entry looks something like this:
<PRE>
    Network          recv/sent     RTT  Hops Hostnames
    192.41.10.0        20/  21    82.3   6.0 www.jisedu.org www.dozo.com 
        bo.cache.nlanr.net        42.0   7.0
        uc.cache.nlanr.net        48.0  10.0
        pb.cache.nlanr.net        55.0  10.0
        it.cache.nlanr.net       185.0  13.0
</PRE>

This means we have sent 21 pings to both www.jisedu.org and
www.dozo.com.  The average RTT is 82.3 milliseconds.  The 
next four lines show the measured values from our parent
caches.  Since <EM>bo.cache.nlanr.net</EM> has the lowest RTT,
it would be selected as the location to forward a request
for a www.jisedu.org or www.dozo.com URL.</P>


<H2><A NAME="ss7.7">7.7 Where so few requests logged as TCP_IMS_MISS?</A></H2>

<P>When Squid receives an <EM>If-Modified-Since</EM> request, it will
not forward the request unless the object needs to be refreshed
according to the <EM>refresh_pattern</EM> rules.  If the request
does need to be refreshed, then it will be logged as TCP_REFRESH_HIT
or TCP_REFRESH_MISS.</P>

<P>If the request is not forwarded, Squid replies to the IMS request
according to the object in its cache.  If the modification times are the
same, then Squid returns TCP_IMS_HIT.  If the modification times are
different, then Squid returns TCP_IMS_MISS.  In most cases, the cached
object will not have changed, so the result is TCP_IMS_HIT.  Squid will
only return TCP_IMS_MISS if some other client causes a newer version of
the object to be pulled into the cache.</P>



<HR>
<A HREF="FAQ-6.html">Previous</A>
<A HREF="FAQ-8.html">Next</A>
<A HREF="FAQ.html#toc7">Table of Contents</A>
</BODY>
</HTML>