how can I effect DNS Caching on PHP/Memcache application

Posted by Niro on Server Fault See other posts from Server Fault or by Niro
Published on 2012-03-13T21:51:19Z Indexed on 2012/03/18 18:02 UTC
Read the original article Hit count: 405

Filed under:
|
|
|
|

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 !

© Server Fault or respective owner

Related posts about ubuntu

Related posts about dns