« Archives in June, 2006

lighttpd & image serving benchmark

The difference between serving image from MySQL & from a static file is huge so there is clearly no question which one is better in term of performance.

ab -n 1000 -c 10 25131.php
Requests per second:    66.33 [#/sec] (mean)
ab -n 1000 -c 10 25131.gif
Requests per second:    632.39 [#/sec] (mean)

lighttpd, php5, eAccelerator by RPMs

Install the require RPMs (php, php-mysql, php-eAccelerator). For Fedora, use yum (lighttpd and lighttpd-fastcgi). For CentOS and other distros that do not include lighttpd in their repository, use DAG repository

Find out the path to php-cgi and whether it supports fastcgi (should show cgi-fcgi)

Configure a light weight lighttpd:

Might need to switch from httpd to lighttpd

# switch from httpd to lighttpd
service httpd stop
service lighttpd start
chkconfig --list httpd
chkconfig lighttpd on
chkconfig httpd off
chkconfig --list httpd
chkconfig --list lighttpd

Can also run both httpd and lighttpd together on the same server (use two different ports, eg: 80 & 81, don’t forget to open the new port in the firewall) for testing/benchmarking or development purposes.

Initial benchmark: a 10-15% improvement on serving dynamic PHP/MySQL pages. Static files are supposed to be much faster. lighttpd is very stable (loadavg is maintained at about 3-4) with higher concurrency levels while Apache might increase loadavg to over 10+

Great kudos to the lighttpd developers for bringing us a fast, light webserver. Fly Light!

Google Earth v4 & Vietnam maps

Google Earth recently released version 4 (beta) and also it supports higher resolutions maps for Vietnam metros (like Saigon, Hanoi, and other cities). Great kudos for them. Love those maps, now I see things I never know about Saigon before.

Shell-script: MySQL optimize all tables

Using myisamchk sometime requires shutting down MySQL server and that’s not very easy in certain situation. This shell script accepts a database name from input and gets all table names and runs a SQL query against these tables. Currently, it only optimizes all the tables and could be expanded to do a lot more. OPTIMIZE does a lot more, an all-in-one solution (for MyISAM tables: repair, sort index, update stats). Enjoy!

Sample Usage:

APF & iptables issue

If you try to restart APF and somehow got this message:

Unable to load iptables module (ipt_state), aborting.

change this in the conf.apf

SET_MONOKERN="0" change to "1"

LVS-TUN Director Notes

Director server needs at least 2 IP addresses, one for the Virtual IP and one for other things. With just one, SSH seems to forward to the other machine among other unexpected behaviors.

Real/Worker server needs just one IP address each. Kernel 2.6.x seems to have no problem with the ARP problem and no need to patch anything.