Speed up POW DNS Lookup

Posted by Anton Katunin on 1 September 2013
Tags: code, pow, hosts, powder, slow, dns lookup

I'm using POW as a proxy to my local dev server in development. That gives me nice local *.dev domain names. However I've noticed that it takes 10 seconds to load a singe page in Chrome. Of course, I thought, It does like 80 requests as each asset is served as a separate file in development. But after investigating it a bit more DNS lookup for each request was 3 seconds and for some reasons it was like that for every single http request.

After looking around turns out that the issue DNS resolver checks my main DNS server first if it knows anything about *.dev domains, if not then it checks the next dns server and so on. Which results in 3 seconds delay.

First thing. I had 'default' rule in pow to proxy port 3000 if now specific domains was matched. So I've added app specific domain I was using for the development -> storyline which gave me storyline.dev

Second. I've installed powder

gem install powder

and used host command to write my domains into the /etc/hosts file

powder host

after that DNS lookup decreased from 3s to 1ms. Pretty good time saver.