* getaddrinfo - too many recvmsg calls
@ 2009-07-20 7:05 Zsolt SZALAI
2009-07-20 7:14 ` Rémi Denis-Courmont
0 siblings, 1 reply; 3+ messages in thread
From: Zsolt SZALAI @ 2009-07-20 7:05 UTC (permalink / raw)
To: netdev
Hi!
I'm working with a host that contains sometimes thousands of virtual
ip address.
One of our third-party application calls getaddrinfo for
sanity-checking the given IP.
I've noticed that recvmsg calls inside getaddrinfo are proportioned to
the number of VIPs, causing high system load and "hanging" user
experience when there are lots of VIPs and also the sanitychecks may
have to happen 2-5 times in a second.
The sanitycheck is now really simple, just a
addrinfo hints = { 0, AF_INET, 0, 0, 0, NULL, NULL, NULL };
int result = getaddrinfo(ipAddress, NULL, &hints, &addresses);
call.
I've also noticed that when the vips are configured with `ip` and not
with `ifconfig`, the number of recvmsg calls drops down by a 0.5
multiplier.
Could you advise some other method or optimized execution for this
checks for the environment described?
Or should it be just skipped?
Thanks,
Zsolt Szalai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: getaddrinfo - too many recvmsg calls
2009-07-20 7:05 getaddrinfo - too many recvmsg calls Zsolt SZALAI
@ 2009-07-20 7:14 ` Rémi Denis-Courmont
2009-07-20 7:55 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Rémi Denis-Courmont @ 2009-07-20 7:14 UTC (permalink / raw)
To: ext Zsolt SZALAI; +Cc: netdev@vger.kernel.org
On Monday 20 July 2009 10:05:56 ext Zsolt SZALAI wrote:
> The sanitycheck is now really simple, just a
> addrinfo hints = { 0, AF_INET, 0, 0, 0, NULL, NULL, NULL };
> int result = getaddrinfo(ipAddress, NULL, &hints, &addresses);
> call.
What the heck is this supposed to do?
This piece of code tries to resolve <ipAddress> as numerical IPv4 address *or*
a DNS hostname.
If you want to check that a string is a valid IP address, call inet_pton(). If
you want to check that an IP address is assigned to the system, create a
socket and bind to that address.
--
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: getaddrinfo - too many recvmsg calls
2009-07-20 7:14 ` Rémi Denis-Courmont
@ 2009-07-20 7:55 ` Eric Dumazet
0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2009-07-20 7:55 UTC (permalink / raw)
To: Rémi Denis-Courmont; +Cc: ext Zsolt SZALAI, netdev@vger.kernel.org
Rémi Denis-Courmont a écrit :
> On Monday 20 July 2009 10:05:56 ext Zsolt SZALAI wrote:
>> The sanitycheck is now really simple, just a
>> addrinfo hints = { 0, AF_INET, 0, 0, 0, NULL, NULL, NULL };
>> int result = getaddrinfo(ipAddress, NULL, &hints, &addresses);
>> call.
>
> What the heck is this supposed to do?
> This piece of code tries to resolve <ipAddress> as numerical IPv4 address *or*
> a DNS hostname.
>
> If you want to check that a string is a valid IP address, call inet_pton(). If
> you want to check that an IP address is assigned to the system, create a
> socket and bind to that address.
>
Yes, but beware of ip_nonlocal_bind option (/proc/sys/net/ipv4/ip_nonlocal_bind).
If set to one, bind() will not tell you if address is assigned to the system.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-20 7:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-20 7:05 getaddrinfo - too many recvmsg calls Zsolt SZALAI
2009-07-20 7:14 ` Rémi Denis-Courmont
2009-07-20 7:55 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).