1

In a very high loaded Ubuntu/PHP web server I found that the PHP line:

$memcache->connect("int-aws_ec2.memcached.myapp.net",11211);

sometimes takes ~5 secs.

Replacing the url with the ip address decreases the server load from ~20 to 0

My question is - where are the settings that effect the DNS caching for this? Is it in the server level or the memcache library ? How can I change it ?

Additional info: Ubuntu 10.04 lucid PHP: 5.3.2-1ubuntu4.10 Apache/2.2.14 (Ubuntu) Amazon EC2

Even more info per Celada's comment:

The DNS handling for the memcache server is done by scalr (the platform I use to manage the cloud resources). They have a client located on the instances and their own DNS servers.

/etc/nsswitch.conf - hosts: files dns /etc/resolv.conf: nameserver 172.16.0.23 domain ec2.internal search ec2.internal

The domain is not in hosts.conf To check if I run nscd I used /etc/init.d/nscd stop and received 'no such file' so i guess I dont run nscd.

Thanks !

  • 2
    What are your hostname resolution settings ("hosts" line in /etc/nsswitch.conf and contents of /etc/resolv.conf)? Are you using a local DNS (e.g. 127.0.0.1 in /etc/resolv.conf)? Does the hostname in question appear in /etc/hosts? Are you running nscd? By the way, the underscore character is not valid in host names. – Celada Mar 13 '12 at 22:14
  • Please see post edit – Niro Mar 14 '12 at 7:06
0

I ended up doing double buffering of the ip addresses in APC (PHP Cache) memory. This solves all the DNS timing issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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