Re: database connections

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

 



On Mon, 2006-07-24 at 11:46, Ryan A wrote:
> Hi,
> 
> This is not really a problem, more like a slightly OT
> question.
> 
> Recently I have been testing some "CMS/carts/BB
> boards" and other related software, sometimes at the
> end of the page the software outputs the time it took
> to generate the page and the number of database calls.
> 
> I have seen some scripts give the number of database
> calls in the hundreds (from 100 - 400) just to
> generate one single damn page.
> Isnt that just too much?

It's usually a sign of poor programming and/or purist OOP programming.

When I say purist OOP programming some idiot retrieves X topic IDs from
the database in 1 query, then proceeds to execute X queries in the
constructor of the object to build the actual topic objects, then each
of these stupid constructors then proceed to build their children
objects (replies) which they do by doing a single query that returns Y
children IDs, and then it loops over these and builds the objects via
the constructor which again makes another Y queries, and of course those
stupid objects go and create their children. I saw one really retarded
implementation of this kind of system where an excess of 20000 queries
were issued to the database -- on a homepage nonetheless :/ I think it
was a testament to MySQLs speed that it performed within a reasonable
timeframe (under 3 seconds). Either way, such an application will never
be scalable such that the database server resides on a different
computer than the webserver (even over a LAN).

> Or am I blowing smoke and MySql can handle that
> without a sweat on a shared hosting environment? (with
> say....100 page requests per minute?)

MySQL can probably handle it. But try not to do programming like that
yourself. Stuff like that gives PHP a bad name.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux