curl-library
Re: CURLOPT_INTERFACE performance problem
Date: Mon, 12 May 2003 17:16:21 -0400
Yes, that works fine. A similar patch needs to be applied to ftp.c (in the
active mode stuff) which is the only other place that Curl_if2ip() is
called.
Avery Fay
Symantec Corporation
Office:
(781) 530-2489
eMail:
avery_fay_at_symantec.com
Daniel Stenberg <daniel_at_haxx.se>
Sent by: curl-library-admin_at_lists.sourceforge.net
05/09/2003 03:50 AM
Please respond to curl-library
To: libcurl Mailing list <curl-library_at_lists.sourceforge.net>
cc:
Subject: Re: CURLOPT_INTERFACE performance problem
On Thu, 8 May 2003, Avery Fay wrote:
> In my libcurl program, I use CURLOPT_INTERFACE with an IP string
> ("172.16.0.100"). Originally, I thought the the poor performance when
using
> CURLOPT_INTERFACE was inherent in the way Linux implements IP aliases.
> However, I noticed that every time I run my program modprobe's are being
> run for the address and these are generally causing the poor
performance.
> The modprobe's are caused by the call to if2ip (and subsequent ioctl I
> believe which spawns a modprobe from the kernel). If I comment out
if2ip,
> my performance problems go away. I'm not quite sure what the correct
> solution to this problem would be, but possibly attempting to detect
> whether to string passed to curl_easy_setopt is a ip or interface or
host.
> Even better, separate CURLOPT_INTERFACE into CURLOPT_INTERFACE and
> CURLOPT_IP or somewhere along those lines.
>
> BTW, the performance impact is significant (15 times slower in terms of
> connections per second).
Whoa!
I can understand you want this fixed, it is certainly annoying and I
surely
had no idea it could have such an impact. Well, I guess you learn
something
new every day! ;-)
Instead of your suggested new option, I would rather just check for an IP
address first before testing for network interfaces, and thus keep the
current functionality but skip the penalty you experience.
Does this patch fix your problems?
--- connect.c 1 May 2003 13:37:05 -0000 1.54
+++ connect.c 9 May 2003 07:47:34 -0000
@@ -213,7 +213,11 @@
char myhost[256] = "";
in_addr_t in;
- if(Curl_if2ip(data->set.device, myhost, sizeof(myhost))) {
+ /* First check if the given name is an IP address */
+ in=inet_addr(data->set.device);
+
+ if((in == INADDR_NONE) &&
+ Curl_if2ip(data->set.device, myhost, sizeof(myhost))) {
/*
* We now have the numerical IPv4-style x.y.z.w in the 'myhost'
buffer
*/
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com ------------------------------------------------------- Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.comReceived on 2003-05-12