Re: Squid 3.2 performance question

From: Alexander Komyagin <komyagin_at_altell.ru>
Date: Mon, 26 Mar 2012 19:22:44 +0400

On Fri, 2012-03-23 at 19:46 +0100, Henrik Nordström wrote:
> fre 2012-03-23 klockan 19:49 +0400 skrev Alexander Komyagin:
>
> > It seems I finally figured out where the problem is. Squid 3.2.0.16
> > performs host verification for each request. And this verification
> > produces the call to libc getaddrinfo() function (converting IP address
> > from text to numeric in my case), but uClibc implementation of this
> > functions looks like not aware of AF_HOSTNUMERIC hint flag, thus
> > performing full lookup (I haven't checked details yet). With RSBAC-Net
> > turned on it's too much overhead. (Actually there are two calls for such
> > conversion per request - one more is in url.cc:urlParseFinish()
> > function)
>
> Why is the overhead with RSBAC-Net that high in this case?
>
> getaddrinfo() is a quite frequenty used call.
>
> But I agree that getaddrinfo for converting textual ip to addrinfo to
> compare with resolved hostname may be a bit overkill. Not even sure why
> we are converting textual IP to to addrinfo there, we should already
> have it in IpAddress internal representaion form.
>
> > After adding a special hack for numeric IP address conversion requests
> > in Squid (avoiding call to real getaddrinfo() in that case), the
> > performance problem has gone (workers work fine too!).
>
> Good!
>
>
>

And here is the mentioned patch. I guarded it with "#ifdef __UCLIBC__",
so it can be seamlessly integrated into upstream if needed. But still it
would be better to wait until uClibc is fixed.

Also falling back to bundled functions as Amos suggests, in case uClibc
is used, can't be done without some additional modifications to them
(for example, their declarations conflict with ones in netdb.h file,
which can't be dropped).

-- 
Best wishes,
Alexander Komyagin

Received on Mon Mar 26 2012 - 15:25:01 MDT

This archive was generated by hypermail 2.2.0 : Wed Mar 28 2012 - 12:00:07 MDT