Thursday, October 27, 2016

Measuring PHP Page Load Time

$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;


$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo 'Page generated in '.$total_time.' seconds.';



Ref: http://www.coding101.in/2016/10/measuring-php-page-load-time.html

Wednesday, October 12, 2016

Gulp

Wednesday, October 5, 2016

MySQL Workbench loosing the connection when it is idle in ubuntu

The TCP keepalive on the Azure load balancer is 240 seconds by default, which can cause it to silently drop connections if the TCP keepalive on your Azure systems is greater than this value. You should set tcp_keepalive_time to 120 to ameliorate this problem.

OS : Ubuntu 14.04 hosted on windows azure virtual machine.

1. To check the tcp_keepalive_time
#cat /proc/sys/net/ipv4/tcp_keepalive_time
7200 (by default 2 hours)

2.set value from 2 hours to 120 seconds.
#sudo sysctl -w net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_keepalive_time = 120

3. recheck the value after changing.
#cat /proc/sys/net/ipv4/tcp_keepalive_time
120

4.Set the value in the sysctl file to remain the value even after reboot.
#vi /etc/sysctl.conf
Press i (To insert into file)
net.ipv4.tcp_keepalive_time = 120(Add this line at the bottom of the file)
:wq(Save and exit)

Now your connection will alive.