apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_sockaddr_info_get + server startup time
Date Mon, 23 Jul 2001 22:22:40 GMT
Anyone with a 'private' numeric network (e.g. .theoffice.7 ) is a dufus, +1
in theory :)  

Bill

----- Original Message ----- 
From: "Doug MacEachern" <dougm@covalent.net>
To: <dev@apr.apache.org>
Sent: Monday, July 23, 2001 5:02 PM
Subject: apr_sockaddr_info_get + server startup time


> with a small number of vhosts configured, it takes ages for the server to
> start.  the bottleneck is alloc_listener() -> apr_sockaddr_info_get() ->
> getaddrinfo() call with the default "0.0.0.0" address.  this patch avoids
> the lengthy lookup time and the server fires up right away.  could this be
> done for any hostname that is an ip address (looks_like_ip(hostname)) ?
> any other suggestions welcome, the current server startup time is
> unbearable, especially behind a slow dialup line.
> 
> --- srclib/apr/network_io/unix/sa_common.c      2001/07/23 16:05:00    1.36
> +++ srclib/apr/network_io/unix/sa_common.c      2001/07/23 21:36:43
> @@ -341,7 +341,12 @@
>          char num[8];
>  
>          memset(&hints, 0, sizeof(hints));
> -        hints.ai_flags = AI_CANONNAME;
> +        if (strcmp(hostname, "0.0.0.0") == 0) {
> +            hints.ai_flags = AI_NUMERICHOST;
> +        }
> +        else {
> +            hints.ai_flags = AI_CANONNAME;
> +        }
>          hints.ai_family = family;
>          hints.ai_socktype = SOCK_STREAM;
>          hints.ai_protocol = 0;
> 
> 
> 


Mime
View raw message