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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try putting a separate network connection between your webserver box and your db, specifically for data between PHP and your DB.
Don't route that traffic through the same network as you are using to retrieve the webpage, as the DB connection will eat up all of your bandwidth, leaving none available for sending the data to the browser.

On Tue, 2004-02-10 at 23:17, jde wrote:
Aha!!!

In preparing to give more info, as requested by Sebastian, I have 
discovered that:

You are right, but not exactly for the reasons you describe.

The problem is the fact that I was interleaving the mysql_fetch with 
echo.  However, I do not believe it is simply an 'adding the latency'. 
The two reasons this is probably not the case are because 1) the timing 
measures I made where from within the code, not by "watching the 
browser", so I knew exactly the time it was taking.  Secondly, the mysql 
server and the web client are co-located (i.e. in my house) and the 
latency between web server + mysql server would be the same as between 
web server + web browser, of which I know with high confidence is never 
as long as the timings would indicate.

And actually a third reason for knowing it isn't simply latency is 
because, when I did perform all the data fetching before doing any 
output, the times decreased by a factor of 1000: from on order 1 to 6 
seconds per fetch down to around .0001 second per fetch.  This order of 
magnitude of difference is too much for simply latency.

Nevertheless, clearly the mixing of I/O between the mysql connection and 
the web client creates a HUGH impact on the php efficiency.

Thanks for the discussion!!! This got the job done!!!

Question is now: is this a mysql library issue or a php/mysql 
interaction issue...will make sure the php and mysql folks know this 
(which they may already know about, I just didn't).

Thank you Thank you!
jde

Brent Baisley wrote:

> You're also writing out to "screen" as you get the data, so you may be 
> adding the latency from the web server to the client on top of your data 
> fetching. You can probably get a boost by getting all the data into PHP 
> first and then formatting and sending it to the client. At a minimum you 
> should be able to determine if the client is the big slow down.
Matthew Vos
Systems Analyst
Product Development
Techcom Software Solutions Inc.
416.398.5764
vos@xxxxxxxxxxxxxx


* * * * * * * * * *
This message contains information from Techcom Software Solutions Inc.
which is confidential and privileged.  If you are not an intended
recipient, please refrain from any disclosure, copying, distribution or
use of this information and note that such actions are prohibited.

If you have received this transmission in error, please notify
vos@xxxxxxxxxxxxxx.

This message and any attachments have been scanned for viruses.
This message has been digitally signed to ensure authenticity.
Key ID: CFEA28EC
Fingerprint: 009F E13D 0450 55AF DC1C 4D77 1FE9 0DBB CFEA 28EC

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux