apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: apr_sockaddr_info_get + server startup time
Date Mon, 23 Jul 2001 22:13:24 GMT
I was thinking that we simply needed to set hints.ai_flags to 0 (I'd
have done it already if I were 100% sure).

Later, maybe we need to add a special flag to apr_sockaddr_info_get()
to have it then turn on AI_CANONNAME, but for now AI_CANONNAME doesn't
help us AFAIK.

Doesn't that do the trick for you?

Doug MacEachern <dougm@covalent.net> writes:

> 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;
> 
> 

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message