Matt Nelson wrote:
I have a web page that runs under PHP. I query a mysql database every 5-10
seconds, with each meta refresh. This was fine and worked decent, until
other people started using it. Now the connections have grown to a number
that they need to be handled better. I was thinking of creating a daemon
that runs every 5 seconds and then populates a flat file that apache/php
would read with every refresh thus limiting the load to one connection every
5 seconds.
Does anybody have any better ideas?
Just out of curiosity, is the problem just the number of connections to
the database? If that is what the problem is, are you using
mysql_connect() or mysql_pconnect()? The pconnect method creates a pool
of database connections and reuses that pool. It requires using php as a
module in apache. It might require a bit of tweaking to use properly but
might be useful.
Other than that, I would say try memcache. Or writing your own caching
layer if you are particularly masochistic. (I'll keep comments about php
being masochistic to myself).
There are a few thoughts about what you can do.
Mike
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/