New Location

My website has moved to http://www.jasonwhaley.com. Please visit there for the latest and only remain here for legacy content.

Friday, October 2, 2009

Firefox DNS Cache Expiration

Every need to increase the frequency in which Firefox invalidates DNS cache? At my current shop, we use separate DNS servers to draw the lines between parallel environment (e.g. QA and Pre-Production). Switching back and forth between the environments is as easy as modifying my /etc/resolve.conf file. However, Firefox actually caches those hostname mappings retrieved from DNS rather infrequently by default and I'd find myself quickly killing and restarting the Firefox process just to have my browser keep up at the frantic pace I was switching between environments. To expedite this, Firefox has a setting, available at about:config that allows you to modify how often Firefox invalidates its DNS cache.

The preference is Network.dnsCacheExpiration and its value is an Integer that represents the number of seconds to wait before invalidating cache.

I personally set this to 10 seconds to make Firefox somewhat instantly retrieve new IP mappings for the hostnames I was resolving. Conversely, if you wanted to speed up your browsing, you could simply set this value to something like 3600 (one hour in seconds) so you are only ever hitting DNS once an hour.

0 comments: