Re: [PHP] mysql_connect slowness



Hi Waynn!

have you ever tried using

1. sql_cache
SELECT SQL_CACHE * FROM table ......

I use this alot... although you have to have mysql cache enable in the
sql config file... your webhost can tell you if it is on or not

2. make indexes for your tables

here is a good article
http://www.databasejournal.com/features/mysql/article.php/1382791
a great admin program to use is Navicat... it's very easy to make your
indexes there...


Hopefully those 2 suggestions speed up things a little! :o) let us
know if it works

Joe

On Mon, Apr 28, 2008 at 12:14 AM, Waynn Lue <waynnlue@xxxxxxxxx> wrote:
Our site has been slowing down dramatically in the last few days, so
I've been trying to figure out why. I ran some profiling scripts on
our site and saw that we're spending between 3-9 seconds on
mysql_connect. Then I connected to our db and saw that there were
over 100 connections at the time, most of them sleeping. Is this
because we don't close mysql connections until the end of script
execution?

How do people generally structure their code to minimize the time they
keep mysql connections open? Currently all db connections go through
one file, which gets included at the top of the file. One other
question, is it better to open one connection, then re-use it later,
or just continually open and close per db call?

Thanks,
Waynn

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


.



Relevant Pages

  • Re: Experiences with mysql_pconnect?
    ... talk to a MySQL 5.0.45 DB on an Apache 1.3 series server. ... dangling connections to the server at the php.net site. ... especially when the server is remote as it requires multiple calls to MySQL. ... queries that you execute on a regular basis, preparing it and then ...
    (comp.lang.php)
  • Re: Experiences with mysql_pconnect?
    ... talk to a MySQL 5.0.45 DB on an Apache 1.3 series server. ... dangling connections to the server at the php.net site. ... > Using prepared statements will probably speed up your app a lot. ... especially when the server is remote as it requires multiple calls to MySQL. ...
    (comp.lang.php)
  • Re: Reducing load for LAMP app?
    ... MySQL: as much as possible, he keeps query results in RAM, but ... His hoster says that Apache server is under significant load. ... Using apc is pretty much transparent, but memcached will require modifying your database abstraction layer using the memcached functions. ... With persistent connections, you must have the maximum number of connections *ever* required allocated *all of the time* - even if no one is using your server. ...
    (comp.lang.php)
  • Re: [PHP] mysql_connect slowness
    ... I ran some profiling scripts on ... over 100 connections at the time, ... because we don't close mysql connections until the end of script ... www dot t-scripts dot com/mysql/ ...
    (php.general)
  • Re: ODBC microsoft access driver
    ... Access has limited concurrent connections. ... If you can get mysql I would use ... MS Access fan for small web sites myself but when those small websites ...
    (microsoft.public.dotnet.framework.aspnet)