[
https://issues.apache.org/jira/browse/STORM-1336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15131154#comment-15131154
]
ASF GitHub Bot commented on STORM-1336:
---------------------------------------
Github user redsanket commented on a diff in the pull request:
https://github.com/apache/storm/pull/1053#discussion_r51788986
--- Diff:
storm-core/src/jvm/org/apache/storm/container/cgroup/core/MemoryCore.java ---
@@ -0,0 +1,189 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.storm.container.cgroup.core;
+
+import org.apache.storm.container.cgroup.CgroupUtils;
+import org.apache.storm.container.cgroup.Constants;
+import org.apache.storm.container.cgroup.SubSystemType;
+
+import java.io.IOException;
+
+public class MemoryCore implements CgroupCore {
+
+ public static final String MEMORY_STAT = "/memory.stat";
+ public static final String MEMORY_USAGE_IN_BYTES =
"/memory.usage_in_bytes";
+ public static final String MEMORY_MEMSW_USAGE_IN_BYTES =
"/memory.memsw.usage_in_bytes";
+ public static final String MEMORY_MAX_USAGE_IN_BYTES =
"/memory.max_usage_in_bytes";
+ public static final String MEMORY_MEMSW_MAX_USAGE_IN_BYTES =
"/memory.memsw.max_usage_in_bytes";
+ public static final String MEMORY_LIMIT_IN_BYTES =
"/memory.limit_in_bytes";
+ public static final String MEMORY_MEMSW_LIMIT_IN_BYTES =
"/memory.memsw.limit_in_bytes";
+ public static final String MEMORY_FAILCNT = "/memory.failcnt";
+ public static final String MEMORY_MEMSW_FAILCNT =
"/memory.memsw.failcnt";
+ public static final String MEMORY_FORCE_EMPTY = "/memory.force_empty";
+ public static final String MEMORY_SWAPPINESS = "/memory.swappiness";
+ public static final String MEMORY_USE_HIERARCHY =
"/memory.use_hierarchy";
+ public static final String MEMORY_OOM_CONTROL = "/memory.oom_control";
+
+ private final String dir;
+
+ public MemoryCore(String dir) {
+ this.dir = dir;
+ }
+
+ @Override
+ public SubSystemType getType() {
+ return SubSystemType.memory;
+ }
+
+ public static class Stat {
+ public final long cacheSize;
+ public final long rssSize;
+ public final long mappedFileSize;
+ public final long pgpginNum;
+ public final long pgpgoutNum;
+ public final long swapSize;
+ public final long activeAnonSize;
+ public final long inactiveAnonSize;
+ public final long activeFileSize;
+ public final long inactiveFileSize;
+ public final long unevictableSize;
+ public final long hierarchicalMemoryLimitSize;
+ public final long hierarchicalMemswLimitSize;
+ public final long totalCacheSize;
+ public final long totalRssSize;
+ public final long totalMappedFileSize;
+ public final long totalPgpginNum;
+ public final long totalPgpgoutNum;
+ public final long totalSwapSize;
+ public final long totalActiveAnonSize;
+ public final long totalInactiveAnonSize;
+ public final long totalActiveFileSize;
+ public final long totalInactiveFileSize;
+ public final long totalUnevictableSize;
+ public final long totalHierarchicalMemoryLimitSize;
+ public final long totalHierarchicalMemswLimitSize;
+
+ public Stat(String output) {
+ String[] splits = output.split("\n");
+ this.cacheSize = Long.parseLong(splits[0]);
+ this.rssSize = Long.parseLong(splits[1]);
+ this.mappedFileSize = Long.parseLong(splits[2]);
+ this.pgpginNum = Long.parseLong(splits[3]);
+ this.pgpgoutNum = Long.parseLong(splits[4]);
+ this.swapSize = Long.parseLong(splits[5]);
+ this.inactiveAnonSize = Long.parseLong(splits[6]);
+ this.activeAnonSize = Long.parseLong(splits[7]);
+ this.inactiveFileSize = Long.parseLong(splits[8]);
+ this.activeFileSize = Long.parseLong(splits[9]);
+ this.unevictableSize = Long.parseLong(splits[10]);
+ this.hierarchicalMemoryLimitSize = Long.parseLong(splits[11]);
+ this.hierarchicalMemswLimitSize = Long.parseLong(splits[12]);
+ this.totalCacheSize = Long.parseLong(splits[13]);
+ this.totalRssSize = Long.parseLong(splits[14]);
+ this.totalMappedFileSize = Long.parseLong(splits[15]);
+ this.totalPgpginNum = Long.parseLong(splits[16]);
+ this.totalPgpgoutNum = Long.parseLong(splits[17]);
+ this.totalSwapSize = Long.parseLong(splits[18]);
+ this.totalInactiveAnonSize = Long.parseLong(splits[19]);
+ this.totalActiveAnonSize = Long.parseLong(splits[20]);
+ this.totalInactiveFileSize = Long.parseLong(splits[21]);
+ this.totalActiveFileSize = Long.parseLong(splits[22]);
+ this.totalUnevictableSize = Long.parseLong(splits[23]);
+ this.totalHierarchicalMemoryLimitSize =
Long.parseLong(splits[24]);
+ this.totalHierarchicalMemswLimitSize =
Long.parseLong(splits[25]);
--- End diff --
I presume replacing it with totalHierarchialMemSwapLimitSize would be more
readable, if it is what it means
> Evalute/Port JStorm cgroup support
> ----------------------------------
>
> Key: STORM-1336
> URL: https://issues.apache.org/jira/browse/STORM-1336
> Project: Apache Storm
> Issue Type: New Feature
> Components: storm-core
> Reporter: Robert Joseph Evans
> Assignee: Boyang Jerry Peng
> Labels: jstorm-merger
>
> Supports controlling the upper limit of CPU core usage for a worker using
> cgroups
> Sounds like a good start, will be nice to integrate it with RAS requests too.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)