1

After installing Centos 7, I noticed that DNS lookups for addresses saved in /etc/hosts take long time, here is example:

time curl -X get http://localhost

real    0m0.159s
user    0m0.004s
sys     0m0.005s

but

time curl -X get http://127.0.0.1

real    0m0.005s
user    0m0.001s
sys     0m0.003s

It takes ~ 0.15 secs to resolve "localhost" by each request.

I make the same tests on another server in the same network with Centos 6.5 but "localhost" is as fast as "127.0.0.1"

  • Compare /etc/nsswitch.conf on the two servers. – jordanm May 2 '15 at 19:55
  • @jordanm i did replaced this file from the other server to this one, but no use. – Mido May 2 '15 at 20:13
2

It's Red Hat Bug 1130239 - Difference in curl performance between RHEL6 and RHEL7:

The libcurl library used an unnecessarily long blocking delay for actions with no active file descriptors, even for short operations.  This meant that some actions, such as resolving a host name using /etc/hosts, took an artificially long time to complete.  The blocking code in libcurl has now been modified so that the initial delay is short, and gradually increases until an event occurs.  Fast libcurl operations now complete more quickly.

Install new version curl from source:

git clone https://github.com/bagder/curl.git
cd curl
yum install libtool
./buildconf
./configure
make
make install

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.