Thread: Some performance issues (since everybody is testing ... :)

Some performance issues (since everybody is testing ... :)

From
Costin Oproiu
Date:
Hi there,

I am starting with the conclusions to spare time:
 - persistent connections invention stands somewhere between the fire and the
   wheel
 - unix sockets is not much compared to tcpip (at least on my Linux 2.0.30
   box).
 - parsing and executing a trivial "select 17;" accounts for a lot of time,
   someone wanted hints on what is critical, profiler statistics coroborated.


 Stressing postmaster with 100 connections
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Connection type                       Time (seconds)
 ----------------------------------------------------
 tcpip local                                15
 tcpip local with select                    26
 unix sockets                               15
 unix sockets with select                   26
 tcpip local persistent                      0
 tcpip local persistent with select          2
 unix sockets persistent                     0
 unix sockets persistent with select         2


 Stressing postmaster with 2000 persistent connections
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Connection type                        Time (seconds)
 -----------------------------------------------------
 tcpip local                                 3
 tcpip local with select                    45
 unix sockets                                3
 unix sockets with select                   45



NOTES:
 - tests were (repeatedly!) run via php3 as apache module
 - scrips attached, comments wellcome
 - "with select" below means a pg_Exec("select 17;")
   inserted between Connect and Close


.co.

Costin Oproiu ---------------- http://www2.deuroconsult.ro/~co
Ciprian Porumbescu 10, ap.13       tel/fax:    +(40)-68-183528
Brasov 2200, ROMANIA                 email: co@deuroconsult.ro
--------------------------------------------------------------
<html>
<head><title>Connect benchmark</title></head>
<body>

<?php
error_reporting(1);
$db = "ibase";

if(!IsSet($max)):
  $max  = 1000;
endif;

echo "<table border=1>";
echo "<tr><th colspan=2>Stressing postmaster with $max persistent connections</th></tr>";
echo "<tr><th align=left>Connection type</th><th align=right>Time (seconds)</th></tr>";
 
/*
 *    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 "<tr><td>tcpip local</td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>tcpip local with select</td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>unix sockets</td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>unix sockets with select</td><td align=right>$tt</td></tr>";
echo "</table>";
?>
</body>
</html><html>
<head><title>Connect benchmark</title></head>
<body>

<?php
error_reporting(1);
$db = "ibase";

if(!IsSet($max)):
  $max  = 100;
endif;

echo "<table border=1>";
echo "<tr><th colspan=2>Stressing postmaster with $max connections</th></tr>";
echo "<tr><th align=left>Connection type</th><th align=right>Time (seconds)</th></tr>";
 
/*
 *    tcpip connections
 */
$host = "localhost";
$port = "5432";

$tt = time();
for($i=0; $i<$max; $i++) {
  $conn = pg_Connect($host, $port, "", "", $db);
  pg_Close($conn);
 }
$tt = time() - $tt;
echo "<tr><td>tcpip local</td><td align=right>$tt</td></tr>";

/*
 *    tcpip connections with selects
 */
$host = "localhost";
$port = "5432";

$tt = time();
for($i=0; $i<$max; $i++) {
  $conn = pg_Connect($host, $port, "", "", $db);
  $res  = pg_Exec($conn, "select 17");
  pg_Close($conn);
 }
$tt = time() - $tt;
echo "<tr><td>tcpip local with select</td><td align=right>$tt</td></tr>";

/*
 *    unix sockets connections
 */
$host = "";
$port = "";

$tt = time();
for($i=0; $i<$max; $i++) {
  $conn = pg_Connect($host, $port, "", "", $db);
  pg_Close($conn);
 }
$tt = time() - $tt;
echo "<tr><td>unix sockets</td><td align=right>$tt</td></tr>";

/*
 *    unix sockets connections with selects
 */
$host = "";
$port = "";

$tt = time();
for($i=0; $i<$max; $i++) {
  $conn = pg_Connect($host, $port, "", "", $db);
  $res  = pg_Exec($conn, "select 17");
  pg_Close($conn);
 }
$tt = time() - $tt;
echo "<tr><td>unix sockets with select</td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>tcpip local persistent</td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>tcpip local persistent with select</td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>unix sockets persistent </td><td align=right>$tt</td></tr>";

/*
 *    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 "<tr><td>unix sockets persistent with select</td><td align=right>$tt</td></tr>";

echo "</table>";
?>
</body>
</html>

Re: [HACKERS] Some performance issues (since everybody is testing ... :)

From
"Thomas G. Lockhart"
Date:
> I am starting with the conclusions to spare time:
>  - persistent connections invention stands somewhere between the fire and the
>    wheel
>  - unix sockets is not much compared to tcpip (at least on my Linux 2.0.30
>    box).
>  - parsing and executing a trivial "select 17;" accounts for a lot of time,
>    someone wanted hints on what is critical, profiler statistics coroborated.
>
>  Stressing postmaster with 100 connections

Hi. Since you are testing with multiple connections, would you like to try additional testing to make sure the new
deadlock
detection code behaves properly, especially under heavy load/multiple connections?

The large loading cases tend not to get exercised in beta testing because the systems are not in production yet...

                                              - Tom


Re: [HACKERS] Some performance issues (since everybody is testing ... :)

From
Costin Oproiu
Date:
On Fri, 6 Feb 1998, Thomas G. Lockhart wrote:

> >
> >  Stressing postmaster with 100 connections
>
> Hi. Since you are testing with multiple connections, would you like to try additional testing to make sure the new
deadlock
> detection code behaves properly, especially under heavy load/multiple connections?
>
> The large loading cases tend not to get exercised in beta testing because the systems are not in production yet...
>
>                                               - Tom
>
OK, the title is a little bit misleading, it is about 100 successive
connections and wants to show how much time a trivial

    "select 17"

coul take compare to a connection.

However your idea is very good, since I am dealing with benchmarking now.

.co.

Costin Oproiu ---------------- http://www2.deuroconsult.ro/~co
Ciprian Porumbescu 10, ap.13       tel/fax:    +(40)-68-183528
Brasov 2200, ROMANIA                 email: co@deuroconsult.ro
--------------------------------------------------------------