Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

implementing an SLA for a request in apache

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


nrichter at gmail

Jul 3, 2009, 9:56 AM

Post #1 of 3 (216 views)
Permalink
implementing an SLA for a request in apache

Hi,

Here's a problem I'd like to solve. Configure apache to receive a
request and proxy/forward it off to a backend app server (tomcat) ..
wait a specified period of time .. and no response is received send
back a static file or a return code like 204.

Essentially it's a combination between the below mod_rewrite and
mod_alias directives with a timeout. Below example uses solr without
loss of generality.

RedirectMatch 204 /search/(.*)$
RewriteRule ^/search/(.*)$ http://backend:8080/solr/$1 [P]

Logic below:

If url matches rewrite-rule regex then
{
set timer for 500ms with timer_callback()
force proxy to secondary url after rewriting it
if(response from proxy is > 199 and < 300)
return response
else
return 204
}

timer_callback()
{
send back 204
}

Instead of returning 204 one could also serve back a static file.

The general idea is to expose a url that has a near-guaranteed
response time limit where a 204 or static default is acceptable
behaviour.

I suspect that we'll need to write an apache module to do this.. yet
surely this question has been asked before? Ideas?

Thanks - Neal

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


krist.vanbesien at gmail

Jul 6, 2009, 3:39 AM

Post #2 of 3 (177 views)
Permalink
Re: implementing an SLA for a request in apache [In reply to]

On Fri, Jul 3, 2009 at 6:56 PM, Neal Richter<nrichter[at]gmail.com> wrote:
> Hi,
>
>  Here's a problem I'd like to solve.  Configure apache to receive a
> request and proxy/forward it off to a backend app server (tomcat) ..
> wait a specified period of time .. and no response is received send
> back a static file or a return code like 204.

There is a ProxyTimeout directive that allows you to set a timeout to
proxy requests. That combined with an ErrorDocument ought to do it.

Eg.

ProxyTimeout 300
ErrorDocument 504 /errorpages/504.html

krist




--
krist.vanbesien[at]gmail.com
krist[at]vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


nrichter at gmail

Jul 6, 2009, 8:23 AM

Post #3 of 3 (179 views)
Permalink
Re: implementing an SLA for a request in apache [In reply to]

On Mon, Jul 6, 2009 at 4:39 AM, Krist van
Besien<krist.vanbesien[at]gmail.com> wrote:
> ProxyTimeout 300
> ErrorDocument 504 /errorpages/504.html

Thanks. I looked at this. ProxyTimeout does not accept anything less
than 1 second. I need timeouts after 700-800ms. The ErrorDocument
preserves the error's return code.. I'd like to return non error codes
and make the API service respond with successful HTTP codes and empty
data if a timeout on the backend server occurs.

- Neal

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.