[squid-users] --foreground vs -N

Alex Rousskov rousskov at measurement-factory.com
Wed Sep 18 18:38:32 UTC 2019

On 9/18/19 1:59 PM, B. Cook wrote:

> is there any functional difference between the two?


  --foreground disables backgrounding of the master process.
  -N disables all SMP features and also implies --foreground.

Bugs notwithstanding, the two options should have the same effect in
your particular setup because you do not enable any SMP features.

> In my run file I changed from squid -N to squid --foreground
> [and] cpu usage certainly did increase.

Restarting Squid can increase CPU usage (primarily due to "cold caches"
of various sorts, not just the HTTP response cache), especially when you
restart in the middle of a rising traffic trend.

To expose a bug (if it exists), comparing performance over a week, where
each test starts with a clean same-day-of-week reboot during idle time
would be more convincing, but I do understand that such a comparison
requires a lot of patience and may still be susceptible to traffic
irregularities. Comparing two similar weekdays each after a clean
same-day-of-week reboot during idle time could be good enough.

One thing you may want to check is whether your --foreground Squid is
creating shared memory segments (look in /dev/shm/ or equivalent).
Creating shared memory segments in non-SMP configurations is a bug.
IIRC, we have fixed one or two of those bugs, but there may be more, and
using shared memory tables can decrease performance of non-SMP
configurations (there is no free lunch).



> stock squid.conf plus this:

> cache deny all
> shutdown_lifetime 1 seconds
> dns_nameservers
> cache_mem 1024 MB
> cache_mgr Support_ at _PCSD_0_120
> dns_defnames off
> dns_v4_first on
> max_filedescriptors 65536
> ipcache_size 4096
> read_ahead_gap 512 KB
> quick_abort_min 1024 KB
> pid_filename /run/squid/squid.pid
> forwarded_for off
> eui_lookup off
> hosts_file none
> url_rewrite_extras "%>a %un %>rm myip=%la myport=%lp"
> store_id_extras "%>a %un %>rm myip=%la myport=%lp"
> log_uses_indirect_client off

More information about the squid-users mailing list