Github user srdo commented on a diff in the pull request: https://github.com/apache/storm/pull/2113#discussion_r120451243 --- Diff: storm-server/src/main/java/org/apache/storm/daemon/supervisor/BasicContainer.java --- @@ -728,8 +758,145 @@ protected String javaCmd(String cmd) { return commandList; } + + @Override + public boolean isMemoryLimitViolated(LocalAssignment withUpdatedLimits) throws IOException { + if (super.isMemoryLimitViolated(withUpdatedLimits)) { + return true; + } + if (_resourceIsolationManager != null) { + // In the short term the goal is to not shoot anyone unless we really need to. + // The on heap should limit the memory usage in most cases to a reasonable amount + // If someone is using way more than they requested this is a bug and we should + // not allow it + long usageMb; + long memoryLimitMb; + long hardMemoryLimitOver; + String typeOfCheck; + + if (withUpdatedLimits.is_has_node_shared_memory()) { + //We need to do enforcement on a topology level, not a single worker level... + // Because in for cgroups each page in shared memory goes to the worker that touched it + // first. We may need to make this more plugable in the future and let the resource + // isolation manager tell us what to do + usageMb = getTotalTopologyMemoryUsed(); + memoryLimitMb = getTotalTopologyMemoryReserved(withUpdatedLimits); + hardMemoryLimitOver = this.hardMemoryLimitOver * getTotalWorkersForThisTopology(); + typeOfCheck = "TOPOLOGY " + _topologyId; + } else { + usageMb = getMemoryUsageMb(); + memoryLimitMb = this.memoryLimitMB; + hardMemoryLimitOver = this.hardMemoryLimitOver; + typeOfCheck = "WORKER " + _workerId; + } + LOG.debug( + "Enforcing memory usage for {} with usgae of {} out of {} total and a hard limit of {}", --- End diff -- usgae -> usage
--- 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. ---