Dec 25 2008

pdnsd - Decrease DNS response time and save bandwidth

Sometimes, when you realize that you could have improved the system with so little effort, we blush. This is what happened to me when I realized that most of the neworking delays could have been avoided with this tiny but wity utility. I knew that having a local caching DNS or the like is the answer but I did not want to use a full fletched DNS server. I found pdnsd - a small proxy DNS server with permanent caching. Perfect!

In a nutshel, pdnsd is a small utility that caches DNS translations locally on the HD, hence next time the server queries the address the response time is likely to be minimal. Usually, the server has to query your ISP’s DNS or whatever DNS server you specified in the /etc/resolve.conf file. In a high performing web servers you are constantly competing with other packets on the network or your network resources. This is a great advantage. By installing pdnsd you achieve the following:

  • Decrease the average DNS response time sharply!
  • Increase your server performance, especially if this server needs to communicate externally a lot like an eCommerce server which constantly needs to communicate with shipping and credit card servers.
  • Save on bandwidth.

Here is how you go about setting up pdnsd on a CentOS server:

1. Download the latest stable rpm:
go to pdnsd download page and look for your relevant rpm. For CentOS 5.2 64bit I got the latest version as of yesterday:

wget http://www.phys.uu.nl/~Erombouts/pdnsd/releases/pdnsd-1.2.7-par_sl5.x86_64.rpm

2. Install the rpm:

rpm -i pdnsd-1.2.7-par_sl5.x86_64.rpm

3. Configure pdnsd to use your current DNS servers:
vi /etc/pdnsd.conf
Paste the following, of-course you should use your DNS servers instead:

server {
label="opendns";
ip = 207.47.4.2,216.237.6.36;
}

4. Start pdnsd and test that it is actually working

service pdnsd start
 dig @127.0.0.1 yahoo.com

If you get the IP, it is working. Notice the response time, if you try again you will see a sharp decrease in response time. My servers’ second response time is almost always between 1-0 ms.

5. Set pdnsd to start automatically on boot

vi /etc/default/pdnsd

Enter the following and save:

START_DAEMON=yes

Also make sure the daemon is set to auto start on boot. I use ‘ntsysv’, you can use chkconfig or whatever you are used to.

6. Set your server to use the pdnsd instead of your DNS servers

vi /etc/resolv.conf

Make sure that the first nameserver line is ‘127.0.0.1′. Should look like this:

nameserver 127.0.0.1

7. Restart your network service:

service network restart

How do you know that it is working? try to use any script that needs to go outside to the network, like ‘yum update’. In most cases, you will notice that the second time is much faster. Enjoy!

No responses yet

Nov 05 2008

Understanding MySQL Query Caching Process

These days, websites are expected to perform. No excuses. I also mentioned before that website performance is key for SEO. Well, one easy thing that can be done is turning on MySQL caching. Most servers ship with MySQL in its default configuration which has caching turned off. There are many resources out there if you search enough, however I have found a presentation by Baron Shcwartz: MySQL Query Cache which explains in detail advanced concepts of MySQL Caching. Here is the slide that summarizes the process of MySQL Query Caching:

One response so far

Oct 13 2008

5 Peculiar SEO Tips You Should Know About

The following are tips we have learned to address with any SEO Project in addition to the usual tasks:

1. Investment: the Length of your Domain Registration

Google will always value quality website and quality content. The length of registration that a domain is registered for is one more indicator for Google that a site is here to stay and that its owners have put some efforts into it. This fact is mentioned in the Google patent for its PageRank. In simple words: register your domain for at least 3-5 years for an improved recognition from Google.

See more: Does the Length of a Domain Registration Affect Your Rank?

2. Performance: Fast Sites Rank Higher

Again, if you are serious about your site you will make sure that your users can read your site fast. In some cases it takes some effort to improve a site’s performance, in particular with dynamic content such as a CMS or a Shopping Cart. Make sure to use the right software, apply updates (usually contain performance improvements), and consider tightening up the server’s configuration. A good rule of thumb for serving pages is an average of one second per page or less, with a half a second or less and you are a head of the pack.

See more: Landing page load time now affects keywords’ Quality Scores

3. History: the Age of Sites Linking to Yours Matter

Having incoming links to your sites is what you want. However, it will take time before you will see any significant result. This is because Google measure the age of incoming links to your site and ranks older links with a higher ranking. There is not much here that can be done except make sure that links to your main site remain indefinitely and avoid short term incoming links. Also, if you were considering disposing of an old site that somehow links to your main site - reconsider leaving it as is and letting the links mature like wine.

Many factors are at play here: the age of the domains from which links are pointing to pages on your site, The age of the links themselves, and the age of your own domain. In short, the older the links and domains, the higher the ranking or the rank influence overall.

See more: The Age of a Domain Name

4. Uniqueness: Canonical URL

Every site can decide what is the full URL that it will use. Most sites add the ‘www’ in front of the actual registered domain and some ommit. The dangerous teritory is when sites are dynamically generated, like a DB backed CMS, and links are relative. Hence if a third party linked to your site with the ‘www’ and another third party linked to your site without - it will produce identical content pages with different URLs. From Google’s perspective ‘www.yoursite.com’ and ‘yoursite.com’ are two different URLs. To solve this issue, setup a redirect to your preferred URL - your preferred URL is what is known as Canonical URL.

See more: SEO Advice: URL CanonicalizationCleaning Up Canonical URLs With Redirects

5. Relevance: Google Uses Geolocation to Serve Local Sites

Once more Google is simply trying to do its job: serve pages that are most relevant to you - the search user. Hence, it will retrieve the geolocation for a site and will rank higher local sites to local users. The geolocation data is derived from the IP address. Hence, to get more traffic from Canadian users for example, host your site in Canada.

Peculiar but simple, isn’t it?

One response so far