1

My proxy server is spending a lot of time resolving the domain names,is there a way to make gethostbyname cache the result?

DriverBoy
  • 937
  • 1
  • 11
  • 23

1 Answers1

2

Use nscd, the name serivce caching daemon

Gunther Piez
  • 29,760
  • 6
  • 71
  • 103
  • do you mean that after this service is up,subsequent calls by `gethostbyname` will automatically be cached? – DriverBoy May 23 '11 at 08:34
  • This is exactly what it does. Just have a look at the man page. Caching of negative and positive results can be configured separatley, AFAIK – Gunther Piez May 23 '11 at 09:23
  • Sounds like a silly system-specific approach to doing something that could just as easily be accomplished with a caching/proxy nameserver on localhost... – R.. GitHub STOP HELPING ICE May 23 '11 at 21:00
  • Wrong point of view. A caching name server is the heavyweight approach to do something which can be easily accomplished by nscd :-) nscd does does have a slightly different scope, as it does cache `getpwnam()` and `getgrpnam()`. Very effective in avoiding heavy brain damage if you are on a network with a lagging NIS server. – Gunther Piez May 23 '11 at 22:00