Josep Pujadas i Jubany writes:
> 
> I'm thinking if the text files should be erased from db directory 
> after squidGuard -C all
> 
> The log seems like if squidGuard is loading text and db files. So, 
> the filtering could be redundant and slower.
> 
> Is it?

It's not loading both.

One of the main reasons that squidGuard retains its real-time
processing speed (even with very large numbers of domains and urls)
is that it stores all of the domains and urls in in-memory-only
B-trees at startup.

For B-tree definition, see:
http://searchdatabase.techtarget.com/sDefinition/0,290660,sid13_gci508442,00.html

Building the in-memory B-trees is processor-intensive, and (depending
on your hardware configuration) can add several minutes to
squidGuard's startup time.  The B-tree structure is lost when
squidGuard is stopped, and must be recreated from the text files
during the next startup.

If squidGuard's startup time has become problematic for you there
is an alternative. The command 'squidGuard -C listfile' (where
'listfile' is the absolute plain text filename or relative to dbhome)
can be used to pre-build the B-tree structures and store them on
disk as listfile.db.

When squidGuard is started, it reads the squidGuard.conf file and
looks first for the .db version of each of the files listed in
the defined destination groups.  For example, if the squidGuard.conf
file contains:

dest    porn {
        domainlist              porn/domains
        urllist         porn/urls
}

squidGuard will first look for the files <porn/domains.db> and
<porn/urls.db>.  squidGuard does not spend any time creating a B-tree
if it already exists on disk. It will load listfile.db into memory
and go into operation.  If the pre-built B-tree files do not exist,
squidGuard will use the text files <porn/domains> and <porn/urls>
to first build the B-trees, and then go into operation.

How much difference can this make to squidGuard's startup time?
Using the prebuilt .db files, 'squid -k reconfigure' can take less
than 5 seconds.

Updating the .db files
----------------------
When squidGuard is using the prebuilt .db files, changing the text
files has no effect on squidGuard operation until the .db files are
recreated with 'squidGuard -C', or until the .db files are updated
with 'squidGuard -u'. The update option has the advantage of speed;
a running squidGuard can be updated and back in operation in less
than 5 seconds.

The 'squidGuard -u' command looks for a file with the extension
'.diff' and the same name as the text and database files.  For
example, '/blacklists/porn/' might contain:
        domains
        domains.db
        domains.diff
        urls
        urls.db
        urls.diff

The diff files contain entries to be added or deleted from the
pre-built database:
+domain/url to be added
+domain/url to be added
+domain/url to be added
-domain/url to be removed
-domain/url to be removed
-domain/url to be removed

Running <squidGuard -u> followed by <squid -k reconfigure> will then
update the db files. It does not make any changes to the text files;
you'll want to do that manually.

Problems with this process?
---------------------------
- Re-read documentation here: <http://www.squidguard.org/config/>
- Check squidGuard.log for messages
- Re-check the ownership and permissions on your listfile.db files
- Ask questions here on the list (Please run 'squidGuard -v' and
  include the output in your post)

Reply via email to