Received: (qmail 10551 invoked by uid 2012); 2 Feb 1999 09:39:09 -0000 Message-Id: <19990202093909.10550.qmail@hyperreal.org> Date: 2 Feb 1999 09:39:09 -0000 From: Lee ChihCheng Reply-To: lee-1@catlover.com To: apbugs@hyperreal.org Subject: Keep Alive option let server response delay at first request. X-Send-Pr-Version: 3.2 >Number: 3815 >Category: os-windows >Synopsis: Keep Alive option let server response delay at first request. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Tue Feb 2 01:40:00 PST 1999 >Last-Modified: Fri May 21 10:13:48 PDT 1999 >Originator: lee-1@catlover.com >Organization: >Release: 1.3.4 >Environment: Hardware:AMDK6-2 300, 256MB RAM. IBM 8.4GB IDE HDD x 2, S3-765 PCI VGA Intel ExtherExpress 100 PCI OS:Windows NT 4.0 English Version, SP3 and Option Pack 4. Setting:IPX, NetBEUI, TCP/IP, only 1 ip address., No IIS or other server. >Description: My Apache 1.3.4 setting is: Timeout 100 KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 15 MaxRequestsPerChild 0 ThreadsPerChild 50 Listen 210.62.177.66:80 If I tune "KeepAlive Off" to On, the server will "Delay" 1~3 seconds while user "first" request. >How-To-Repeat: >Fix: Sorry, I don't know. >Audit-Trail: Category-Changed-From-To: general-os-windows Category-Changed-By: dgaudet Category-Changed-When: Tue Apr 20 18:11:07 PDT 1999 Comment-Added-By: dgaudet Comment-Added-When: Tue Apr 20 18:13:30 PDT 1999 Comment-Added: This sounds like a windows TCP bug. State-Changed-From-To: open-feedback State-Changed-By: stoddard State-Changed-When: Wed Apr 28 21:10:59 PDT 1999 State-Changed-Why: How are you starting the server after the change? (What command are you using?). If you start Apache from the command line using 'apache', the server will not come up for several seconds (it is querying the service manager, which is unnecessary if apache is run from the command line). If you try with 'apache -s', you will not see this delay in starting. Could this be the problem you are seeing? it comes up immediately. -s tells the server not to try to query the service manager From: Lee ChihCheng To: stoddard@apache.org, apbugs@Apache.Org Cc: Subject: Re: os-windows/3815: Keep Alive option let server response delay at first request. Date: Thu, 29 Apr 1999 20:41:05 +0800 Dear sir: Sorry, My earlier post is not really right. After few days watch, I found the reason is because my site is too busy. Now my Apache setting is like: ------------------------- KeepAlive Off MaxKeepAliveRequests 0 KeepAliveTimeout 20 MaxRequestsPerChild 0 ThreadsPerChild 256 ------------------------- And I use http://mysitename/server-staus to check it, screen show: 130 requests currently being processed, 126 idle servers So, When I switch to "KeepAlive On", the "MaxKeepAliveRequests" is not enough. (I think maybe 300~800 users online, if keep-alive) I don't understand why Apache server never tell me "too busy", Apache just delay each web-page "first" 3~4 seconds. (sometimes 10~15 seconds) So, I disable KeepAlive now. However I hope user can keep-alive, But I found Apache's Windows version just support max 256 users keep-alive. it's too small for me. And I found the only way to expand this number is "modify the source, re-compiler it" but it's too hard for me... I hope the future version's apache can expand this limit. There is also a small problem. "Apache -k restart" can restart apache. but not immediately. If I send this command at PM23:30, the Apache will restart at AM1:00 ~ AM2:00 It's really too late. Thanks for your reply , and sorry for my broken english. Lee-1 stoddard@apache.org wrote: > > [In order for any reply to be added to the PR database, ] > [you need to include in the Cc line ] > [and leave the subject line UNCHANGED. This is not done] > [automatically because of the potential for mail loops. ] > [If you do not include this Cc, your reply may be ig- ] > [nored unless you are responding to an explicit request ] > [from a developer. ] > [Reply only with text; DO NOT SEND ATTACHMENTS! ] > > Synopsis: Keep Alive option let server response delay at first request. > > State-Changed-From-To: open-feedback > State-Changed-By: stoddard > State-Changed-When: Wed Apr 28 21:10:59 PDT 1999 > State-Changed-Why: > How are you starting the server after the change? (What command are you using?). > If you start Apache from the command line using 'apache', the server will not come up for > several seconds (it is querying the service manager, which is unnecessary if apache is > run from the command line). If you try with 'apache -s', you will not see this > delay in starting. Could this be the problem you are seeing? > it comes up immediately. -s tells the > server not to try to query the service manager State-Changed-From-To: feedback-open State-Changed-By: coar State-Changed-When: Thu Apr 29 13:09:48 PDT 1999 State-Changed-Why: [User sent response] Release-Changed-From-To: 1.3.4 for NT-1.3.4 Release-Changed-By: coar Release-Changed-When: Thu Apr 29 13:09:48 PDT 1999 State-Changed-From-To: open-analyzed State-Changed-By: stoddard State-Changed-When: Fri May 14 06:29:32 PDT 1999 State-Changed-Why: Lee, Thanks for the additional info. Now I understand what is happening. Apache on Win32 will accept all connections and queue them for the worker thread pool. The queue size is unbounded (not good. I'll try to fix this in the next release). What you are seeing is hundreds of connections being accepted and queued, but all 250 worker threads are blocked on persistent connections, blocked waiting to receive requests from clients. If a thread is blocked waiting on data from the client, it is not available to service new connections on the queue. Here are a tuning tip... You need to balance the settings of ThreadsPerChild with the KeepAliveTimeout. First, I'd decrease KeepAliveTimeout, to perhaps 10 or maybe 5 seconds. If you still see problems, try increasing ThreadsPerChild. You should favor decreasing KeepAliveTimeout over increasing ThreadsPerChild. State-Changed-From-To: analyzed-closed State-Changed-By: stoddard State-Changed-When: Fri May 21 10:13:48 PDT 1999 State-Changed-Why: I just checked in changes to: 1. Honor restart and shutdown, even if it means loosing connections in the TCP stack's listen queue. Restart triggered by MaxRequestsPerChild will wait until the server is not busy before restarting the child process 2. Increase HARD_SERVER_LIMIT on Win32 to 1500 Thee changes should be available with Apache 1.3.7. I >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include in the Cc line ] [and leave the subject line UNCHANGED. This is not done] [automatically because of the potential for mail loops. ] [If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request ] [from a developer. ] [Reply only with text; DO NOT SEND ATTACHMENTS! ]