Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?
- From: m5@xxxxxxxxxxxxxxxx (René Fournier)
- Date: Mon, 10 Dec 2007 15:37:46 -0700
Hi Jim,
I have a server that "listens" like yours does. I get 80k - 85k connections a day to it.
When I first started it, I was only getting about 3k of connections aday. Then I upped the
listening pattern and it tanked. I noticed that all my mail/web/db connections just sat there.
When I investigated, I found that the number of connections to the server was being overloaded. So
I increased the kern.maxfilesperproc setting to 32000. All the problems went away.
I have about have the horse power you do, running OpenBSD 4.1, and it runs great now as my
"listener" / web / ftp / mail / named / database / spam filter / etc...
One question about the "listener" program, does it maintain a connection to the DB or does it
open/close a connection upon each socket connection? If it does the latter, you might look into
using a constant connection rather then opening/closing on a per connection basis.
Thanks for the reply. (Not many people seem to be doing what I'm doing in the way I'm doing it... so I really appreciate the feedback.)
I don't think the kern.maxfilesperproc setting is a problem. I'm currently set to 102400 per Shawn Hogan's advice. And my Listener program only receives ~1000 connections per day. However, each connection involves multiple MySQL queries, often as many as 50 or so per connection each day. So perhaps your second observation applies. MySQL is showing ~ 1,500 connections per hour. And I'm using mysql_connect() in Listener. I will see if using mysql_pconnect(), and reducing the number of connections helps.
My.cnf's max connections, presently at 100, may have been too low in view using mysql_connect(). If mysql_pconnect() doesn't improve things, maybe I should bump up max_connections to 500?
...Rene
.
- References:
- Command-line PHP script CPU usage goes sky-high, stays there--why?
- From: René Fournier
- Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?
- From: Jim Lucas
- Command-line PHP script CPU usage goes sky-high, stays there--why?
- Prev by Date: RE: [PHP] Generating Random Numbers with Normal Distribution
- Next by Date: Re: [PHP] Generating Random Numbers with Normal Distribution
- Previous by thread: Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?
- Next by thread: Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?
- Index(es):
Relevant Pages
|