Mantis - Resin
Viewing Issue Advanced Details
6090 minor always 09-07-17 11:45 09-08-17 13:11
stbu  
 
normal  
closed 4.0.50  
no change required  
none    
none  
0006090: Throttle Filter configuration with max-total-requests + timeout setting
I have a question regarding the Throttle Filter in Resin 4.0.50.
Based on the documentation (http://www.caucho.com/resin-4.0/admin/filters.xtp#ThrottleFilter) [^] I did the following configuration:

  <filter filter-name="throttle"
        filter-class="com.caucho.filters.ThrottleFilter">
    <init>
      <max-total-requests>10</max-total-requests>
      <timeout>60s</timeout>
    </init>
  </filter>

  <filter-mapping url-pattern="/*" filter-name="throttle"/>


The Caucho documentation describes these two parameters as follows:

max-total-requests => maximum number of requests allowed per IP within timeout
timeout => interval for max-total-requests

So I would expect that requests from certain IP address are handled like this:

[17-09-02 18:01:00,890] Request allowed (0000001 in last 60s)
[17-09-02 18:01:00,944] Request allowed (0000002 in last 60s)
[17-09-02 18:01:00,994] Request allowed (0000003 in last 60s)
[17-09-02 18:01:01,039] Request allowed (0000004 in last 60s)
[17-09-02 18:01:01,092] Request allowed (0000005 in last 60s)
[17-09-02 18:01:01,162] Request allowed (0000006 in last 60s)
[17-09-02 18:01:01,212] Request allowed (0000007 in last 60s)
[17-09-02 18:01:01,264] Request allowed (0000008 in last 60s)
[17-09-02 18:01:01,306] Request allowed (0000009 in last 60s)
[17-09-02 18:01:01,347] Request allowed (0000010 in last 60s)
[17-09-02 18:01:01,398] Should be disallowed. Responding with 503 as there have been already 10 requests within the last 60 seconds.
[17-09-02 18:01:01,440] Should be disallowed. Responding with 503 as there have been already 10 requests within the last 60 seconds.


But all requests (even more than listed here) are processed without seeing any throttling effect at all.

Is my understanding of the ThrottleFilter using above configuration wrong or is this a bug?

Notes
(0006789)
ferg   
09-08-17 13:11   
The throttle is for a different model: concurrent requests.

The total-max-requests is a limit for the servlet for a maximum concurrent requests, regardless of IP.

The timeout is for the Java Semaphore that limits the requests.

So, while the behavior in the bug report is a logical kind of throttling, it's not the throttling that ThrottleFilter is doing.