";
echo "Stressing postmaster with $max persistent connections |
";
echo "Connection type | Time (seconds) |
";
/*
* tcpip persistent connections
*/
$host = "localhost";
$port = "5432";
$tt = time();
for($i=0; $i<$max; $i++) {
$conn = pg_pConnect($host, $port, "", "", $db);
pg_Close($conn);
}
$tt = time() - $tt;
echo "tcpip local | $tt |
";
/*
* tcpip persistent connections with selects
*/
$host = "localhost";
$port = "5432";
$tt = time();
for($i=0; $i<$max; $i++) {
$conn = pg_pConnect($host, $port, "", "", $db);
$res = pg_Exec($conn, "select 17");
pg_Close($conn);
}
$tt = time() - $tt;
echo "tcpip local with select | $tt |
";
/*
* unix persistent sockets connections
*/
$host = "";
$port = "";
$tt = time();
for($i=0; $i<$max; $i++) {
$conn = pg_pConnect($host, $port, "", "", $db);
pg_Close($conn);
}
$tt = time() - $tt;
echo "unix sockets | $tt |
";
/*
* unix sockets persistent connections with selects
*/
$host = "";
$port = "";
$tt = time();
for($i=0; $i<$max; $i++) {
$conn = pg_pConnect($host, $port, "", "", $db);
$res = pg_Exec($conn, "select 17");
pg_Close($conn);
}
$tt = time() - $tt;
echo "unix sockets with select | $tt |
";
echo "";
?>