Practical mod_perl / HTML Book /



previous page: 5.11.4. Tracking and Terminating Hanging Processes
  
page up: HTML Version of the book
  
next page: 5.11.6. Limiting the Request-Rate Speed (Robot Blocking)

5.11.5. Limiting the Number of Processes Serving the Same Resource


To limit the number of Apache children that can simultaneously serve a specific resource, take a look at the Apache mod_throttle_access module.

Throttling access is useful, for example, when a handler uses a resource that places a limitation on concurrent access or that is very CPU-intensive. mod_throttle_access limits the number of concurrent requests to a given URI.

Consider a service providing the following three URIs:

/perl/news/
/perl/webmail/
/perl/morphing/

The response times of the first two URIs are critical, since people want to read the news and their email interactively. The third URI is a very CPU- and RAM-intensive image-morphing service, provided as a bonus to the users. Since we do not want users to abuse this service, we have to set some limit on the number of concurrent requests for this resource. If we do not, the other two critical resources may have their performance degraded.

When compiled or loaded into Apache and enabled, mod_throttle_access makes the MaxConcurrentReqs directive available. For example, the following setting:

<Location "/perl/morphing">
    <Limit PUT GET POST>
        MaxConcurrentReqs 10
    </Limit>
</Location>

will allow only 10 concurrent PUT, GET, HEAD (as implied by GET), or POST requests for the URI /perl/morphing to be processed at any given time. The other two URIs in our example remain unlimited.

 

Continue to:

  • prev: 5.11.4. Tracking and Terminating Hanging Processes
  • Table of Contents
  • next: 5.11.6. Limiting the Request-Rate Speed (Robot Blocking)







TOP
previous page: 5.11.4. Tracking and Terminating Hanging Processes
  
page up: HTML Version of the book
  
next page: 5.11.6. Limiting the Request-Rate Speed (Robot Blocking)


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com