Re: getaddrinfo performance
Ian Holsman <[email protected]>
| Newsgroups | gmane.comp.apache.mod-proxy |
|---|---|
| Message-ID | <[email protected]> |
Bill Stoddard wrote: >I'm doing some profiling of mod_proxy configured as a gateway (aka reverse >proxy) on AIX. Over 50% of the cycles to handle a request are chewed up in >getaddrinfo() (getaddrinfo is doing memsets on big chunks of storage among >other things). > the other thing you could look at is caching the results .. for reverse proxy calls you usually only look at a 5-10 host names and you could cache the dns respones for them. This would work extermly well is you have the backend boxes all behind a single IP > >Here is the call in ap_proxy_http_determine_connection() that wrappers >getaddrinfo. > >err = apr_sockaddr_info_get(&uri_addr, apr_pstrdup(c->pool, uri->hostname), > APR_UNSPEC, uri->port, 0, c->pool); > > >Changing APR_UNSPEC to APR_INET nearly doubles the throughput (140 rps to >265 rps). Replacing getaddrinfo with gethostbyname_r will get the benchmark >to 280 rps. Allan Edwards is reporting significant performance hit on >Windows as well (though not as severe as I'm seeing on AIX). Looks like we >may need a config directive to tell the server to use AF_INET or AF_INETV6. > >Bill > >