You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by GitBox <gi...@apache.org> on 2020/03/31 15:10:59 UTC

[GitHub] [storm] Ethanlm commented on a change in pull request #3237: STORM-3259: Adds NUMA awareness to enable worker pinning

Ethanlm commented on a change in pull request #3237: STORM-3259: Adds NUMA awareness to enable worker pinning
URL: https://github.com/apache/storm/pull/3237#discussion_r400949079
 
 

 ##########
 File path: storm-client/src/jvm/org/apache/storm/utils/Utils.java
 ##########
 @@ -124,11 +124,47 @@
     private static String memoizedLocalHostnameString = null;
     public static final Pattern TOPOLOGY_KEY_PATTERN = Pattern.compile("^[\\w \\t\\._-]+$", Pattern.UNICODE_CHARACTER_CLASS);
 
+    public static final String NUMA_MEMORY_IN_MB = "numa.memory.mb";
+    public static final String NUMA_CORES = "numa.cores";
+    public static final String NUMA_PORTS = "numa.ports";
+    public static final String NUMA_GENERIC_RESOURCES_MAP = "numa.generic.resources.map";
+
     static {
         localConf = readStormConfig();
         serializationDelegate = getSerializationDelegate(localConf);
     }
 
+    /**
+     * Return supervisor numa configuration.
+     * @param stormConf stormConf
+     * @return getNumaMap
+     */
+    public static Map<String, Object> getNumaMap(Map<String, Object> stormConf) {
+        Object numa = stormConf.get(Config.SUPERVISOR_NUMA_META);
+        if (numa == null) {
+            return Collections.emptyMap();
+        }
+        return (Map<String, Object>) numa;
+    }
+
+    /**
+     * getNumaIdForPort.
+     * @param port port
+     * @param stormConf stormConf
+     * @return getNumaIdForPort
+     */
+    public static String getNumaIdForPort(Number port, Map<String, Object> stormConf) {
+        Map<String, Object> validatedNumaMap = getNumaMap(stormConf);
+        for (Entry<String, Object> numaEntry : validatedNumaMap.entrySet()) {
+            Map numaMap  = (Map<String, Object>) numaEntry.getValue();
 
 Review comment:
   `Map` should be `Map<String, Object>`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services