From: | sdv mailer <sdvmailer(at)yahoo(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | sdv mailer <sdvmailer(at)yahoo(dot)com> |
Subject: | Re: PostgreSQL pre-fork speedup |
Date: | 2004-05-03 17:35:10 |
Message-ID: | 20040503173510.66773.qmail@web60206.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Forking consumes a large amount of CPU when you have
many simultaneous connections and adds up to the
latency. Particularly MySQL users may think
PostgreSQL's connection time is much slower because
these users tend to perform relatively simple queries.
In my case, connection pooling and persistent
connection is useless for a large server farm
consisting of hundreds of partitioned and replicated
servers doing only simple queries.
Below is a benchmark of MySQL 3.2 and PostgreSQL 7.4
doing multiple connects/disconnects within the same
server (AMD 1.2GHz, 512MB, Linux 2.4). If forking is
the issue then pre-forking will give a big boost
especially for simple queries:
MySQL time
----------
0.012786865234375
0.011546850204468
0.01167106628418
<?php
$time_start = getmicrotime();
for ($i = 0; $i < 20; $i++) {
$DBH = mysql_connect('127.0.0.1');
mysql_select_db('test1');
mysql_close($DBH);
}
$Time = getmicrotime() - $time_start;
?>
MySQL time (with simple query)
------------------------------
0.015650987625122
0.01443886756897
0.014433860778809
<?php
$time_start = getmicrotime();
for ($i = 0; $i < 20; $i++) {
$DBH = mysql_connect('127.0.0.1');
mysql_select_db('test1');
$Res = mysql_query('SELECT * FROM table1 WHERE id =
1', $DBH);
mysql_close($DBH);
}
$Time = getmicrotime() - $time_start;
?>
PostgreSQL time
---------------
0.15319013595581
0.14930582046509
0.14920592308044
<?php
$time_start = getmicrotime();
for ($i = 0; $i < 20; $i++) {
$DBH = pg_connect('dbname=test1
host=127.0.0.1');
pg_close($DBH);
}
$Time = getmicrotime() - $time_start;
?>
PostgreSQL time (with simple query)
------------------------------------
0.19016313552856
0.18785095214844
0.18786096572876
<?php
$time_start = getmicrotime();
for ($i = 0; $i < 20; $i++) {
$DBH = pg_connect('dbname=test1
host=127.0.0.1');
$Res = pg_query($DBH, 'SELECT * FROM table1 WHERE id
= 1');
pg_close($DBH);
}
$Time = getmicrotime() - $time_start;
?>
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2004-05-03 17:43:47 | Re: Fixed directory locations in installs |
Previous Message | Fabien COELHO | 2004-05-03 16:57:31 | Re: inconsistent owners in newly created databases? |