Re: msql perfomance: fast through mysql, slow through php

From: Date: Tue, 10 Feb 2004 16:13:18 +0000
Subject: Re: msql perfomance: fast through mysql, slow through php
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32889@lists.php.net to get a copy of this message
Hi jde, this sounds very strange. Please post send the results of an traceroute and ping to the list. Perhaps, the bandwidth could be the problem. We have a constellation like you with our boxes in germany. The webservers are located in karslruhe, the mysql-boxes in frankfurt. Everything works fine... Regards, Sebastian jde said: > Greetings, > > I have search the archives over the last two years and have not found > any help for this question. > > The basic setup: An apache/php server exists on the west coast of the > US, and a linux/mysql server on the east coast. > > My PHP snippet looks like this: > > $result = mysql_query("select acolumn from atable where bcolumn=0", $db); > while ($row = mysql_fetch_assoc($result)) echo 'some stuff from the row'; > > > The problem is, that the above snippet, to return seven rows, takes > about 15 seconds. Putting timing statements around the query and around > the fetch calls shows that the query call takes only 0.03 seconds. > However, each fetch call takes anywhere from 0.5 to 5 seconds each to > complete. > > However, if I am logged onto the apacher server and from the user prompt > run the 'mysql' client, and perform the same exact query, the 'mysql' > client can peform the query and return all the results, all 7 rows, in > 0.1 second. > > This is apache 1.3/php 4.3.4 and mysql 4.0.17-standard. > > I have tried all the mysql_connect flags without any change. > > Should I expect such a performance difference? Is there something else I > need to look for? > > Thank you for your time, > jde > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Sebastian Mangelkramer IMAC - Information & Management Consulting Blarerstraße 56, D-78462 Konstanz Tel. +49 (0)7531 - 90 39-11 Fax +49 (0)7531 - 90 39-47 E-Mail: sebastian.mangelkramer@imac.de

« previous php.db (#32889) next »