[EMAIL PROTECTED] Processes not yielding, and lockf
I'm running an Apache server on a FreeBSD server with 494 MB of RAM and an Intel Celeron 2.4 GHz CPU. A recent surge of traffic to my PHP site has been causing the server to come to its knees. The first symptom is that the server won't return my page when I access it through the browser. The connection times out. In researching, I found out that my available RAM had become cripplingly low (about 1 meg) because Apache had spawned over 100 different processes of itself. So, I figured the way to fix this was to limit how many processes Apache would start up max, so I edited the httpd.conf and set MaxClients to 40 (I'm using the prefork MPM) and KeepAliveTimeout to 15. That's fine, but now it runs out of available processes to handle requests very soon. I run "top" to see what's happening, and I see that most of the apache processes are in the "lockf" state. And a few are in "sbwait". I run "ps", and see that most of the apache processes are idle or sleeping. What do lockf and sbwait mean? Are the processes just idling? How do I get the Apache processes to die? Thanks for any help.
Re: [EMAIL PROTECTED] Processes not yielding, and lockf
I used the server-status handler with extended status to see what was happening. I have also reduced the KeepAliveTimeout to 4 seconds. I placed session_write_close() within my scripts. Currently all 256 requests (that is MaxClients) are being processed. Every single one of them is stuck on "Sending Reply". The server now has 980 KB free, but I feel certain that just including more RAM won't get rid of the problem. The SS field (Seconds since beginning of most recent request) looks as though it averages about 3000 seconds. The Req field (milliseconds to process last request) is actually 0 for all except about 15 or so which have values such as 2032313583 (an unrealistically high number, considering the server was last rebooted 5 hours ago). So, my next question is: what would cause the connection to be stuck on Sending Reply? Thanks. An excerpt of the server-status: SrvPIDAccMCPU SSReqConnChildSlotClientVHostRequest *0-0*8080/11/11*W* 0.39 657000.00.590.59 64.208.172.177mydomain.comGET /more.php?pid=25&PHPSESSID=c9d65dd1e729dfdddffebc5062d13878 *1-0*48760/11/45 *W* 0.21151600.00.410.79 64.208.172.177mydomain.comGET /comments.php?wid=1126&PHPSESSID=a4b917d6f7a2ec3c6da2058f51 *2-0*34860/19/42 *W* 1.39104700.00.851.39 64.208.172.177mydomain.comGET /comments.php?wid=1133&PHPSESSID=a4b917d6f7a2ec3c6da2058f51 *3-0*35170/1/22* W* 0.30901200.00.011.01 64.208.172.177mydomain.comGET /index.php?PHPSESSID=c9d65dd1e729dfdddffebc5062d13878 HTTP/ *4-0*35180/2/17* W* 0.27760700.00.020.30 64.208.172.177mydomain.comGET /more.php?pid=9&PHPSESSID=c9d65dd1e729dfdddffebc5062d13878 *5-0*29940/7/17*W * 1.35619500.00.210.71 64.208.172.177mydomain.comGET /more.php?pid=29&PHPSESSID=c9d65dd1e729dfdddffebc5062d13878 *6-0*9000/50/50* W* 1.81578900.01.041.04 64.208.172.177mydomain.comGET /more.php?pid=36&PHPSESSID=c9d65dd1e729dfdddffebc5062d13878 *7-0*35190/13/34 *W* 0.47385900.00.150.48 64.208.172.177mydomain.comGET /detail.php?pid=41&PHPSESSID=a4b917d6f7a2ec3c6da2058f51df87 SrvChild Server number - generation PIDOS process ID AccNumber of accesses this connection / this child / this slot MMode of operation CPUCPU usage, number of seconds SSSeconds since beginning of most recent request ReqMilliseconds required to process most recent request ConnKilobytes transferred this connection ChildMegabytes transferred this child SlotTotal megabytes transferred this slot On 12/14/06, Richard Lynch <[EMAIL PROTECTED]> wrote: On Wed, December 13, 2006 10:43 pm, Kevin Jones wrote: > What do lockf and sbwait mean? Are the processes just idling? This answer falls more under the realm of Voodoo than Debugging, but it's possible that the lockf processes are waiting on PHP to finish its locked session storage. It's very very very common to develop a web application that does this: PHP has to keep the session file locked the whole time because you might change the data in it, and in order to avoid race conditions, it cannot allow another process to write to that particular session cache. This is not an issue, unless your IMG tags, your iframes, your Ajax-y elements and so on all are trying to utilize the same session data... At which point a single page load, instead of doing the main document, IMGages, iframes, and Ajax stuff in parallel, has to end up doing them sequentially as PHP locks, processes, and unlocks the session data for each individual request. Inserting a http://php.net/session_write_close after your last usage of $_SESSION in every script is a fairly quick and easy way to minimize your current time-window of session lock-age. Consolidating $_SESSION activity into one portion of a script, instead of scattered willy-nilly, can be a long-term task, but give significant performance boost, as I understand it. Disclosure: I'm merely parroting what has been posted to PHP lists/forums here, and have not actually had to do this (yet) for any sites. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? - The official User-To-User support forum of the Apache HTTP Server Project. See http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] " from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED] httpd unresponsive
When I try to run Apache with "httpd", I only get a blank response. I'm compiling Apache 2.2.4 with mod_ssl for Windows XP Pro, using the instructions I found here: http://httpd.apache.org/docs/2.2/platform/win_compiling.html http://www.apachelounge.com/forum/viewtopic.php?t=778 When all is said and done, I try to run "httpd -D SSL -k install" (to install as a service) then "httpd -k start" from the Apache-2.2.4/bin directory. However, all that happens is a blank line in the command window followed by the command prompt. And when I try to access "http://localhost";, and " https://localhost";, the sites aren't up. Even "httpd -h" and "httpd -v" greet me with a blank line. Has anyone else had this problem? Is there some step I'm missing in compiling this for Windows? Thanks for any help. - Kevin Script I'm using to build Apache in Debug mode: CALL "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" CALL "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\setenv.cmd" cd "C:\httpd-2.2.4\srclib\openssl" perl Configure VC-WIN32 perl util\mkfiles.pl >MINFO perl util\mk1mf.pl dll no-asm no-mdc2 no-rc5 no-idea VC-WIN32 >makefile.rel perl util\mk1mf.pl dll debug no-asm no-mdc2 no-rc5 no-idea VC-WIN32 > makefile.dbg perl util\mkdef.pl 32 libeay no-asm no-mdc2 no-rc5 no-idea >ms\libeay32.def perl util\mkdef.pl 32 ssleay no-asm no-mdc2 no-rc5 no-idea >ms\ssleay32.def nmake -f makefile.rel nmake -f makefile.dbg cd "C:\httpd-2.2.4" nmake /f Makefile.win _apached nmake /f Makefile.win installd INSTDIR="C:\Apache-2.2.4"
Re: [EMAIL PROTECTED] httpd unresponsive
I'm doing a command line compile with nmake. Simply: nmake /f Makefile.win _apached nmake /f Makefile.win installd INSTDIR="C:\Apache-2.2.4" I first tried Visual C++ 2005 Express Edition, and couldn't get that to compile. I think that was because of references to .h files. With nmake, it compiles, but afterwards, it doesn't do anything. - Kevin On 2/1/07, Richard de Vries <[EMAIL PROTECTED]> wrote: What compiler are you using? I had a hell of a time trying to get Apache compiled for windows with Visual Studio Express -- I was experiencing all kinds of weird behavior. I finally abandoned the Express edition and tried it with the regular Visual Studio, which resolved all my problems. --- Kevin Jones <[EMAIL PROTECTED]> wrote: > When I try to run Apache with "httpd", I only get a > blank response. > > I'm compiling Apache 2.2.4 with mod_ssl for Windows > XP Pro, using the > instructions I found here: > http://httpd.apache.org/docs/2.2/platform/win_compiling.html > http://www.apachelounge.com/forum/viewtopic.php?t=778 > > When all is said and done, I try to run "httpd -D > SSL -k install" (to > install as a service) then "httpd -k start" from the > Apache-2.2.4/bin > directory. > > However, all that happens is a blank line in the > command window followed by > the command prompt. And when I try to access > "http://localhost";, and " > https://localhost";, the sites aren't up. > > Even "httpd -h" and "httpd -v" greet me with a blank > line. > > Has anyone else had this problem? Is there some step > I'm missing in > compiling this for Windows? > > Thanks for any help. > - Kevin > > > Script I'm using to build Apache in Debug mode: > > CALL "C:\Program Files\Microsoft Visual Studio > 8\VC\bin\vcvars32.bat" > CALL "C:\Program Files\Microsoft Platform SDK for > Windows Server 2003 > R2\setenv.cmd" > > cd "C:\httpd-2.2.4\srclib\openssl" > perl Configure VC-WIN32 > perl util\mkfiles.pl >MINFO > perl util\mk1mf.pl dll no-asm no-mdc2 no-rc5 no-idea > VC-WIN32 >makefile.rel > perl util\mk1mf.pl dll debug no-asm no-mdc2 no-rc5 > no-idea VC-WIN32 > > makefile.dbg > perl util\mkdef.pl 32 libeay no-asm no-mdc2 no-rc5 > no-idea >ms\libeay32.def > perl util\mkdef.pl 32 ssleay no-asm no-mdc2 no-rc5 > no-idea >ms\ssleay32.def > nmake -f makefile.rel > nmake -f makefile.dbg > > cd "C:\httpd-2.2.4" > nmake /f Makefile.win _apached > nmake /f Makefile.win installd > INSTDIR="C:\Apache-2.2.4" > Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 - The official User-To-User support forum of the Apache HTTP Server Project. See http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] " from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]