Re: [squid-users] Squid slows down

From: Henrik Nordstrom <[email protected]>
Date: 19 May 2003 15:52:45 +0200

m�n 2003-05-19 klockan 12.46 skrev Bartek:

> acl magic_words1 url_regex -i mydomain.com
> acl magic_words2 url_regex -i ftp .wmv .swf .asf .rar .dat .cab .exe .mp3
> .mp3? .vqf .tar .tgz .gz ...

This does not look entirely correct..

In the regex based ACL types Squid expects regex patterns, not plain
strings.

Basic rules for regex patterns:

   . matches any character
   \. matches .
   $ matches the end
   ^ mathces the beginning
   * repeats the atom in front of the * 0 or more times

There is a couple of other characters which also have special meanings
when making complex patterns. For a description of these see a guide on
regex patterns. (most UNIX distributions have a "man 5 regex" man page
which documents the regex syntax, and there is numerous resources on the
Internet and at your books store documenting regex usage further).

> delay_pools 2
> delay_class 1 2
> delay_class 2 2
> delay_access 1 allow magic_words1
> delay_access 2 allow magic_words2
> delay_parameters 1 -1/-1 -1/-1
> delay_parameters 2 25000/25000 25000/25000

You do not technically need pool 1. You could just deny magic_words1
from the pool before where you allow the other.....

And with the same per-user and aggregate there is no benefit from using
a class 2 pool. Pool class 2 and 3 is primarily used if you want to
limit each user below the total aggregate bandwidth.

> Aggregate:
> Max: 25000
> Restore: 25000
> Current: -10

This is maxed out..

> When delay pool 2 is filled there is still 50% of bandwidth free for normal
> www browsing.
> I'm not sure if this config is correct anyway.

I suspect quite many "normal www browsing" ends up in your pool 2 with
the above acl pattern.

> I sow in examples inscription like this \.mp3$ and don't exactlty what means
> this "$" at the end.
> I suppose that ".\" is an escape character.

Ok. lets take a little example

   http://www.example.com/some/file.mp3

Then the regex

   \.mp3$

matches the extension.

In english character by character:

   Look for a dot (\.) followed by m p 3 at the end of the string you
are looking in.

The regex

   .amp

on the other hand matches xamp in www.example.com

The regex in english

   Look for any character followed by a m p

A note on acl types: For matching file extensions you should be using
the urlpath_regex type.. given the URL above urlpath_regex looks for
the given patterns in the URL path "/some/file.mp3" while url_regex
looks at the complete URL "http://www.example.com/some/file.mp3"

Hope this makes the world of regex patterns and how they are used in
Squid regex based acls a little easier to get around in..

-- 
Donations welcome if you consider my Free Squid support helpful.
https://www.paypal.com/xclick/business=hno%40squid-cache.org
Please consult the Squid FAQ and other available documentation before
asking Squid questions, and use the squid-users mailing-list when no
answer can be found. Private support questions is only answered
for a fee or as part of a commercial Squid support contract.
If you need commercial Squid support or cost effective Squid and
firewall appliances please refer to MARA Systems AB, Sweden
http://www.marasystems.com/, [email protected]
Received on Mon May 19 2003 - 07:52:55 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:16:44 MST