Reply to Re: !Need advice from other PHP developers.

Your name:

Reply:


Posted by Jerry Stuckle on 02/05/07 11:06

Eric Layman wrote:
> Hi,
>
> Many years ago when I first learnt abt web dev in school,
>
> I was taught this methodology:
>
> [Open connection]
>
> <html>
> blah blabh
>
> [execute sql]
> [loop thru recordset]
>
> <table>[data] </table>
>
> [recordset close]
> [end loop]
>
> <html>
>
> [Close connection]
>
>
> Over the peroid of time, I noticed that the above method may cause
> connection problems on heavy sites.
>
> Recently, I have use another method to retrieve data from server
>
> [Open Connection]
> [declare 2D array]
> [loop thru recordset]
> [2D array] = [data]
> [recordset.close]
> [end loop]
> [Close connection]
>
> <html>
>
> [loop thru the 2D array]
> <table>[2d array's DATA] </table>
> [end array loop]
>
> </html>
>
> It performs better as all the data retrieveal and processing are all
> processed at the beginning of the page.
>
> Need comments and advise please.
>
> 1. Are there better ways to manage connections and easier data retrieval to
> ensure performance of the site under heavy load?
>
> 2. Are there any potential pitfalls regarding my 2nd method of data
> retrieval?
>
> Thanks
>
>
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com

Eric,

This will help free up MySQL resources with heavily used sites, but will
require more memory in PHP to hold your data.

For a single thread, things will run more slowly due to the extra
processing required to buffer the data in an array.

For the entire system, things may run more quickly or more slowly - it
all depends on where your constraints are. Personally, I can't see that
it will really help that much other than releasing the connection a
slight bit more quickly. And if you're that connection-constrained, the
number of MySQL connections is probably too low.

Personally, I don't do any extra buffering. But I don't request
resources before I need them, and I release resources as soon as I'm
through with them. That means, for instance, I don't do a SELECT until
I'm ready to use the data, and I close the result set as soon as I'm
through with the data. I also close the connection as soon as I'm done
with all MySQL requests.

But you claim this is faster - I'd like to see some real benchmarks on
this. I really suspect the increase in speed is more a matter of
perception (quite easy to do).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация