Monthly Archives: May 2012

How to emulate a slow connection

Sometimes you would want to emulate a slow connection. For example to better understand a web site performance that you are developing locally.

As you probably know search engines (especially Google) prefers faster sites. Using a slow connection we can better assess the optimizations we may apply to the web application. Every second (or fraction of it) saved can make you earn positions on SERPs.

Linux lets you emulate a slow connection using netem kernel mode throuch tc command. Some examples:


# tc qdisc add dev eth0 root netem delay 300ms 30ms
# tc qdisc change dev eth0 root netem loss 0.10%

These commands will add a random delay between 300 and 30 ms and a packets loss of 0.10% to eth0 interface.
Other features and examples are visible here.

For Windows and Mac (and also linux) I recommend this Java “slow proxy” http://www.dallaway.com/sloppy/.

You can contact me for advices on How to optimize a web site.

Watch out awstats upgrade with Plesk 10 and Centos 5

I recently had an unpleasant surprise updating packages on a Centos 5 server with Plesk 10.4.4.

The awstats statistics stopped working. The reason was the update of awstats-7.0-12012611.swsoft rpm with the update of Centos awstats-7.0-2.el5.rf .

I solved the problem by brutally removing the Centos package and reinstalling the Plesk one.


rpm -e --nodeps awstats 
wget http://64.131.90.31/PSA_10.4.4/dist-rpm-CentOS-5-x86_64/contrib/awstats-7.0-12012611.swsoft.noarch.rpm 
rpm -ivh awstats-7.0-12012611.swsoft.noarch.rpm 

How to solve “mod_fcgid: read data timeout in 40 seconds” in centos 5

In Centos 5 mod_fcgid version there is a bug that causes this error:


mod_fcgid: read data timeout in 40 seconds

in VirtualHosts regardless of the values of IPCCommTimeout and IPCConnectTimeout configured in /etc/httpd/conf.d/fcgid.conf.

On the net I found a solution which consists in inserting in every VirtualHost the parameters IPCCommTimeout IPCConnectTimeout, but for me it worked just inserting the following code ad first VirtualHost:


<VirtualHost *:80>
Include conf.d/virtualfcgi.conf
</VirtualHost>

and editing mod_fcgi parameters in file /etc/httpd/conf.d/virtualfcgi.conf


<IfModule mod_fcgid.c>
IdleTimeout 3600
ProcessLifeTime 7200
MaxProcessCount 64
DefaultMaxClassProcessCount 8
IPCConnectTimeout 300
IPCCommTimeout 7200
BusyTimeout 300
</IfModule>