You are here: Re: Is this a good idea? « PHP Programming Language « IT news, forums, messages
Re: Is this a good idea?

Posted by Jerry Stuckle on 01/20/06 07:16

Iván Sánchez Ortega wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Chung Leong wrote:
>
>
>
>
> But, if it's broken, I'd better fix it for good, instead of patching legacy
> code so that it "just works".
>
> The isue we're discussing - dumping the entire query results into an array
> in memory - induces lazyness in the programmers. Lazyness leads to more
> complex code, more complex code leads to more bugs, more bugs leads to more
> wasted QA time when something breaks down.
>

I disagree completely.

There are many valid reasons for putting the information in an array.

For one thing - once you have it in an array, you can release your
result set - freeing MySQL resources. And if you don't need the
connection for anything else, you can close it. One of the big
concurrency issues with RDB's is holding their resources longer than
necessary.

Also, if you're doing lots of complex processing on the returned data,
it's generally better to buffer the data in your own program rather than
hold it in MySQL.

Your way works for low volume web pages. But once you get into heavy
database use, it's a whole different story.
>
>
> Sometimes it does not - sometimes, due to lazy programming or bad DB design,
> data goes into memory, goes out of memory. And the whole thing risks
> becoming a GIGO.
>
> (but, hey, it's a "it just works" scenario! it's good for the CEO! I'm
> getting paid!)
>

You don't need local buffering to make a GIGO. Any poor programming
practice will do it. While no good programming practice will.

>
> No; in my scenario I'll just have a couple of Gigabit-ethernet-enabled
> servers. And their bottleneck must be the bandwith, not the resource-hungry
> scripts. The code must be so flazing fast, so fucking clean, that I'm able
> to affirm the server will be able to handle the load and not choke.
>

Try it on some of the systems I've worked on in the past. Multiple web
servers feeding off one database server (DB/2 on AIX in this case).
Averages of < 100K > 1M hits/hr.

I've also worked on database systems which can handle peaks of < 1M
database requests per hour. You can't do either if you hold the db
resources unnecessarily long.

> - --
> - ----------------------------------
> Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net
>
> Donde se pierde el interés también se pierde la memoria.
> -- Johann Wolfang Von Goethe. (1749-1832) Escritor alemán.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
>
> iD8DBQFD0DdA3jcQ2mg3Pc8RAmqiAJ0RdFNwsQZ1jGA2IpAl71RHNq44RQCfaJtK
> gLEzeA51A7KxtWqtK9hxBW0=
> =HcH0
> -----END PGP SIGNATURE-----


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

 

Navigation:

[Reply to this 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

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