Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?





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
.



Relevant Pages

  • Re: Effect of listener on existing connections?
    ... Solaris 10 inside a ZFS zone (our previous system was Oracle ... and attempts to create new connections are ... issue of the listener locking up if you're not using ONS. ... how does a blocked listener explain the fact that apps with existing ...
    (comp.databases.oracle.server)
  • Re: What is the best way to stop a Socket.BeginAccept call?
    ... If you want a graceful exit, then stop accepting new connections, ... close all worker sockets, close the listener socket. ... public void AddSocketToList ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: max connections
    ... So I do my 16t accept and after that the listener is closed. ... I ran some tests on a small server ... accepting directly without switching with the listener socket. ... server is now limited by 16 connections simultaneously. ...
    (microsoft.public.win32.programmer.networks)
  • Re: TNS-12528 TNS:listener: all appropriate instances are blocking new connections
    ... this caused an error login on the enterprise application deployed on ... During this period new connections were NOT accepted. ... The listener "knew" the value of PROCESSES (max. sessions). ...
    (comp.databases.oracle.server)
  • Re: force oracle to use tcp connections
    ... oracle listener to only use TCP and *never* use IPC connections? ...
    (comp.databases.oracle.server)