[Phpwm] PHP Website load times in Firefox

David Goodwin david at codepoets.co.uk
Fri Oct 2 12:07:32 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike Tipping wrote:
> I was already using the IP address, but as MYSQL is on the same server I've
> changed it to localhost (and added a new @localhost user) and it's made a
> huge difference. Loads quickly now. Very odd.
> 
> So possible it was going out through a now is doing the connection
> internally? But why was my computer the only one with a problem?
> 
> As general practice do other people do a DB connection and select at the
> start of the app or as and when required?


"I'd"[1] normally use a lazy database connection, which would be
handled/opened/whatever from within a Model type object.

In some legacy stuff we look after, a connection is explicitly opened in
an include file and then accessed globally.

I suppose it depends on whether you want the number of page requests to
be limited by the number of MySQL connections available; or in other
words - do all your pages require a database connection - if not then
you should go the lazy connection approach.

Whether you want explicit coupling of your application to a database is
a different issue perhaps. Maybe you could introduce caching at a later
date (e.g. Zend_Cache_Frontend_Page), at which point database
connections may not be necessary for 50+% of traffic....


David

[1] - I say "I", I probably mean "they" [employees].

- --
David Goodwin

[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk       ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrF7QAACgkQ/ISo3RF5V6aQKACgsmGTCff7yQT0NK8n6InKrGQy
0nYAoNO9MKR0wBtrY1q2OoNHbnaly5g9
=eF9v
-----END PGP SIGNATURE-----



More information about the Phpwm mailing list