Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/1063#discussion_r82056447
  
    --- Diff: proxy/Main.cc ---
    @@ -346,6 +346,54 @@ class DiagsLogContinuation : public Continuation
       }
     };
     
    +class MemoryLimit : public Continuation
    +{
    +public:
    +  MemoryLimit() : Continuation(new_ProxyMutex()), _memory_limit(0) { 
SET_HANDLER(&MemoryLimit::periodic); }
    +  ~MemoryLimit() { mutex = NULL; }
    +  int
    +  periodic(int event, Event *e)
    +  {
    +    if (event == EVENT_IMMEDIATE) {
    +      // rescheduled from periodic to immediate event
    +      // this is the indication to terminate
    +      delete this;
    +      return EVENT_DONE;
    +    }
    +    if (_memory_limit == 0) {
    +      // first time it has been run
    +      _memory_limit = 
REC_ConfigReadInteger("proxy.config.memory.max_usage");
    +    }
    +    if (_memory_limit > 0) {
    +      if (getrusage(RUSAGE_SELF, &_usage) == 0) {
    +        Debug("server", "memory usage - ru_maxrss: %ld memory limit: %" 
PRId64, _usage.ru_maxrss, _memory_limit);
    +        if (_usage.ru_maxrss > _memory_limit) {
    +          if (net_memory_throttle == false) {
    +            net_memory_throttle = true;
    +            Debug("server", "memory usage exceeded limit - ru_maxrss: %ld 
memory limit: %" PRId64, _usage.ru_maxrss, _memory_limit);
    +          }
    +        } else {
    +          if (net_memory_throttle == true) {
    +            net_memory_throttle = false;
    +            Debug("server", "memory usage under limit - ru_maxrss: %ld 
memory limit: %" PRId64, _usage.ru_maxrss, _memory_limit);
    +          }
    +        }
    +      }
    +    } else {
    +      // this feature has not be enabled
    +      Debug("server", "limiting connections baxed on memory usage has been 
disabled");
    --- End diff --
    
    s/baxed/based/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to