You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Eric Covener <co...@gmail.com> on 2009/11/15 01:57:21 UTC

Re: ap_sub_req_lookup_uri(r->uri, r, NULL)->content_type always returns 'text/plain'?

On Sat, Nov 14, 2009 at 7:37 PM,  <oh...@cox.net> wrote:

> Our use case is slightly different that the original one for this module.  The original code is designed to limit the number of connections from any given IP address, whereas in my case, we want to limit the total number of connections to the entire Apache server instance.

What does this get you over just setting MaxClients directly?

-- 
Eric Covener
covener@gmail.com

Re: ap_sub_req_lookup_uri(r->uri, r, NULL)->content_type always returns 'text/plain'?

Posted by Eric Covener <co...@gmail.com>.
On Sat, Nov 14, 2009 at 8:10 PM,  <oh...@cox.net> wrote:
> "MaxClients" was one of the first approaches that I tried when i was asked about this.
>
> The problem with MaxClients that I found was that it appeared that when it was used, Apache would queue up the requests.  The end-result from the user perspective was that either response time would look really slow, or their browser would eventually timeout, and they'd get (in IE) a "The page cannot be displayed".

Wanting your own errordoc makes sense, but the queuing is just:
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listenbacklog


-- 
Eric Covener
covener@gmail.com

Re: ap_sub_req_lookup_uri(r->uri, r, NULL)->content_type always returns 'text/plain'?

Posted by oh...@cox.net.
---- Eric Covener <co...@gmail.com> wrote: 
> On Sat, Nov 14, 2009 at 7:37 PM,  <oh...@cox.net> wrote:
> 
> > Our use case is slightly different that the original one for this module.  The original code is designed to limit the number of connections from any given IP address, whereas in my case, we want to limit the total number of connections to the entire Apache server instance.
> 
> What does this get you over just setting MaxClients directly?
> 
> -- 
> Eric Covener
> covener@gmail.com


Eric,

"MaxClients" was one of the first approaches that I tried when i was asked about this.

The problem with MaxClients that I found was that it appeared that when it was used, Apache would queue up the requests.  The end-result from the user perspective was that either response time would look really slow, or their browser would eventually timeout, and they'd get (in IE) a "The page cannot be displayed".

For the situation that I've been asked to look into, they don't want either of the above (slow response or "The page cannot be displayed"), but they want the user to get some kind of message like "System too busy.  Please try again later.".

With mod_limitipconn (vs. MaxClients), when mod_limitipconn is "triggered", Apache immediately (well, almost immediately) sends a 503 response, and with a custom ErrorDocument, we can customize the message.

This works pretty well, but the problem is that since most pages have embedded content (css, images, etc.), and, without the working NoIPLimit directive, mod_limitipconn will send 503 responses indiscriminately, i.e., it can send a 503 response to a GET for a CSS, which makes the pages that the user's see look broken.  

I was hoping that I could get the NoIPLimit directive to work, then I could then configure mod_limitipconn to not count requests for things like CSS and GIFs, but per my original post, it looks like, for some reason the "content_type" that it's getting is always "text/plain".  Actually, I think what's happening is when it calls that ap_...uri(), it's getting nothing, so it uses the default content type, which happens to be "text/plain".

Thanks,
Jim