moonchen commented on code in PR #13406:
URL: https://github.com/apache/trafficserver/pull/13406#discussion_r3730414936
##########
plugins/experimental/rate_limit/limiter.h:
##########
@@ -327,6 +327,25 @@ template <class T> class RateLimiter
return item;
}
+ // Remove a still-queued element (e.g. a connection that closed before it
was resumed).
+ // Returns true if it was found in the queue, so the caller can tell a
queued element
+ // (which never reserved a slot) from one that was already resumed.
+ bool
+ remove(T elem)
+ {
+ std::lock_guard<std::mutex> lock(_queue_lock);
+
+ for (auto it = _queue.begin(); it != _queue.end(); ++it) {
Review Comment:
> how big can queue get?
Unbounded by default, which I agree is not sensible.
`_max_queue` is `0` (no queue) until a `queue:` block appears, and then
`limiter.h:214` is:
```cpp
_max_queue = queue["size"] ? queue["size"].as<uint32_t>() : UINT32_MAX;
```
A `queue:` block without a `size:` gets `UINT32_MAX`, and
`full()` (`_size >= max_queue()`) can then never trip. The practical ceiling
becomes `proxy.config.net.connections_throttle`, 30000 by default.
`_queue` is a `std::deque`, so an erase from the middle is O(n). I'm filing
an issue: #13511 to update defaults, and revisit this queue data structure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]