|
|
@ -38,25 +38,24 @@ import net.yacy.kelondro.table.Table;
|
|
|
|
import net.yacy.kelondro.util.FileUtils;
|
|
|
|
import net.yacy.kelondro.util.FileUtils;
|
|
|
|
import net.yacy.kelondro.util.Formatter;
|
|
|
|
import net.yacy.kelondro.util.Formatter;
|
|
|
|
import net.yacy.kelondro.util.MemoryControl;
|
|
|
|
import net.yacy.kelondro.util.MemoryControl;
|
|
|
|
|
|
|
|
|
|
|
|
import de.anomic.search.SearchEventCache;
|
|
|
|
import de.anomic.search.SearchEventCache;
|
|
|
|
import de.anomic.search.Switchboard;
|
|
|
|
import de.anomic.search.Switchboard;
|
|
|
|
import de.anomic.server.serverObjects;
|
|
|
|
import de.anomic.server.serverObjects;
|
|
|
|
import de.anomic.server.serverSwitch;
|
|
|
|
import de.anomic.server.serverSwitch;
|
|
|
|
|
|
|
|
|
|
|
|
public class PerformanceMemory_p {
|
|
|
|
public class PerformanceMemory_p {
|
|
|
|
|
|
|
|
|
|
|
|
private static final long KB = 1024;
|
|
|
|
private static final long KB = 1024;
|
|
|
|
private static final long MB = 1024 * KB;
|
|
|
|
private static final long MB = 1024 * KB;
|
|
|
|
private static Map<String, String> defaultSettings = null;
|
|
|
|
private static Map<String, String> defaultSettings = null;
|
|
|
|
|
|
|
|
|
|
|
|
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
|
|
|
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
|
|
|
// return variable that accumulates replacements
|
|
|
|
// return variable that accumulates replacements
|
|
|
|
final serverObjects prop = new serverObjects();
|
|
|
|
final serverObjects prop = new serverObjects();
|
|
|
|
if (defaultSettings == null) {
|
|
|
|
if (defaultSettings == null) {
|
|
|
|
defaultSettings = FileUtils.loadMap(new File(env.getAppPath(), "defaults/yacy.init"));
|
|
|
|
defaultSettings = FileUtils.loadMap(new File(env.getAppPath(), "defaults/yacy.init"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
prop.put("gc", "0");
|
|
|
|
prop.put("gc", "0");
|
|
|
|
if (post != null) {
|
|
|
|
if (post != null) {
|
|
|
|
if (post.containsKey("gc")) {
|
|
|
|
if (post.containsKey("gc")) {
|
|
|
@ -64,7 +63,7 @@ public class PerformanceMemory_p {
|
|
|
|
prop.put("gc", "1");
|
|
|
|
prop.put("gc", "1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final long memoryFreeNow = MemoryControl.free();
|
|
|
|
final long memoryFreeNow = MemoryControl.free();
|
|
|
|
final long memoryFreeAfterInitBGC = env.getConfigLong("memoryFreeAfterInitBGC", 0L);
|
|
|
|
final long memoryFreeAfterInitBGC = env.getConfigLong("memoryFreeAfterInitBGC", 0L);
|
|
|
|
final long memoryFreeAfterInitAGC = env.getConfigLong("memoryFreeAfterInitAGC", 0L);
|
|
|
|
final long memoryFreeAfterInitAGC = env.getConfigLong("memoryFreeAfterInitAGC", 0L);
|
|
|
@ -73,7 +72,7 @@ public class PerformanceMemory_p {
|
|
|
|
final long memoryTotalAfterInitBGC = env.getConfigLong("memoryTotalAfterInitBGC", 0L);
|
|
|
|
final long memoryTotalAfterInitBGC = env.getConfigLong("memoryTotalAfterInitBGC", 0L);
|
|
|
|
final long memoryTotalAfterInitAGC = env.getConfigLong("memoryTotalAfterInitAGC", 0L);
|
|
|
|
final long memoryTotalAfterInitAGC = env.getConfigLong("memoryTotalAfterInitAGC", 0L);
|
|
|
|
final long memoryTotalAfterStartup = env.getConfigLong("memoryTotalAfterStartup", 0L);
|
|
|
|
final long memoryTotalAfterStartup = env.getConfigLong("memoryTotalAfterStartup", 0L);
|
|
|
|
|
|
|
|
|
|
|
|
prop.putNum("memoryMax", MemoryControl.maxMemory / MB);
|
|
|
|
prop.putNum("memoryMax", MemoryControl.maxMemory / MB);
|
|
|
|
prop.putNum("memoryAvailAfterStartup", (MemoryControl.maxMemory - memoryTotalAfterStartup + memoryFreeAfterStartup) / MB);
|
|
|
|
prop.putNum("memoryAvailAfterStartup", (MemoryControl.maxMemory - memoryTotalAfterStartup + memoryFreeAfterStartup) / MB);
|
|
|
|
prop.putNum("memoryAvailAfterInitBGC", (MemoryControl.maxMemory - memoryTotalAfterInitBGC + memoryFreeAfterInitBGC) / MB);
|
|
|
|
prop.putNum("memoryAvailAfterInitBGC", (MemoryControl.maxMemory - memoryTotalAfterInitBGC + memoryFreeAfterInitBGC) / MB);
|
|
|
@ -91,7 +90,7 @@ public class PerformanceMemory_p {
|
|
|
|
prop.putNum("memoryUsedAfterInitBGC", (memoryTotalAfterInitBGC - memoryFreeAfterInitBGC) / KB);
|
|
|
|
prop.putNum("memoryUsedAfterInitBGC", (memoryTotalAfterInitBGC - memoryFreeAfterInitBGC) / KB);
|
|
|
|
prop.putNum("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB);
|
|
|
|
prop.putNum("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB);
|
|
|
|
prop.putNum("memoryUsedNow", (memoryTotalNow - memoryFreeNow) / MB);
|
|
|
|
prop.putNum("memoryUsedNow", (memoryTotalNow - memoryFreeNow) / MB);
|
|
|
|
|
|
|
|
|
|
|
|
// write table for Table index sizes
|
|
|
|
// write table for Table index sizes
|
|
|
|
Iterator<String> i = Table.filenames();
|
|
|
|
Iterator<String> i = Table.filenames();
|
|
|
|
String filename;
|
|
|
|
String filename;
|
|
|
@ -109,19 +108,19 @@ public class PerformanceMemory_p {
|
|
|
|
totalmem += mem;
|
|
|
|
totalmem += mem;
|
|
|
|
prop.put("EcoList_" + c + "_tableKeyMem", Formatter.bytesToString(mem));
|
|
|
|
prop.put("EcoList_" + c + "_tableKeyMem", Formatter.bytesToString(mem));
|
|
|
|
prop.put("EcoList_" + c + "_tableKeyChunkSize", map.get("tableKeyChunkSize"));
|
|
|
|
prop.put("EcoList_" + c + "_tableKeyChunkSize", map.get("tableKeyChunkSize"));
|
|
|
|
|
|
|
|
|
|
|
|
mem = Long.parseLong(map.get("tableValueMem"));
|
|
|
|
mem = Long.parseLong(map.get("tableValueMem"));
|
|
|
|
totalmem += mem;
|
|
|
|
totalmem += mem;
|
|
|
|
prop.put("EcoList_" + c + "_tableValueMem", Formatter.bytesToString(mem));
|
|
|
|
prop.put("EcoList_" + c + "_tableValueMem", Formatter.bytesToString(mem));
|
|
|
|
prop.put("EcoList_" + c + "_tableValueChunkSize", map.get("tableValueChunkSize"));
|
|
|
|
prop.put("EcoList_" + c + "_tableValueChunkSize", map.get("tableValueChunkSize"));
|
|
|
|
|
|
|
|
|
|
|
|
c++;
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.put("EcoList", c);
|
|
|
|
prop.put("EcoList", c);
|
|
|
|
prop.putNum("EcoIndexTotalMem", totalmem / (1024 * 1024d));
|
|
|
|
prop.putNum("EcoIndexTotalMem", totalmem / (1024 * 1024d));
|
|
|
|
|
|
|
|
|
|
|
|
// write object cache table
|
|
|
|
// write object cache table
|
|
|
|
Iterator<Map.Entry<String, RAMIndex>> oi = RAMIndex.objects();
|
|
|
|
final Iterator<Map.Entry<String, RAMIndex>> oi = RAMIndex.objects();
|
|
|
|
c = 0;
|
|
|
|
c = 0;
|
|
|
|
mem = 0;
|
|
|
|
mem = 0;
|
|
|
|
Map.Entry<String, RAMIndex> oie;
|
|
|
|
Map.Entry<String, RAMIndex> oie;
|
|
|
@ -130,25 +129,25 @@ public class PerformanceMemory_p {
|
|
|
|
while (oi.hasNext()) {
|
|
|
|
while (oi.hasNext()) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
oie = oi.next();
|
|
|
|
oie = oi.next();
|
|
|
|
} catch (ConcurrentModificationException e) {
|
|
|
|
} catch (final ConcurrentModificationException e) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
filename = oie.getKey();
|
|
|
|
filename = oie.getKey();
|
|
|
|
cache = oie.getValue();
|
|
|
|
cache = oie.getValue();
|
|
|
|
prop.put("indexcache_" + c + "_Name", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));
|
|
|
|
prop.put("indexcache_" + c + "_Name", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));
|
|
|
|
|
|
|
|
|
|
|
|
hitmem = cache.mem();
|
|
|
|
hitmem = cache.mem();
|
|
|
|
totalhitmem += hitmem;
|
|
|
|
totalhitmem += hitmem;
|
|
|
|
prop.put("indexcache_" + c + "_ChunkSize", cache.row().objectsize);
|
|
|
|
prop.put("indexcache_" + c + "_ChunkSize", cache.row().objectsize);
|
|
|
|
prop.putNum("indexcache_" + c + "_Count", cache.size());
|
|
|
|
prop.putNum("indexcache_" + c + "_Count", cache.size());
|
|
|
|
prop.put("indexcache_" + c + "_NeededMem", cache.size() * cache.row().objectsize);
|
|
|
|
prop.put("indexcache_" + c + "_NeededMem", cache.size() * cache.row().objectsize);
|
|
|
|
prop.put("indexcache_" + c + "_UsedMem", hitmem);
|
|
|
|
prop.put("indexcache_" + c + "_UsedMem", hitmem);
|
|
|
|
|
|
|
|
|
|
|
|
c++;
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.put("indexcache", c);
|
|
|
|
prop.put("indexcache", c);
|
|
|
|
prop.putNum("indexcacheTotalMem", totalhitmem / (1024 * 1024d));
|
|
|
|
prop.putNum("indexcacheTotalMem", totalhitmem / (1024 * 1024d));
|
|
|
|
|
|
|
|
|
|
|
|
// write object cache table
|
|
|
|
// write object cache table
|
|
|
|
i = Cache.filenames();
|
|
|
|
i = Cache.filenames();
|
|
|
|
c = 0;
|
|
|
|
c = 0;
|
|
|
@ -158,7 +157,7 @@ public class PerformanceMemory_p {
|
|
|
|
filename = i.next();
|
|
|
|
filename = i.next();
|
|
|
|
map = Cache.memoryStats(filename);
|
|
|
|
map = Cache.memoryStats(filename);
|
|
|
|
prop.put("ObjectList_" + c + "_objectCachePath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));
|
|
|
|
prop.put("ObjectList_" + c + "_objectCachePath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));
|
|
|
|
|
|
|
|
|
|
|
|
// hit cache
|
|
|
|
// hit cache
|
|
|
|
hitmem = Long.parseLong(map.get("objectHitMem"));
|
|
|
|
hitmem = Long.parseLong(map.get("objectHitMem"));
|
|
|
|
totalhitmem += hitmem;
|
|
|
|
totalhitmem += hitmem;
|
|
|
@ -171,7 +170,7 @@ public class PerformanceMemory_p {
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectHitCacheWriteDouble", map.get("objectHitCacheWriteDouble"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectHitCacheWriteDouble", map.get("objectHitCacheWriteDouble"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectHitCacheDeletes", map.get("objectHitCacheDeletes"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectHitCacheDeletes", map.get("objectHitCacheDeletes"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectHitCacheFlushes", map.get("objectHitCacheFlushes"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectHitCacheFlushes", map.get("objectHitCacheFlushes"));
|
|
|
|
|
|
|
|
|
|
|
|
// miss cache
|
|
|
|
// miss cache
|
|
|
|
missmem = Long.parseLong(map.get("objectMissMem"));
|
|
|
|
missmem = Long.parseLong(map.get("objectMissMem"));
|
|
|
|
totalmissmem += missmem;
|
|
|
|
totalmissmem += missmem;
|
|
|
@ -184,7 +183,7 @@ public class PerformanceMemory_p {
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectMissCacheWriteDouble", map.get("objectMissCacheWriteDouble"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectMissCacheWriteDouble", map.get("objectMissCacheWriteDouble"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectMissCacheDeletes", map.get("objectMissCacheDeletes"));
|
|
|
|
prop.putNum("ObjectList_" + c + "_objectMissCacheDeletes", map.get("objectMissCacheDeletes"));
|
|
|
|
//prop.put("ObjectList_" + c + "_objectMissCacheFlushes", map.get("objectMissCacheFlushes"));
|
|
|
|
//prop.put("ObjectList_" + c + "_objectMissCacheFlushes", map.get("objectMissCacheFlushes"));
|
|
|
|
|
|
|
|
|
|
|
|
c++;
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.put("ObjectList", c);
|
|
|
|
prop.put("ObjectList", c);
|
|
|
@ -192,11 +191,17 @@ public class PerformanceMemory_p {
|
|
|
|
prop.putNum("objectCacheStartShrink", Cache.getMemStartShrink() / (1024 * 1024d));
|
|
|
|
prop.putNum("objectCacheStartShrink", Cache.getMemStartShrink() / (1024 * 1024d));
|
|
|
|
prop.putNum("objectHitCacheTotalMem", totalhitmem / (1024 * 1024d));
|
|
|
|
prop.putNum("objectHitCacheTotalMem", totalhitmem / (1024 * 1024d));
|
|
|
|
prop.putNum("objectMissCacheTotalMem", totalmissmem / (1024 * 1024d));
|
|
|
|
prop.putNum("objectMissCacheTotalMem", totalmissmem / (1024 * 1024d));
|
|
|
|
|
|
|
|
|
|
|
|
// other caching structures
|
|
|
|
// other caching structures
|
|
|
|
prop.putNum("namecacheHit.size", Domains.nameCacheHitSize());
|
|
|
|
prop.putNum("namecacheHit.size", Domains.nameCacheHitSize());
|
|
|
|
|
|
|
|
prop.putNum("namecacheHit.Hit", Domains.cacheHit_Hit);
|
|
|
|
|
|
|
|
prop.putNum("namecacheHit.Miss", Domains.cacheHit_Miss);
|
|
|
|
|
|
|
|
prop.putNum("namecacheHit.Insert", Domains.cacheHit_Insert);
|
|
|
|
prop.putNum("namecacheMiss.size", Domains.nameCacheMissSize());
|
|
|
|
prop.putNum("namecacheMiss.size", Domains.nameCacheMissSize());
|
|
|
|
prop.putNum("namecache.noCache", 0);
|
|
|
|
prop.putNum("namecacheMiss.Hit", Domains.cacheMiss_Hit);
|
|
|
|
|
|
|
|
prop.putNum("namecacheMiss.Miss", Domains.cacheMiss_Miss);
|
|
|
|
|
|
|
|
prop.putNum("namecacheMiss.Insert", Domains.cacheMiss_Insert);
|
|
|
|
|
|
|
|
prop.putNum("namecache.noCache", Domains.nameCacheNoCachingPatternsSize());
|
|
|
|
prop.putNum("blacklistcache.size", Switchboard.urlBlacklist.blacklistCacheSize());
|
|
|
|
prop.putNum("blacklistcache.size", Switchboard.urlBlacklist.blacklistCacheSize());
|
|
|
|
prop.putNum("searchevent.size", SearchEventCache.size());
|
|
|
|
prop.putNum("searchevent.size", SearchEventCache.size());
|
|
|
|
prop.putNum("searchevent.hit", SearchEventCache.cacheHit);
|
|
|
|
prop.putNum("searchevent.hit", SearchEventCache.cacheHit);
|
|
|
|