Sunday, September 23, 2007

An HTTP server with diff capabilities.

These days, there is a surge in the traffic content on the internet. Many sites are serving dynamic content to their users. However, the static content doesn't seem to have lost popularity. Many sites still serve a lot of their pages more or less statically. Furthermore, these static pages don't change very often even though clients are always re-requesting these pages, and asking them to be refreshed. An example would be google's home page. That apart, site administrators always want clients to not cache the page content, because they want clients to see the latest version of any static content that may have changed since the last time they visited. This makes them advertise HTTP headers which forbid the caching of web-pages by browser and proxy caches.

If you notice carefully, even if use wisely, the If-modified-since header involves sending the entire page back in case it was modified. What I'm suggesting here is to use a diff based scheme, wherein the client sends a request to the server indicating a previous page version that it already possesses, along with a flag indicating that it is willing to accept a diff to the current version of the page. The server will now(optionally) send back a patch to the client which it applies to the page that it already possesses. This sending of the patch is optional since the server may not have cached the page to which the client is referring, so that generation of the patch may not be possible at the server end. In this case, the server will send back the whole page as it would in the current scenario.

What this scheme will effectively do is reduce bandwidth consumption dramatically in places where a central proxy is being used to serve many users, and those users seem to be accessing the same static content repeatedly. If the content changes by a bit, or doesn't change at all, this scheme will result in a definite reduction in bandwidth consumption on the internet. However, the trade off here would be CPU time to network bandwidth, since the diff generation and application of the generated patch are both CPU intensive activities as compared to normally sending the whole page.

Bumping up the bandwidth usage.

Have you ever wondered how you can (without too much of effort) use a lot of bandwidth on your local LAN? Well, if you have a central proxy server(gateway machine) through which you connect to the internet or to other computers, then you could do this quite easily.

First of all, configure your browser to use the proxy server installed. Then change the settings so that the browser uses the proxy server even for localhost(your local machine). The browser defaults general bypass the proxy for localhost. On your machine, on port 80, configure a proxy server(squid) to use the proxy server on the gateway machine for making connections.

Now, type your machine's IP address on your browser's address bar, and hit enter, and watch while the packets keep bouncing to and fro the gateway machine and your machine. This happens because your browser will contact the proxy server for the request, which in turn will contact your machine, which will again contact the proxy at the gateway, and so on....

Residents of buildings without elevators live healthier, longer.

According to a recent survey conducted by research scientists at the Montgomery university at Timbaktoo, it has been observed that the average age of people living in buildings without elevators is greater than of those living in buildings with one. Scientists observed a group of people living in the northern part of Timbaktoo city where the buildings are old, do not have elevators and people have a generally lower standard of living as compared to those living in the south, where sky-scrapers abound, and the standard of living is considerably higher. It was expected that the richer would live longer, since they eat healthier food, and can afford costlier medication. The results however were not in accordance with that theory.

As it turns out, the poorer people, with their low standard of living, and simple eating outlive the rich by an average age of 6~7 years. The northers sample space had an average life expectancy of 89 years whereas the southern sample space recorded a mere 82 years. It is believed that this singular occurrence if because of the fact that people living in the poorer parts of the city do not have elevators in their buildings and are forced too use the stairs, which is considered to be a good exercise for the heart and kidneys. Researchers have yet to conclusively nail this as one of the main reasons as to why people in the north live longer.