how can I effect DNS Caching on PHP/Memcache application
- by Niro
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 !