Showing posts with label Web Development. Show all posts
Showing posts with label Web Development. Show all posts

Tuesday, April 15, 2008

Some tips to improve the performance of a web app

Before writing anything about this, I would like to apologize Odin Chen because I did not fulfill my exaggeration that I will make my web app run 500 times faster than before. After the most recent benchmark, it probably runs only 10 times faster :P

Here is the list I have applied to my app, hope it helps someone

  • Compress web files such as javascript and css files, that saves both web traffic and loading time.

  • Add an expires header to web files and images, it is only necessary when those files are not changed before they expire (I am still finding the best way to do it)

  • Choose a small footprint server, I know Ubuntu 7.10 is great but you do not need the latest PHP 5.2.5, why dont you consider Debian?

  • Compile your own package with your own configuration, or at least install only the essential packages from the repos, not all of them :P

  • Use a caching engine such as APC, eAccelerator, Zend Optimizer, or memcached ...

  • Use your skill in programming, yes by that I mean code efficiency : do not forget to join foreign table, that saves many time in database querying, and unset the variables or objects that used in actions file that are no longer needed in template file


In the future, if I read or think of some other tips I will blog about it, if you have any advice, do not hesitate do leave a comment here. :D

Sunday, March 23, 2008

PHP Warning: Module 'json' already loaded in Unknown on line 0

After installing a LAMP server on an old P3 800MHz machine - yes it is so old that it was picked up from my apartment storage room, I typed "php -v" and it says in the first line :
PHP Warning: Module 'json' already loaded in Unknown on line 0

It seems to be the modules json is loaded twice, I looked into the php.ini files and there it is:
extension=json.so

Simply commenting out that line solves the problem and yet leaves me the doubt where is it first loaded besides the time php.ini calls it. I guess there is something with the php5-json package I installed, it may already be included in php5 library and automatically loaded. That is not bad at all since the Debian team will maintain that package and give me the latest one. :D

Sunday, March 16, 2008

How did I tame my IE6 stand alone

Hooray,

Today morning, I wrote an entry about how difficult it is to have Firefox, IE7, IE6 and Safari running on a single machine. Now it is not really a matter anymore, thanks to someone has made a portable IE6, I can have an old friend back. There is also a Windows version of Safari 3, but it is still at beta stage and for some unknown reasons it crashed on my XP. (I will figure it out later.)

There are couples of tweaks need to be done before having IE6 operate properly. You can follow it here to enable cookies, append a "IE 6" title to the browser and fix the conditional comments feature in CSS. Life is just half beautiful again.

Later on, I found a Javascript bug on my site and, well, it is time to google for a good IE script debugger, I found this and this, and decided to use IE Developer Toolbar and Debug Bar since it looks neat and user-friendly. The functionality is somehow similar to the commendable Firebug of Firefox. If there is any problem, Script Debugger for Windows is my first candidate in the waiting list.