Terrible PDO_INFORMIX performance when dealing wit
Posted in 2009
We are experiencing *terrible* performance when reading large-ish (>1MB) BLOBs over PHP PDO connections using PDO_INFORMIX. Using the old IFX API on an older server (v5.0.4, see below) that has both IFX and PDO we get the same terrible PDO performance and can benchmark it against IFX performance.... tor:/tmp # time php -f OGo12905012.blobReadPerfTest.IFX.php real 0m0.377s user 0m0.056s sys 0m0.116s tor:/tmp # ls -l large_blob_out.dat -rw-r--r-- 1 root root 3591751 2009-05-22 11:27 large_blob_out.dat tor:/tmp # time php -f OGo12905012.blobReadPerfTest.PDO.php real 0m39.427s user 0m0.064s sys 0m0.104s tor:/tmp # ls -l large_blob_out.dat -rw-r--r-- 1 root root 3591751 2009-05-22 11:28 large_blob_out.dat If I profile the run (with strace) the PDO test spends the vast majority of its time in recv(). Looking at the communication using tcpdump/wireshark the performance rapidly drops off and a massive number of packets is exchanged between the client and the server. I've posted the Bytes/Second graph at <https://www.mormail.com/OGo12905012.2009051914.TransferRate.png> Does anyone have any insights/experience with an issue like this? I found an issue that sounds similair, but using VB, at <http://www.dbtalk.net/comp-databases-informix/blob-performance-36360.html> Server is Informix 11.10.UC1 on SLES Client is PHP v5.0.4 w/3.00.xC2 on openSUSE 10.1 or PHP 5.2.9 w/3.50.xC1 on openSUSE 10.3 or PHP 5.2.9 w/3.50.xC4 on openSUSE 11.1 - PDO performance is the same across all clients [terrible]. Test cases: --------------------------------------------------------------------------- <?php /* OGo12905012.blobReadPerfTest.PDO.php */ class Test { public $db = null; public function connect($autoCommit=true) { $this->db = ifx_connect("miecr", "adam", "*******"); return $this->db; } public function runTest() { $this->connect(); ifx_byteasvarchar(true); $stmt = ifx_query("select wds_blob_id,wds_blob from wds_store where wds_blob_id = 11392", $this->db); $row = ifx_fetch_row($stmt, "NEXT"); $fp = fopen( dirname(__FILE__) . "/large_blob_out.dat" , "wb" ); fwrite($fp, $row["wds_blob"]); fclose($fp); print "done\\ "; } } $testcase = new Test(); $testcase->runTest(); ?> <?php /* OGo12905012.blobReadPerfTest.IFX.php */ class Test { public $db = null; public function connect($autoCommit=true) { $this->db = ifx_connect("miecr", "adam", "*******"); return $this->db; } public function runTest() { $this->connect(); ifx_byteasvarchar(true); $stmt = ifx_query("select wds_blob_id,wds_blob from wds_store where wds_blob_id = 11392", $this->db); $row = ifx_fetch_row($stmt, "NEXT"); $fp = fopen( dirname(__FILE__) . "/large_blob_out.dat" , "wb" ); fwrite($fp, $row["wds_blob"]); fclose($fp); print "done\\ "; } } $testcase = new Test(); $testcase->runTest(); ?> I've filed a bug on PDO_INFORMIX @ <http://pecl.php.net/bugs/bug.php?id=16568>