[
https://issues.apache.org/jira/browse/TS-4909?focusedWorklogId=30682&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-30682
]
ASF GitHub Bot logged work on TS-4909:
--------------------------------------
Author: ASF GitHub Bot
Created on: 14/Oct/16 21:03
Start Date: 14/Oct/16 21:03
Worklog Time Spent: 10m
Work Description: Github user bryancall commented on a diff in the pull
request:
https://github.com/apache/trafficserver/pull/1063#discussion_r83501005
--- 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) {
--- End diff --
Fixed this. Did a divide by 1024 for the setting.
Issue Time Tracking
-------------------
Worklog Id: (was: 30682)
Time Spent: 1h (was: 50m)
> Throttling based on resident memory usage
> -----------------------------------------
>
> Key: TS-4909
> URL: https://issues.apache.org/jira/browse/TS-4909
> Project: Traffic Server
> Issue Type: Improvement
> Components: Core
> Reporter: Bryan Call
> Fix For: 7.1.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Add a feature to stop accepting connections if the resident memory is over a
> certain limit.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)