Re: [PHP] PHP and mySQL getting smashed...

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 6:55 am, Russell Jones wrote:
 I have a site that is getting 30K+ traffic daily and it is smashing
 mySQL -
 any ideas on what to do to make the mysql connections more efficient,
 or
 anything in general. No bandwidth issue here, just the server getting
 killed.

It depends on the application.

For something with many reads and fewer writes like a forum or basic,
if busy, e-commerce you'd consider setting up MySQL replication with
one master for WRITE operations and multiple slaves for SELECT
operations.

For something with a high write/read ratio such as eBay, that would be
a wildly-unsuitable solution.

Your best bet is to ask the MySQL folks, honestly, since it's unlikely
that anything in PHP is going to be the answer to this one.

If you have RAM to spare, you could:
Configure /etc/my.cnf to have N + X connections
Use http://php.net/mysql_pconnect

N would be the number of Apache Max children

X would be a few spare connections so that, if, say, you NEED to use
shell 'mysql' monitor to DO something, the fact that ALL N connections
are taken by Apache, won't lock you out.

There are significant RAM issues with pconnect, as well as some bugs
in various versions of PHP/MySQL that make this answer a no-go.  Tread
carefully.

But it's at least an on-topic answer, even if an incomplete and maybe
downright bad answer.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Russell Jones

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -
any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.


Thanks


Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Dave Goodchild

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -

any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.

...I may be wrong but using persistent connections (mysql_pconnect) may

help. Also, optimise your tables and use the explain command to see how
efficient your queries are.
--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Angelo Zanetti

perhaps post some code so we can look at how you doing your queries...


HTH
Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
[f] +27 86 681 5885

Dave Goodchild wrote:

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -


any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.

...I may be wrong but using persistent connections (mysql_pconnect) may


help. Also, optimise your tables and use the explain command to see how
efficient your queries are.


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



RE: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Jay Blanchard
[snip]
I have a site that is getting 30K+ traffic daily and it is smashing
mySQL -
any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.
[/snip]

Without seeing any code or table information my bet would be that none
of your tables are indexed properly. 

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



Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Alister Bulman

On 17/05/06, Dave Goodchild [EMAIL PROTECTED] wrote:

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -
 any ideas on what to do to make the mysql connections more efficient, or
 anything in general. No bandwidth issue here, just the server getting
 killed.

 ...I may be wrong but using persistent connections (mysql_pconnect) may
help. Also, optimise your tables and use the explain command to see how
efficient your queries are.


And caching things that don't need to looked up form the database
right now.  Even the fastest server in the world would wilt under a
slashdotting, if it had to do a dozen big queries for every page
display.  Meanwhile a Pentium3 with a decent network can serve
hundreds of requests a second of a few static pages.

Alister

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



Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Jochem Maas

Jay Blanchard wrote:

[snip]
I have a site that is getting 30K+ traffic daily and it is smashing
mySQL -
any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.
[/snip]

Without seeing any code or table information my bet would be that none
of your tables are indexed properly. 


and/or that the OP is using some killing JOINS in his queries - these
often have a detremental effect regardless of indexes.





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