Преглед на файлове

Merge pull request #8579 from jakesmith/hpcc-15467

HPCC-15467 Allow leaf and block node cache configuration

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday преди 9 години
родител
ревизия
b96a55027c
променени са 4 файла, в които са добавени 15 реда и са изтрити 10 реда
  1. 3 0
      system/jhtree/jhtree.cpp
  2. 8 9
      thorlcr/graph/thgraph.cpp
  3. 0 1
      thorlcr/graph/thgraph.hpp
  4. 4 0
      thorlcr/thorutil/thbufdef.hpp

+ 3 - 0
system/jhtree/jhtree.cpp

@@ -1253,7 +1253,10 @@ void CKeyStore::clearCache(bool killAll)
     synchronized block(mutex);
 
     if (killAll)
+    {
+        clearNodeCache(); // no point in keeping old nodes cached if key store cache has been cleared
         keyIndexCache.kill();
+    }
     else
     {
         StringArray goers;

+ 8 - 9
thorlcr/graph/thgraph.cpp

@@ -2352,7 +2352,6 @@ CJobBase::CJobBase(ILoadedDllEntry *_querySo, const char *_graphName) : querySo(
     mpJobTag = TAG_NULL;
     globalMemoryMB = globals->getPropInt("@globalMemorySize"); // in MB
     numChannels = globals->getPropInt("@channelsPerSlave", 1);
-    oldNodeCacheMem = 0;
     pluginMap = new SafePluginMap(&pluginCtx, true);
 
 // JCSMORE - Will pass down at job creation time...
@@ -2462,12 +2461,14 @@ void CJobBase::startJob()
     }
     PrintMemoryStatusLog();
     logDiskSpace();
-    unsigned keyNodeCacheMB = (unsigned)getWorkUnitValueInt("keyNodeCacheMB", 0);
-    if (keyNodeCacheMB)
-    {
-        oldNodeCacheMem = setNodeCacheMem(keyNodeCacheMB * 0x100000);
-        PROGLOG("Key node cache size set to: %d MB", keyNodeCacheMB);
-    }
+    unsigned keyNodeCacheMB = (unsigned)getWorkUnitValueInt("keyNodeCacheMB", DEFAULT_KEYNODECACHEMB * queryJobChannels());
+    unsigned keyLeafCacheMB = (unsigned)getWorkUnitValueInt("keyLeafCacheMB", DEFAULT_KEYLEAFCACHEMB * queryJobChannels());
+    unsigned keyBlobCacheMB = (unsigned)getWorkUnitValueInt("keyBlobCacheMB", DEFAULT_KEYBLOBCACHEMB * queryJobChannels());
+    setNodeCacheMem(keyNodeCacheMB * 0x100000);
+    setLeafCacheMem(keyLeafCacheMB * 0x100000);
+    setBlobCacheMem(keyBlobCacheMB * 0x100000);
+    PROGLOG("Key node caching setting: node=%u MB, leaf=%u MB, blob=%u MB", keyNodeCacheMB, keyLeafCacheMB, keyBlobCacheMB);
+
     unsigned keyFileCacheLimit = (unsigned)getWorkUnitValueInt("keyFileCacheLimit", 0);
     if (!keyFileCacheLimit)
         keyFileCacheLimit = (querySlaves()+1)*2;
@@ -2480,8 +2481,6 @@ void CJobBase::endJob()
     stopPerformanceMonitor();
     LOG(MCdebugProgress, thorJob, "Job ended : %s", graphName.get());
     clearKeyStoreCache(true);
-    if (oldNodeCacheMem)
-        setNodeCacheMem(oldNodeCacheMem);
     PrintMemoryStatusLog();
 }
 

+ 0 - 1
thorlcr/graph/thgraph.hpp

@@ -765,7 +765,6 @@ protected:
     unsigned forceLogGraphIdMin, forceLogGraphIdMax;
     Owned<IContextLogger> logctx;
     Owned<IPerfMonHook> perfmonhook;
-    size32_t oldNodeCacheMem;
     CIArrayOf<CJobChannel> jobChannels;
     OwnedMalloc<unsigned> jobChannelSlaveNumbers;
     OwnedMalloc<unsigned> jobSlaveChannelNum;

+ 4 - 0
thorlcr/thorutil/thbufdef.hpp

@@ -55,6 +55,10 @@
 #define LOOP_SMART_BUFFER_SIZE                  (0x100000*12)           // 12MB
 #define LOCALRESULT_BUFFER_SIZE                 (0x100000*10)           // 10MB
 
+#define DEFAULT_KEYNODECACHEMB                  10
+#define DEFAULT_KEYLEAFCACHEMB                  50
+#define DEFAULT_KEYBLOBCACHEMB                  0
+
 #define DISTRIBUTE_RESMEM(N) ((DISTRIBUTE_DEFAULT_OUT_BUFFER_SIZE * (N)) + DISTRIBUTE_DEFAULT_IN_BUFFER_SIZE)