Archive

Archive for September, 2008

Responsible use of Indexes

September 23rd, 2008 Comments off

At several stages, I have been asked to benchmark web applications. I always tend to do the light weight stuff at the start, and when it gets into my mind, that the system which is being tested is working some what like it is expected, I steer my course and go for bigger feats. For instance the RatingHQ, was run with a test of hundred thousand registered users and about the same amount of items in each of the sections before releasing for public beta.

Having said the above, the most important matter is that seldom do the programmer check his / her code more than the unit or functional tests. And code thus created would crumple when subjected to higher loads. Several times I have seen code written which simply works, but will break, and take the server that hosts it too down to it knees.
Read more…

Categories: mysql Tags:

Reduce Bandwidth usage in PHP

September 22nd, 2008 No comments

While searching on the net with the title as search terms, I landed on a page by Anthony Williams, which provoked me to probe more into optimizing all our javascripts too. Since our latest and greatest wordpress implementation at keralaonline, was getting 10K hits per day. I thought to try it out.
By combining the ideas of Anthony Williams and jsmin-php, I wrote a piece, and with the help of a RewriteRule, the famous mod_rewrite module of apache, I could optimize my page fetches a lot. It may take quite a few days before I can come out with any sort of bench marks. But still I am sure there is quite a change.
Read more…

Categories: Code Snippets Tags:

Get Post Image for WordPress

September 18th, 2008 No comments

Get Post Image is a plugin for WordPress 2.0 and higher that allows you to retrieve images contained in posts and display them in a custom manner.

Though the plugin helps you do all that what is said, it had a small bug (or was it intentional), will need to ask Andrew. The problem was identified only after we implemented it in the Asianet Portal – Kerala Online. With about 10K hits a day, the whole process was loading our web server which was a Dual Xeon with 4G RAM. I found it really baffling, and went on a wild hunt, and identified a lot of about 15 to 20 internal requests per external request of a page.

The hunt finally came to the place where the problem was on line no 252,
$imagesize = @getimagesize($img_url);,
which was changed to
$imagesize = @getimagesize($img_path);.

And the server started to breathe again.

Categories: Wordpress Plugins Tags: