Some performance issues (since everybody is testing ... :) - Mailing list pgsql-hackers
From | Costin Oproiu |
---|---|
Subject | Some performance issues (since everybody is testing ... :) |
Date | |
Msg-id | Pine.LNX.3.96.980206114859.9545A-300000@linux.tpd.deuroconsult.ro Whole thread Raw |
List | pgsql-hackers |
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>
pgsql-hackers by date: