Blog about the Internet, Pakistan and lots more

Tuesday 30th October 2007

Speeding up websites

Web

I hope that you have noticed a great improvement in this site's load times during the last few days. Two major and a number of minor changes have been made that have made things faster and should greatly enhance your experience. Most of these are courtesy of a presentation and resource on the Yahoo developers site, titled Exceptional performance.

Merged CSS

Following the tips in the presentation, firstly, the main CSS files have been merged into one. Earlier, I had separated the CSS into multiple files to make it more manageable to edit and maintain them. However, having the browser load separate files for global layout, the header, the menus and the content, all from another "index.css" file comes with some hefty overheads in terms of HTTP traffic.

Compressed content using mod_deflate

The second optimization was to use Apache's mod_deflate to serve compressed content to browsers that support gzip compression (most of them do). Judging by the output of FireBug, this alone has improved the site's load times by more than 70%. I was quite appalled to see that it originally took about 2-3 minutes to completely load the main page on this connection. After enabling mod_deflate, this is down to around 30 seconds. Still not very fast, but then again, my site has gotten quite rich over the years and I don't exactly have the fastest connectivity in the world.

Image optimization

One of the optimization articles I was studying mentioned OptiPNG which can decrease the size of PNG files. Going through the Ubuntu repository, I found OptiPNG, plus 2 more utilities, pngnq and pngquant.

I installed all of them and tried them out one by one. Though pngquant produces the smallest output, the loss in quality was quite obvious. OptiPNG didn't appear to affect the quality at all, but the size reduction was marginal. pngnq had the right balance of both and that's what I'll use from now.

Pngnq helped cut down the size of images, some by more than half the original size. However, CSS Sprites is what has really gotten me excited about web design and image optimization. This results in a single image that is much smaller than all images combined, while also reducing the number of HTTP requests. A number of images on this site have been combined into a single one and I can use CSS to display the area of the image I want to show.

ETags and No Expire headers

The YSlow plugin gives this site a 'D', but since the blog is currently being served by a single server, disabling ETags won't really serve any purpose.

As for far future Expire headers, I'm still working out how to do this. It would definitely improve caching performance and site load times, but would increase the complexity of the site.

Replacing Apache with Nginx

Though still under testing, Nginx (or Lighttpd) could soon replace Apache as the web server for at least some of my sites. It is ultra fast and efficient and quite simple to configure.

I have yet to receive a lot of traffic on my blog. The current hits hardly cause a dent in the memory, CPU or bandwidth usage. But whenever I get slashdotted (fingers crossed) or the site becomes extremely popular, I now have a number of techniques in place for keeping the site up and performing well.

 

Liked this article? Make it popular:

Posted at 23:05pm PKT  Comments(54) |

Thursday 25th October 2007

Gas supply turned off in Islamabad and Rawalpindi

Islamabad

In case you live in the twin-city area and haven't heard about it, the gas supplies really are down. From what I know, this includes all CNG filling stations and gas supplies to homes.

Apparently, a major maintenance is underway in the main supply lines. It's probably to increase capacity to be able to keep up with the growing demand, which is good news for the environment. The outage will last through tomorrow (Friday).

 

Liked this article? Make it popular:

Posted at 16:13pm PKT  Comments(37) |

Monday 22nd October 2007

PTCL allowed to layoff 29000 employees

Pakistan

From the Dawn article:

The government on Thursday formally allowed the management of the Pakistan Telecommunication Company Limited (PTCL) to lay off more than 29,000 employees under its Rs17 billion voluntary separation scheme (VSS).

Though it appears to be a good deal (for both PTCL and the employees), just the thought of such a large number of people looking for work elsewhere is intimidating. 29,000+ is a pretty huge number, even compared to the world's largest companies.

It also isn't clear yet if this will improve PTCL's services or cause their top talent to leave for greener pastures and leave the giant in an even worse shape. A revamp is definitely required, but most of the recent steps taken by PTCL haven't done much to improve things.

 

Liked this article? Make it popular:

Posted at 23:52pm PKT  Comments(118) |

Friday 19th October 2007

Greetings and condolences

General

Belated Eid greetings to all. Though the holidays were over on Wednesday, I had been busy with moving house (will finally have broadband at the new home soon) and just catching up on things after so many days off. Will hopefully be able to write more soon.

Secondly, I'd like to offer my condolences regarding another tragedy that struck last night in the form of two bomb blasts in Karachi. Over a hundred people perished and lots more were injured when the bombs went off during a procession led by former prime minister, Benazir Bhutto who recently returned from exile.

We can start pointing fingers at the authorities for not taking enough security measures. Or we can also blame Ms Bhutto for not taking the threats seriously, but the sad fact is that all this is still happening in the same country that I live in. For once I'd like to see the perpetrators caught and something permanent done to reduce these incidents over the long term.

 

Liked this article? Make it popular:

Posted at 21:49pm PKT  Comments |

Monday 8th October 2007

Second Quake anniversary

Earthquake

It was 2 years ago that the dreadful Kashmir earthquake struck here. I pray for the souls of the almost 80,000 lives that perished. We should also not forget that countless more survived, yet lost their loved ones, their livelihoods and pretty much everything they had.

 

Liked this article? Make it popular:

Posted at 21:06pm PKT  Comments(1) |

Friday 5th October 2007

Pakistan rated least stable emerging market

Pakistan

According to this article on the Economist (thanks Victor), Pakistan has been rated the least stable of 24 emerging markets, behind Iran and Nigeria of all countries.

political risk index

And the article does give the reason for placing it at the bottom:

Uncertainty over Pakistan's political future, the country goes to the polls on October 6th, keeps it at the bottom. Iran and Nigeria vie with it for vulnerability to surprises.

And that really is a concern. I and the team are right in the middle of a few critical changes to the services we're planning and must be able to work without interruption. However, another crippling strike and more, likely violent, demonstrations in the capital are planned for tomorrow, the day of the presidential election.

I don't quite understand what issue the lawyers and politicians have now (besides not having enough power or money). Things are being done according to the law and if they still have objections, they should voice them properly instead of bringing everything to a grinding halt. Can't we for once just work together for the good of the country instead of creating trouble?

On the positive side, at least Pakistan is now listed as an emerging market.

 

Liked this article? Make it popular:

Posted at 21:06pm PKT  Comments(10) |

Tuesday 2nd October 2007

Benefits and side effects of fasting

General Health

Ramadan, the fasting month is going strong and we're more than half-way through it. Amidst all the blessings of this month, there are some practices that could transform your life if you carried them on throughout the year. The daily routine is probably the most significant of these.

In our normal routine, we get trapped in a vicious cycle of time shortage. We end up sleeping very late (for reasons as innocent as reading online articles, working on that piece of open source code or just meeting up with friends). This in turn causes us to wake up late, yet without adequate sleep. Then we rush off to work without breakfast. At work, we waste more time on Facebook, writing blog postings (like this one) and procrastinating in lots of ways. Then end up staying late to complete that pending piece of important work. Combine that with feeding cycles more suited to a life on Pluto and you have the perfect recipe for disaster.

All this changes in Ramadan (depending on where you live and how you observe it off course). For me, it usually means not getting enough sleep, feeling tired and dozy at work and a diet change that really affects the stomach. These were the side effects. However, things could be a lot better and I hope that now they will be.

Waking up at 3-4am for the pre-dawn meal (sehr) and the morning prayer means you have ample time to get ready for work, catch up on the news and get to work early. You don't waste time on extended lunches and to preserve the sanctity of the fast, you try to avoid any unnecessary confrontations and questionable or unhealthy activities.

You eat the second and last meal of the day at sunset and then are asleep by 10pm to allow you to wake up on time the next day. It is a proven fact that late night eating causes the body to more readily convert the intake into fat, as well as putting strain on the digestive system. Having dinner at or just after sunset avoids all that and you can end up a healthier person.

Off course sticking to such a routine, even in Ramadan, requires a tremendous amount of discipline. Discipline that few of us possess. The temptation to catch a wink after the morning meal is especially strong. So is staying up late, having coffee with friends. And for some reason, a lot of people tend to get edgier, short-tempered and impatient while fasting (never quite understood that one).

Despite lacking the above-mentioned discipline, I feel leaner and better after the past few days. I'm amazed as to how people can gain lots of fat in this month, but that's another story. Having forced myself not to have the morning sleep today, I made it to work by 6:30am through virtually empty roads and had already taken care of the more urgent matters by the time the rest were starting their tasks. I only slept a couple of hours last night, yet am still feeling quite fresh.

My next aim is to continue this routine for the rest of Ramadan. If only it could continue throughout the year.

 

Liked this article? Make it popular:

Posted at 15:13pm PKT  Comments(279) |

Previous Month's Entries
Next Month's Entries