Discussion:
Apache unnecessarity keeping requests open
(too old to reply)
The Doctor
2014-10-10 16:05:12 UTC
Permalink
How do you tell Apaceh once a request is completed to free
up the request for new requests?

Just looking at our apacehctl status and I see a lot
of unnecessary transactions open and taking up resource.

Running the latest Apache 2.2
--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.me/rootnl2k Look at Psalms 14 and 53 on Atheism
Danger comes when our feelings outweigh reality. -unknown
Barry Margolin
2014-10-10 16:23:11 UTC
Permalink
Post by The Doctor
How do you tell Apaceh once a request is completed to free
up the request for new requests?
The HTTP/1.1 spec says that connections should be persistent by default.
It's common to need multiple pages from the same site in a short period
of time, and reopening a connection for each of them slow things down
unnecessarily.
Post by The Doctor
Just looking at our apacehctl status and I see a lot
of unnecessary transactions open and taking up resource.
Running the latest Apache 2.2
Google "apache idle connection timeout"
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
The Doctor
2014-10-10 22:31:00 UTC
Permalink
Post by Barry Margolin
Post by The Doctor
How do you tell Apaceh once a request is completed to free
up the request for new requests?
The HTTP/1.1 spec says that connections should be persistent by default.
It's common to need multiple pages from the same site in a short period
of time, and reopening a connection for each of them slow things down
unnecessarily.
Sounds like an exploit to me.
Post by Barry Margolin
Post by The Doctor
Just looking at our apacehctl status and I see a lot
of unnecessary transactions open and taking up resource.
Running the latest Apache 2.2
Google "apache idle connection timeout"
Will do.
Post by Barry Margolin
--
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.me/rootnl2k Look at Psalms 14 and 53 on Atheism
Danger comes when our feelings outweigh reality. -unknown
Barry Margolin
2014-10-10 22:49:00 UTC
Permalink
Post by The Doctor
Post by Barry Margolin
Post by The Doctor
How do you tell Apaceh once a request is completed to free
up the request for new requests?
The HTTP/1.1 spec says that connections should be persistent by default.
It's common to need multiple pages from the same site in a short period
of time, and reopening a connection for each of them slow things down
unnecessarily.
Sounds like an exploit to me.
Only if the server has no timeout on idle connections. I believe that
all productions servers do.
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
C.
2015-03-14 22:23:49 UTC
Permalink
Post by Barry Margolin
Post by The Doctor
Post by The Doctor
How do you tell Apaceh once a request is completed to free
up the request for new requests?
...
Post by Barry Margolin
Post by The Doctor
Sounds like an exploit to me.
....
Post by Barry Margolin
Only if the server has no timeout on idle connections. I believe that
all productions servers do.
No.

The default config out of the box, and on most bundled versions of Apache is with a KeepAliveTimeout of 5 seconds - this is ridiculously high unless your site uses Ajax *very* heavily. Unfortunately Apache only allows you set to set an integer value for this - if you have capacity issues then setting it to 1 will help. Generally a setting of 2 should be *more* than long enough (if you have a large proportion of users accessing the system by 2G mobile, then leaving it at 5 is probably the way to go).

If you've got a very, VERY good caching strategy, and the non-cacheable content is almost exclusively served up as HTML (e.g. for a SaaS type service) then setting a Connection: close (mod_headers) response where the mimetype is text/html (or emitting such a header from your PHP/Java?Perl tier) will improve capacity.

The actual amount of resource it using up should be very low compared to an active connection. I assume we are talking about pre-fork apache here - so you should already know exactly how much memory an active Apache instance uses compares to an inactive one (otherwise your maxclients/maxservers is not configured correctly). The difference should be of the order of 10:1

C.

Loading...