Load Balancing with DNS

Você pode ler este post em português também


The article of this month will show how is easy to balance the load of an application using your DNS.

However, you must be able to do the following actions:

  1. Take from your web server the responsibility of storing the session data of your application;
  2. To have access to the DNS server that holds the records of your domain;
  3. To have more than one web server to holds the requests (obvious, but it’s good to say…).

If your application is written in PHP, you can treat the first item above trough the session_set_save_handler. It’s beyond the scope of this post to show how to do this, but a visit in PHP website will detail the use.

The big trick is really on the configuration at DNS server (2nd item). You must configure, to the same A record of your application, the both (or more) IP address which can handle the requests. The piece of code bellow has been taken from a zone configuration file of a DNS server:

ns1 IN A
www IN A
mta IN A
app IN A
app IN A

This feature of balancing the hits of a host to different IP addresses at DNS server could be done via SRV records.

The screenshot below shows us (by Apache logs) that both servers are treating the hits.

Application Load Balancing with DNS

Application Load Balancing with DNS

The scenario will complicate a little bit more if your application needs to receive data via upload, which will implies in a common place to save the files.

See you 😉

About Adriano Laranjeira

Software engineer & developer See more at http://about.me/arglbr
This entry was posted in English and tagged , , . Bookmark the permalink.

1 Response to Load Balancing with DNS

  1. Pingback: Adriano Laranjeira » Blog Archive » Load Balancing com DNS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s