Re: [squid-users] CPU saturation?

From: Denis Vlasenko <[email protected]>
Date: Wed, 16 Nov 2005 16:34:40 +0200

On Wednesday 16 November 2005 14:49, James Vanns wrote:
> On Wed, 2005-11-16 at 12:41 +0000, James Vanns wrote:
> > <snip>
> > > > With approximately 3000 open file descriptors (configured at compile
> > > > time and set at runtime with ulimit -HSn 16384) and an equivalent no. of
> > > > client/server TCP connections we see a constant CPU usage of ~95-100%.
> > > > Is this normal!? The hardware is as follows:
> > >
> > > I don't think so. Try strace and ltrace on running squid.
> >
> > Yeah I have actually run squid through strace and the only alarming
> > thing is the huge amount of bind() calls on 0.0.0.0 and port htons (0).
> > And by huge amount I mean practically every lookup (I guess somehow this
> > is related to the internal DNS lookups).
>
> Sorry I should have said 'squid's internal resolver' to avoid
> confusion ;)

Parts of my squid.conf which may be, or may be not relevant:

# DONT! This incurs reverse DNS lookup if you supplied numeric IP
# (and 5 min (!!!) timeout if that IP does not have reverse DNS set up)
#acl ads dstdomain 81.222.128.3 www.linkexchange.ru ad0.bigmir.net bbn.img.com.ua

...

# This option is only available if Squid is rebuilt with the
# --disable-internal-dns option
# Specify the location of the executable for dnslookup process.
# cache_dns_program /usr/app/squid-2.5.STABLE10/libexec/dnsserver
# dns_children 5
# dns_retransmit_interval 5 seconds
# dns_timeout 5 minutes
# dns_defnames off

# dns_nameservers
# none

...

# negative_ttl 5 minutes

# positive_dns_ttl 6 hours

# negative_dns_ttl 5 minutes

...

# TAG: incoming_icp_average
# TAG: incoming_http_average
# TAG: incoming_dns_average
# TAG: min_icp_poll_cnt
# TAG: min_dns_poll_cnt
# TAG: min_http_poll_cnt
# Heavy voodoo here. I can't even believe you are reading this.
# Are you crazy? Don't even think about adjusting these unless
# you understand the algorithms in comm_select.c first!
# incoming_icp_average 6
# incoming_http_average 4
# incoming_dns_average 4
# min_icp_poll_cnt 8
# min_dns_poll_cnt 8
# min_http_poll_cnt 8

As you can see, I left everything commented out. Is your squid.conf different?

Also, I did "lsof -nP | grep squid | $PAGER"

I see only one UDP socket:

squid 1255 squid 4u IPv4 4121 UDP *:32795

and then

strace -p `pidof squid` 2>&1 | grep -v ^poll

shows that my squid does not open/close/bind/whatever it.
Squid mostly does:

sendto(4, "9\335\1\0\0\1\0\0\0\0\0\0\4auto\6search\3msn\3com"..., 37, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, 16) = 37
recvfrom(4, "9\335\201\200\0\1\0\6\0\0\0\0\4auto\6search\3msn\3com"..., 16384, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, [16]) = 196
recvfrom(4, 0x80cbe00, 16384, 0, 0xbfffc9d8, 0xbfffc9d4) = -1 EAGAIN (Resource temporarily unavailable)
sendto(4, "!j\1\0\0\1\0\0\0\0\0\0\ncaricatura\2ru\0\0\1\0\1", 31, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, 16) = 31
recvfrom(4, "!j\201\200\0\1\0\1\0\0\0\0\ncaricatura\2ru\0\0\1\0\1\300"..., 16384, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, [16]) = 47
recvfrom(4, 0x80cbe00, 16384, 0, 0xbfffc9d8, 0xbfffc9d4) = -1 EAGAIN (Resource temporarily unavailable)
sendto(4, "\27\271\1\0\0\1\0\0\0\0\0\0\3img\2go\4mail\2ru\0\0\1\0"..., 32, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, 16) = 32
recvfrom(4, "\27\271\201\200\0\1\0\1\0\0\0\0\3img\2go\4mail\2ru\0\0"..., 16384, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, [16]) = 48
recvfrom(4, 0x80cbe00, 16384, 0, 0xbfffc9d8, 0xbfffc9d4) = -1 EAGAIN (Resource temporarily unavailable)
sendto(4, "\r\321\1\0\0\1\0\0\0\0\0\0\6rating\3ukr\3net\0\0\1\0\1"..., 32, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, 16) = 32
recvfrom(4, "\r\321\201\200\0\1\0\1\0\0\0\0\6rating\3ukr\3net\0\0\1"..., 16384, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, [16]) = 48
recvfrom(4, 0x80cbe00, 16384, 0, 0xbfffc9d8, 0xbfffc9d4) = -1 EAGAIN (Resource temporarily unavailable)
sendto(4, "I5\1\0\0\1\0\0\0\0\0\0\3www\6pravda\2ru\0\0\1\0\1", 31, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, 16) = 31
recvfrom(4, "I5\201\200\0\1\0\1\0\0\0\0\3www\6pravda\2ru\0\0\1\0\1\300"..., 16384, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, [16]) = 47
recvfrom(4, 0x80cbe00, 16384, 0, 0xbfffc9d8, 0xbfffc9d4) = -1 EAGAIN (Resource temporarily unavailable)
sendto(4, "\347s\1\0\0\1\0\0\0\0\0\0\3www\fhypertracker\3co"..., 38, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, 16) = 38
recvfrom(4, "\347s\201\200\0\1\0\2\0\0\0\0\3www\fhypertracker\3co"..., 16384, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.22.5")}, [16]) = 68
recvfrom(4, 0x80cbe00, 16384, 0, 0xbfffc9d8, 0xbfffc9d4) = -1 EAGAIN (Resource temporarily unavailable)

--
vda
Received on Wed Nov 16 2005 - 07:35:56 MST

This archive was generated by hypermail pre-2.1.9 : Thu Dec 01 2005 - 12:00:09 MST