List:MySQL on Win32« Previous MessageNext Message »
From:Michael Widenius Date:June 29 1999 5:59pm
Subject:Testing PHP + mySQL - too slow
View as plain text  
>>>>> "targeted" == targeted  <targeted@stripped> writes:

targeted> Hi !
targeted> Before making a decision, I'm testing
targeted> PHP 3.0.6 with mySQL 3.21.29a-gamma for Win95 (i586)
targeted> under WinNT Server 4.0.

targeted> I've created a PHP page (say, test.phtml), which first performs
targeted> some mySQL operations and then returns the HTML
targeted> with 2 links to the same page (href=test.phtml).

targeted> Operations being performed are pretty simple:
targeted> 1. pconnect ?
targeted> 2. if not pconnect, goto 1
targeted> 3. select database
targeted> 4. execute query, with 7/8 probability SELECT and 1/8 - INSERT.
targeted> 5. close
targeted> all operations are logged in the "log.log".

targeted> Queries are run against the table of 60000 records with 3 indexes,
targeted> and both select and insert are specifying fields with NO indexes,
targeted> the values of indexed fields are being set by default.

targeted> pconnect is made by the same user for all requests.
targeted> { pconnect(ip, "test", "test"); }

targeted> Then I use my spider to recursively walk through HTML links.
targeted> The number of simultaneous requests is 16.

targeted> Well, the analysis of "log.log" is rather strange:
targeted> The vast amount of time is being spent within the
targeted> pconnect waiting loop.  The query itself takes
targeted> less than a second, while pconnect takes up to a
targeted> twenty seconds (!) of retrying attempts.

targeted> As I understand, each connection to mySQL is done
targeted> via TCP/IP. Opening a TCP/IP connection is of course
targeted> time-consuming but not as much.

targeted> Moreover, I use pconnect, which should IMHO handle
targeted> a pool of connections to make this pretty fast.
targeted> On the other hand, manual says that FOR ODBC connections
targeted> pconnect makes no sense, since each connection is
targeted> made by the standalone exe. May be this is also true
targeted> for mySQL, and manual is incomplete ?

targeted> I guess the trouble with this is that the mySQL
targeted> handshake code is too long, and it's being executed
targeted> by the main listening thread. In that case each
targeted> request should block the server until the new thread
targeted> is created.

targeted> Or, it's something with record locks ?
targeted> Or, some buffer is small ?
targeted> etc.

targeted> Could you please tell me something about handling
targeted> multiple requests at a short time please ?

targeted> Thanks in advance,
targeted> Dmitry Dvoinikov
targeted> mailto://ddvoinikov@stripped


How long does the pconnect() take?  Are you sure you are not facing a
DNS lookup problem ?

Try adding an entry in the /windows/hosts.sam file for your local
hostname and check if this helps!

Testing PHP + mySQL - too slowtargeted29 Jun
  • Testing PHP + mySQL - too slowMichael Widenius29 Jun