I am fun of Centos, but sometimes I have to work with Debian. This time that was Ubuntu 14.04. So here is a issue: extremely slow DNS lookup. I have two servers, one is Ubuntu 12.04 and if we checked time for curl

root@ubuntu1:# time curl http://www.setenforce.com/make+ISO.php
real 0m0.547s
user 0m0.011s
sys 0m0.007s

we will see some response. Also, we have another Ubuntu server 14.04 with same network setup. If we checked curl time on this server, we will see

root@ubuntu2:# time curl http://www.setenforce.com/make+ISO.php
real 0m6.058s
user 0m0.012s
sys 0m0.008s

Ok, this is a really big difference. So I started to dig. If you put IP address in hosts file time is same on both servers. This is definitely DNS issue. After about a few hours of googling, I found that I have to add the next option in /etc/resolv.conf

options single-request-reopen

If we look man page for resolv.conf we will find

single-request-reopen (since glibc 2.9)
             Sets RES_SNGLKUPREOP in _res.options. The resolver
             uses the same socket for the A and AAAA requests. Some
             hardware mistakenly sends back only one reply. When
             that happens the client system will sit and wait for
             the second reply. Turning this option on changes this
             behavior so that if two requests from the same port are
             not handled correctly it will close the socket and open
             a new one before sending the second request.

And this was a case this time...